Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
359099ed
authored
Sep 05, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: bootbox for bootstrap 3
parent
02e4350c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
24 deletions
+34
-24
network/static/js/bootbox.min.js
+0
-0
network/static/js/network.js
+20
-13
network/templates/network/base.html
+1
-0
network/templates/network/confirm/remove_host_group.html
+1
-1
network/views.py
+12
-10
No files found.
network/static/js/bootbox.min.js
View file @
359099ed
This diff is collapsed.
Click to expand it.
network/static/js/network.js
View file @
359099ed
...
@@ -3,23 +3,30 @@
...
@@ -3,23 +3,30 @@
$
(
'i[class="icon-remove"]'
).
click
(
function
()
{
$
(
'i[class="icon-remove"]'
).
click
(
function
()
{
href
=
$
(
this
).
parent
(
'a'
).
attr
(
'href'
);
href
=
$
(
this
).
parent
(
'a'
).
attr
(
'href'
);
csrf
=
getCookie
(
'csrftoken'
);
csrf
=
getCookie
(
'csrftoken'
);
var
click_this
=
this
;
var
click_this
=
this
;
bootbox
.
dialog
(
"Are you sure?"
,
[
host
=
$
(
'.page-header'
).
children
(
'h2'
).
text
()
{
group
=
$
(
this
).
closest
(
'h4'
).
text
();
"label"
:
"Cancel"
,
"class"
:
"btn-info"
,
text
=
gettext
(
'Are you sure you want to remove host group <strong>"%(group)s"</strong> from <strong>"%(host)s"</strong>?'
);
"callback"
:
function
()
{}
s
=
interpolate
(
text
,
{
'group'
:
group
,
'host'
:
host
},
true
);
},
bootbox
.
dialog
({
{
message
:
s
,
"label"
:
"Remove"
,
buttons
:
{
"class"
:
"btn-danger"
,
cancel
:
{
"callback"
:
function
()
{
'label'
:
"Cancel"
,
delete_rule_or_group
(
click_this
);
'className'
:
"btn-info"
,
'callback'
:
function
()
{}
},
remove
:
{
'label'
:
"Remove"
,
'className'
:
"btn-danger"
,
'callback'
:
function
()
{
delete_rule_or_group
(
click_this
);
}
}
}
}
}
]
);
}
);
return
false
;
return
false
;
});
});
...
...
network/templates/network/base.html
View file @
359099ed
...
@@ -82,6 +82,7 @@
...
@@ -82,6 +82,7 @@
<script
src=
"http://code.jquery.com/jquery-latest.js"
></script>
<script
src=
"http://code.jquery.com/jquery-latest.js"
></script>
<script
src=
"{% url network.js_catalog %}"
></script>
<script
src=
"{% url network.js_catalog %}"
></script>
<script
src=
"//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"
></script>
<script
src=
"//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"
></script>
<script
src=
"{% static "
js
/
bootbox
.
min
.
js
"
%}"
></script>
<!--<script src="{% static "js/select2-3.4.0/select2.min.js" %}"></script>-->
<!--<script src="{% static "js/select2-3.4.0/select2.min.js" %}"></script>-->
<script
src=
"{% static "
js
/
network
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
network
.
js
"
%}"
></script>
<script>
<script>
...
...
network/templates/network/confirm/remove_host_group.html
View file @
359099ed
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<h1>
Remove
<small></small></h1>
<h1>
Remove
<small></small></h1>
</div>
</div>
<form
action=
""
method=
"post"
>
{% csrf_token %}
<form
action=
""
method=
"post"
>
{% csrf_token %}
<p>
Are you sure you want to remove host
group
<strong>
"{{ group }}"
</strong>
<p>
Are you sure you want to remove host
group
<strong>
"{{ group }}"
</strong>
from
<strong>
"{{ host }}"
</strong>
?
</p>
from
<strong>
"{{ host }}"
</strong>
?
</p>
<input
type=
"hidden"
value=
"{{ request.GET.from }}"
name=
"next"
/>
<input
type=
"hidden"
value=
"{{ request.GET.from }}"
name=
"next"
/>
<a
href=
"{{ request.GET.from }}"
class=
"btn btn-info"
>
Back
</a>
<a
href=
"{{ request.GET.from }}"
class=
"btn btn-info"
>
Back
</a>
...
...
network/views.py
View file @
359099ed
...
@@ -618,11 +618,12 @@ def remove_host_group(request, **kwargs):
...
@@ -618,11 +618,12 @@ def remove_host_group(request, **kwargs):
# for post we actually remove the group from the host
# for post we actually remove the group from the host
elif
request
.
method
==
"POST"
:
elif
request
.
method
==
"POST"
:
host
.
groups
.
remove
(
group
)
host
.
groups
.
remove
(
group
)
messages
.
success
(
request
,
_
(
"Successfully removed
%(host)
s from "
if
not
request
.
is_ajax
():
"
%(group)
s group!"
%
{
messages
.
success
(
request
,
_
(
"Successfully removed
%(host)
s from "
'host'
:
host
,
"
%(group)
s group!"
%
{
'group'
:
group
'host'
:
host
,
}))
'group'
:
group
}))
return
redirect
(
reverse_lazy
(
'network.host'
,
return
redirect
(
reverse_lazy
(
'network.host'
,
kwargs
=
{
'pk'
:
kwargs
[
'pk'
]}))
kwargs
=
{
'pk'
:
kwargs
[
'pk'
]}))
...
@@ -633,9 +634,10 @@ def add_host_group(request, **kwargs):
...
@@ -633,9 +634,10 @@ def add_host_group(request, **kwargs):
host
=
Host
.
objects
.
get
(
pk
=
kwargs
[
'pk'
])
host
=
Host
.
objects
.
get
(
pk
=
kwargs
[
'pk'
])
group
=
Group
.
objects
.
get
(
pk
=
group_pk
)
group
=
Group
.
objects
.
get
(
pk
=
group_pk
)
host
.
groups
.
add
(
group
)
host
.
groups
.
add
(
group
)
messages
.
success
(
request
,
_
(
"Successfully added
%(host)
s to group "
if
not
request
.
is_ajax
():
"
%(group)
s!"
%
{
messages
.
success
(
request
,
_
(
"Successfully added
%(host)
s to group"
'host'
:
host
,
"
%(group)
s!"
%
{
'group'
:
group
'host'
:
host
,
}))
'group'
:
group
}))
return
redirect
(
reverse_lazy
(
'network.host'
,
kwargs
=
kwargs
))
return
redirect
(
reverse_lazy
(
'network.host'
,
kwargs
=
kwargs
))
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