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
fa0bd815
authored
May 05, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: warn the user to select something in template choose
parent
0ae68ec4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
circle/dashboard/static/dashboard/dashboard.js
+10
-0
circle/dashboard/templates/dashboard/_template-create-1.html
+4
-3
circle/dashboard/views.py
+3
-0
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
fa0bd815
...
...
@@ -46,6 +46,16 @@ $(function () {
$
(
'#create-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#create-modal'
).
remove
();
});
// check if user selected anything
$
(
"#template-choose-next-button"
).
click
(
function
()
{
var
radio
=
$
(
'input[type="radio"]:checked'
,
"#template-choose-form"
).
val
();
if
(
!
radio
)
{
$
(
"#template-choose-alert"
).
addClass
(
"alert-warning"
)
.
text
(
gettext
(
"Select an option to proceed!"
));
return
false
;
}
return
true
;
});
}
});
return
false
;
...
...
circle/dashboard/templates/dashboard/_template-create-1.html
View file @
fa0bd815
{% load i18n %}
<div
class=
"alert alert-info"
>
<div
class=
"alert alert-info"
id=
"template-choose-alert"
>
{% trans "Customize an existing template or create a brand new one from scratch!" %}
</div>
<form
action=
"{% url "
dashboard
.
views
.
template-choose
"
%}"
method=
"POST"
>
<form
action=
"{% url "
dashboard
.
views
.
template-choose
"
%}"
method=
"POST"
id=
"template-choose-form"
>
{% csrf_token %}
<div
class=
"template-choose-list"
>
{% for t in templates %}
...
...
@@ -19,7 +20,7 @@
<input
type=
"radio"
name=
"parent"
value=
"base_vm"
/>
{% trans "Create a new base VM without disk" %}
</div>
<button
type=
"submit"
class=
"btn btn-success pull-right"
>
{% trans "Next" %}
</button>
<button
type=
"submit"
id=
"template-choose-next-button"
class=
"btn btn-success pull-right"
>
{% trans "Next" %}
</button>
<div
class=
"clearfix"
></div>
</div>
</form>
...
...
circle/dashboard/views.py
View file @
fa0bd815
...
...
@@ -853,6 +853,9 @@ class TemplateChoose(TemplateView):
template
=
request
.
POST
.
get
(
"parent"
)
if
template
==
"base_vm"
:
return
redirect
(
reverse
(
"dashboard.views.template-create"
))
elif
template
is
None
:
messages
.
warning
(
request
,
_
(
"Select an option to proceed!"
))
return
redirect
(
reverse
(
"dashboard.views.template-choose"
))
else
:
template
=
get_object_or_404
(
InstanceTemplate
,
pk
=
template
)
...
...
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