Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
bb9f818b
authored
Nov 12, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add magic buttons to HostForm
parent
c3c23feb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
circle/network/forms.py
+5
-3
circle/network/static/js/network.js
+19
-0
No files found.
circle/network/forms.py
View file @
bb9f818b
...
...
@@ -21,7 +21,7 @@ from django.utils.translation import ugettext_lazy as _
from
crispy_forms.helper
import
FormHelper
from
crispy_forms.layout
import
Layout
,
Fieldset
,
Div
,
Submit
,
BaseInput
from
crispy_forms.bootstrap
import
FormActions
from
crispy_forms.bootstrap
import
FormActions
,
AppendedText
from
firewall.models
import
(
Host
,
Vlan
,
Domain
,
Group
,
Record
,
BlacklistItem
,
Rule
,
VlanGroup
,
SwitchPort
)
...
...
@@ -122,8 +122,10 @@ class HostForm(ModelForm):
Fieldset
(
_
(
'Network'
),
'vlan'
,
'ipv4'
,
'ipv6'
,
AppendedText
(
'ipv4'
,
'<i class="fa fa-magic" id="ipv4-magic"></i>'
),
AppendedText
(
'ipv6'
,
'<i class="fa fa-magic" id="ipv6-magic"></i>'
),
'shared_ip'
,
'external_ipv4'
,
),
...
...
circle/network/static/js/network.js
View file @
bb9f818b
...
...
@@ -30,4 +30,23 @@ function getURLParameter(name) {
$
(
function
()
{
$
(
"[title]"
).
tooltip
();
$
(
"#ipv6-magic"
).
click
(
function
()
{
$
.
ajax
({
url
:
window
.
location
,
data
:
{
ipv4
:
$
(
"[name=ipv4]"
).
val
(),
vlan
:
$
(
"[name=vlan]"
).
val
()},
success
:
function
(
data
)
{
$
(
"[name=ipv6]"
).
val
(
data
[
"ipv6"
]);
}});
});
$
(
"#ipv4-magic"
).
click
(
function
()
{
$
.
ajax
({
url
:
window
.
location
,
data
:
{
vlan
:
$
(
"[name=vlan]"
).
val
()},
success
:
function
(
data
)
{
$
(
"[name=ipv4]"
).
val
(
data
[
"ipv4"
]);
if
(
!
$
(
"[name=ipv6]"
).
val
())
{
$
(
"[name=ipv6]"
).
val
(
data
[
"ipv6"
]);
}
}});
});
});
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