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
97277697
authored
Sep 11, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: create record button from domain edit
parent
44798159
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
53 deletions
+71
-53
circle/network/static/js/network.js
+7
-0
circle/network/static/js/record.js
+54
-49
circle/network/templates/network/domain-edit.html
+4
-4
circle/network/views.py
+6
-0
No files found.
circle/network/static/js/network.js
View file @
97277697
...
@@ -20,3 +20,10 @@ function getCookie(name) {
...
@@ -20,3 +20,10 @@ function getCookie(name) {
}
}
return
cookieValue
;
return
cookieValue
;
}
}
function
getURLParameter
(
name
)
{
return
decodeURI
(
(
RegExp
(
name
+
'='
+
'(.+?)(&|$)'
).
exec
(
location
.
search
)
||
[,
null
])[
1
]
);
}
circle/network/static/js/record.js
View file @
97277697
...
@@ -255,55 +255,6 @@ function resetName() {
...
@@ -255,55 +255,6 @@ function resetName() {
}
}
// on page load
// if we are upadting
// - set the name and address
// else it's a new rule so we "create" the wizard thingy
$
(
function
()
{
// type is set, so it's an existing record
if
(
$
(
'#id_type :selected'
).
val
())
{
if
(
$
(
'#id_host :selected'
).
val
())
{
setNameAndAddress
();
}
}
// else we are creaing a new
else
{
new_record
=
true
;
// hide all input containers
$
(
'div[id^="div_id_"]'
).
hide
();
// hide the save button
$
(
'#submit-id-submit'
).
hide
();
//
$
(
'#div_id_type .controls'
)
.
addClass
(
'input-group'
)
.
append
(
//' <a id="type_next" onclick="type_next()" class="btn btn-info">Next</a>'
'<span id="type_next" class="input-group-addon"><strong>'
+
gettext
(
'Specify a type!'
)
+
'</strong></span>'
);
$
(
'#div_id_type'
).
fadeIn
();
}
});
// if the user choose a type
function
type_next
()
{
if
(
$
(
'#div_id_type :selected'
).
val
())
{
$
(
'#div_id_type .controls'
).
removeClass
(
'input-group'
);
$
(
'#type_next'
).
remove
();
$
(
'div[id^="div_id_"]'
).
fadeIn
();
$
(
'#submit-id-submit'
).
fadeIn
();
// this shouldn't be called ...
}
else
{
message
=
[{
'message'
:
gettext
(
'You must choose a type'
),
'id'
:
'type'
}];
appendMessage
(
'error'
,
message
);
}
return
false
;
}
/*
/*
* error creating function
* error creating function
*
*
...
@@ -338,3 +289,57 @@ $('* [id^="id_"]').focus(function() {
...
@@ -338,3 +289,57 @@ $('* [id^="id_"]').focus(function() {
$
(
'span[id="error_1_'
+
$
(
this
).
attr
(
'id'
)
+
'"]'
).
remove
();
$
(
'span[id="error_1_'
+
$
(
this
).
attr
(
'id'
)
+
'"]'
).
remove
();
}
}
});
});
// on page load
// if we are upadting
// - set the name and address
// else it's a new rule so we "create" the wizard thingy
$
(
function
()
{
// type is set, so it's an existing record
if
(
$
(
'#id_type :selected'
).
val
())
{
if
(
$
(
'#id_host :selected'
).
val
())
{
setNameAndAddress
();
}
}
// else we are creaing a new
else
{
domain
=
getURLParameter
(
'domain'
);
if
(
domain
!=
'null'
&&
domain
.
length
>
0
)
{
new_record
=
false
;
}
else
{
new_record
=
true
;
// hide all input containers
$
(
'div[id^="div_id_"]'
).
hide
();
// hide the save button
$
(
'#submit-id-submit'
).
hide
();
//
$
(
'#div_id_type .controls'
)
.
addClass
(
'input-group'
)
.
append
(
//' <a id="type_next" onclick="type_next()" class="btn btn-info">Next</a>'
'<span id="type_next" class="input-group-addon"><strong>'
+
gettext
(
'Specify a type!'
)
+
'</strong></span>'
);
$
(
'#div_id_type'
).
fadeIn
();
}
}
});
// if the user choose a type
function
type_next
()
{
if
(
$
(
'#div_id_type :selected'
).
val
())
{
$
(
'#div_id_type .controls'
).
removeClass
(
'input-group'
);
$
(
'#type_next'
).
remove
();
$
(
'div[id^="div_id_"]'
).
fadeIn
();
$
(
'#submit-id-submit'
).
fadeIn
();
// this shouldn't be called ...
}
else
{
message
=
[{
'message'
:
gettext
(
'You must choose a type'
),
'id'
:
'type'
}];
appendMessage
(
'error'
,
message
);
}
return
false
;
}
circle/network/templates/network/domain-edit.html
View file @
97277697
...
@@ -16,10 +16,10 @@
...
@@ -16,10 +16,10 @@
{% crispy form %}
{% crispy form %}
</div>
</div>
<div
class=
"col-sm-6 col-sm-offset-1"
>
<div
class=
"col-sm-6 col-sm-offset-1"
>
<
h3
>
<
div
class=
"page-header"
>
{% trans "List of this domain's records" %}
<a
href=
"{% url "
network
.
record_create
"
%}?
domain=
{{
domain_pk
}}"
class=
"btn btn-success pull-right btn-xs"
><i
class=
"icon-plus-sign"
></i>
{% trans "Add new record" %}
</a>
</h3>
<h3>
{% trans "List of this domain's records" %}
</h3>
<
hr
/
>
<
/div
>
<div
class=
"table-responsive"
>
<div
class=
"table-responsive"
>
{% render_table record_list %}
{% render_table record_list %}
</div>
</div>
...
...
circle/network/views.py
View file @
97277697
...
@@ -459,6 +459,12 @@ class RecordCreate(CreateView, SuccessMessageMixin):
...
@@ -459,6 +459,12 @@ class RecordCreate(CreateView, SuccessMessageMixin):
# TODO fqdn
# TODO fqdn
success_message
=
_
(
u'Successfully created record!'
)
success_message
=
_
(
u'Successfully created record!'
)
def
get_initial
(
self
):
return
{
# 'owner': 1,
'domain'
:
self
.
request
.
GET
.
get
(
'domain'
),
}
class
RecordDelete
(
DeleteView
):
class
RecordDelete
(
DeleteView
):
model
=
Record
model
=
Record
...
...
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