Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
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 @@
$
(
'i[class="icon-remove"]'
).
click
(
function
()
{
href
=
$
(
this
).
parent
(
'a'
).
attr
(
'href'
);
csrf
=
getCookie
(
'csrftoken'
);
var
click_this
=
this
;
bootbox
.
dialog
(
"Are you sure?"
,
[
{
"label"
:
"Cancel"
,
"class"
:
"btn-info"
,
"callback"
:
function
()
{}
},
{
"label"
:
"Remove"
,
"class"
:
"btn-danger"
,
"callback"
:
function
()
{
delete_rule_or_group
(
click_this
);
host
=
$
(
'.page-header'
).
children
(
'h2'
).
text
()
group
=
$
(
this
).
closest
(
'h4'
).
text
();
text
=
gettext
(
'Are you sure you want to remove host group <strong>"%(group)s"</strong> from <strong>"%(host)s"</strong>?'
);
s
=
interpolate
(
text
,
{
'group'
:
group
,
'host'
:
host
},
true
);
bootbox
.
dialog
({
message
:
s
,
buttons
:
{
cancel
:
{
'label'
:
"Cancel"
,
'className'
:
"btn-info"
,
'callback'
:
function
()
{}
},
remove
:
{
'label'
:
"Remove"
,
'className'
:
"btn-danger"
,
'callback'
:
function
()
{
delete_rule_or_group
(
click_this
);
}
}
}
]
);
}
);
return
false
;
});
...
...
network/templates/network/base.html
View file @
359099ed
...
...
@@ -82,6 +82,7 @@
<script
src=
"http://code.jquery.com/jquery-latest.js"
></script>
<script
src=
"{% url network.js_catalog %}"
></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
/
network
.
js
"
%}"
></script>
<script>
...
...
network/templates/network/confirm/remove_host_group.html
View file @
359099ed
...
...
@@ -7,7 +7,7 @@
<h1>
Remove
<small></small></h1>
</div>
<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>
<input
type=
"hidden"
value=
"{{ request.GET.from }}"
name=
"next"
/>
<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):
# for post we actually remove the group from the host
elif
request
.
method
==
"POST"
:
host
.
groups
.
remove
(
group
)
messages
.
success
(
request
,
_
(
"Successfully removed
%(host)
s from "
"
%(group)
s group!"
%
{
'host'
:
host
,
'group'
:
group
}))
if
not
request
.
is_ajax
():
messages
.
success
(
request
,
_
(
"Successfully removed
%(host)
s from "
"
%(group)
s group!"
%
{
'host'
:
host
,
'group'
:
group
}))
return
redirect
(
reverse_lazy
(
'network.host'
,
kwargs
=
{
'pk'
:
kwargs
[
'pk'
]}))
...
...
@@ -633,9 +634,10 @@ def add_host_group(request, **kwargs):
host
=
Host
.
objects
.
get
(
pk
=
kwargs
[
'pk'
])
group
=
Group
.
objects
.
get
(
pk
=
group_pk
)
host
.
groups
.
add
(
group
)
messages
.
success
(
request
,
_
(
"Successfully added
%(host)
s to group "
"
%(group)
s!"
%
{
'host'
:
host
,
'group'
:
group
}))
if
not
request
.
is_ajax
():
messages
.
success
(
request
,
_
(
"Successfully added
%(host)
s to group"
"
%(group)
s!"
%
{
'host'
:
host
,
'group'
:
group
}))
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