Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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 () {
...
@@ -46,6 +46,16 @@ $(function () {
$
(
'#create-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#create-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#create-modal'
).
remove
();
$
(
'#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
;
return
false
;
...
...
circle/dashboard/templates/dashboard/_template-create-1.html
View file @
fa0bd815
{% load i18n %}
{% 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!" %}
{% trans "Customize an existing template or create a brand new one from scratch!" %}
</div>
</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 %}
{% csrf_token %}
<div
class=
"template-choose-list"
>
<div
class=
"template-choose-list"
>
{% for t in templates %}
{% for t in templates %}
...
@@ -19,7 +20,7 @@
...
@@ -19,7 +20,7 @@
<input
type=
"radio"
name=
"parent"
value=
"base_vm"
/>
<input
type=
"radio"
name=
"parent"
value=
"base_vm"
/>
{% trans "Create a new base VM without disk" %}
{% trans "Create a new base VM without disk" %}
</div>
</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
class=
"clearfix"
></div>
</div>
</div>
</form>
</form>
...
...
circle/dashboard/views.py
View file @
fa0bd815
...
@@ -853,6 +853,9 @@ class TemplateChoose(TemplateView):
...
@@ -853,6 +853,9 @@ class TemplateChoose(TemplateView):
template
=
request
.
POST
.
get
(
"parent"
)
template
=
request
.
POST
.
get
(
"parent"
)
if
template
==
"base_vm"
:
if
template
==
"base_vm"
:
return
redirect
(
reverse
(
"dashboard.views.template-create"
))
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
:
else
:
template
=
get_object_or_404
(
InstanceTemplate
,
pk
=
template
)
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