Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
210e6c32
authored
Oct 24, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: reworked modal creation with ajax
parent
23688646
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
23 deletions
+20
-23
circle/dashboard/static/dashboard/dashboard.js
+1
-20
circle/dashboard/templates/dashboard/modal-wrapper.html
+17
-0
circle/dashboard/templates/dashboard/nojs-wrapper.html
+0
-0
circle/dashboard/views.py
+2
-3
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
210e6c32
...
@@ -4,26 +4,7 @@ $(function () {
...
@@ -4,26 +4,7 @@ $(function () {
type
:
'GET'
,
type
:
'GET'
,
url
:
'/dashboard/vm/create/'
,
url
:
'/dashboard/vm/create/'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
// TODO this is still ugly
$
(
'body'
).
append
(
data
);
var
html
=
'<div class="modal fade" id="vm-create-modal" tabindex="-1" role="dialog">'
+
'<div class="modal-dialog">'
+
'<div class="modal-content">'
+
'<div class="modal-header">'
+
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'
+
'<h4 class="modal-title">Create VM</h4>'
+
'</div>'
+
'<div class="modal-body"> '
+
data
+
'</div>'
+
/*'<div class="modal-footer">' +
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>' +
'<button type="button" class="btn btn-primary">Save changes</button>' +
'</div>' + */
'</div><!-- /.modal-content -->'
+
'</div><!-- /.modal-dialog -->'
+
'</div>'
;
$
(
'body'
).
append
(
html
);
vmCreateLoaded
();
vmCreateLoaded
();
$
(
'#vm-create-modal'
).
modal
(
'show'
);
$
(
'#vm-create-modal'
).
modal
(
'show'
);
$
(
'#vm-create-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#vm-create-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
...
...
circle/dashboard/templates/dashboard/modal-wrapper.html
0 → 100644
View file @
210e6c32
<div
class=
"modal fade"
id=
"vm-create-modal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
<h4
class=
"modal-title"
>
{{ box_title }}
</h4>
</div>
<div
class=
"modal-body"
>
{% include template %}
</div>
<!--<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>-->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
circle/dashboard/templates/dashboard/
ajax
-wrapper.html
→
circle/dashboard/templates/dashboard/
nojs
-wrapper.html
View file @
210e6c32
File moved
circle/dashboard/views.py
View file @
210e6c32
...
@@ -94,13 +94,12 @@ class VmCreate(TemplateView):
...
@@ -94,13 +94,12 @@ class VmCreate(TemplateView):
def
get_template_names
(
self
):
def
get_template_names
(
self
):
if
self
.
request
.
is_ajax
():
if
self
.
request
.
is_ajax
():
return
[
'dashboard/
vm-create
.html'
]
return
[
'dashboard/
modal-wrapper
.html'
]
else
:
else
:
return
[
'dashboard/
ajax
-wrapper.html'
]
return
[
'dashboard/
nojs
-wrapper.html'
]
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
context
=
self
.
get_context_data
(
**
kwargs
)
context
=
self
.
get_context_data
(
**
kwargs
)
if
not
request
.
is_ajax
():
context
.
update
({
context
.
update
({
'template'
:
'dashboard/vm-create.html'
,
'template'
:
'dashboard/vm-create.html'
,
'box_title'
:
'Create a VM'
'box_title'
:
'Create a VM'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment