Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
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
23688646
authored
Oct 24, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: better click event handling in vm create
parent
a9f0aa50
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
25 deletions
+20
-25
circle/dashboard/static/dashboard/dashboard.js
+20
-25
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
23688646
...
@@ -79,7 +79,6 @@ function vmCreateTemplateChange(new_this) {
...
@@ -79,7 +79,6 @@ function vmCreateTemplateChange(new_this) {
vmCreateNetworkLabel
(
nn
.
vlan_pk
,
nn
.
vlan
,
nn
.
managed
)
vmCreateNetworkLabel
(
nn
.
vlan_pk
,
nn
.
vlan
,
nn
.
managed
)
);
);
}
}
vmCreateAddRemoveNetworkClick
();
}
}
}
}
});
});
...
@@ -87,31 +86,8 @@ function vmCreateTemplateChange(new_this) {
...
@@ -87,31 +86,8 @@ function vmCreateTemplateChange(new_this) {
function
vmCreateNetworkLabel
(
pk
,
name
,
managed
)
{
function
vmCreateNetworkLabel
(
pk
,
name
,
managed
)
{
return
'<span id="vlan-'
+
pk
+
'" class="label label-'
+
(
managed
?
'primary'
:
'default'
)
+
'"><i class="icon-'
+
(
managed
?
'globe'
:
'link'
)
+
'"></i> '
+
name
+
' <a href="#" class="hover-black vm-create-remove-network"><i class="icon-remove-sign"></i></a></span> '
;
return
'<span id="vlan-'
+
pk
+
'" class="label label-'
+
(
managed
?
'primary'
:
'default'
)
+
'"><i class="icon-'
+
(
managed
?
'globe'
:
'link'
)
+
'"></i> '
+
name
+
' <a href="#" class="hover-black vm-create-remove-network"><i class="icon-remove-sign"></i></a></span> '
;
}
}
// #TODO this doesn't feel right
function
vmCreateAddRemoveNetworkClick
()
{
$
(
'.vm-create-remove-network'
).
click
(
function
()
{
var
vlan_pk
=
(
$
(
this
).
parent
(
'span'
).
prop
(
'id'
)).
replace
(
'vlan-'
,
''
);
$
(
this
).
parent
(
'span'
).
fadeOut
(
500
,
function
()
{
$
(
this
).
remove
();
var
vlan_name
=
$
(
this
).
text
();
$
(
'#vm-create-network-add-select'
).
append
(
$
(
'<option>'
,
{
value
:
vlan_pk
,
text
:
vlan_name
}));
if
(
$
(
'#vm-create-network-list'
).
children
(
'span'
).
length
<
1
)
{
$
(
'#vm-create-network-list'
).
append
(
'Not added to any network!'
);
}
});
return
false
;
});
}
function
vmCreateLoaded
()
{
function
vmCreateLoaded
()
{
// temporarily disable for testing
// temporarily disable for testing
...
@@ -139,12 +115,31 @@ function vmCreateLoaded() {
...
@@ -139,12 +115,31 @@ function vmCreateLoaded() {
vmCreateNetworkLabel
(
option
.
val
(),
option
.
text
(),
true
)
vmCreateNetworkLabel
(
option
.
val
(),
option
.
text
(),
true
)
);
);
$
(
'option:selected'
,
$
(
'#vm-create-network-add-select'
)).
remove
();
$
(
'option:selected'
,
$
(
'#vm-create-network-add-select'
)).
remove
();
vmCreateAddRemoveNetworkClick
();
}
}
return
false
;
return
false
;
});
});
// event for network remove button (icon, X)
// TODO still not the right place
$
(
'body'
).
on
(
'click'
,
'.vm-create-remove-network'
,
function
()
{
var
vlan_pk
=
(
$
(
this
).
parent
(
'span'
).
prop
(
'id'
)).
replace
(
'vlan-'
,
''
);
$
(
this
).
parent
(
'span'
).
fadeOut
(
500
,
function
()
{
$
(
this
).
remove
();
var
vlan_name
=
$
(
this
).
text
();
$
(
'#vm-create-network-add-select'
).
append
(
$
(
'<option>'
,
{
value
:
vlan_pk
,
text
:
vlan_name
}));
if
(
$
(
'#vm-create-network-list'
).
children
(
'span'
).
length
<
1
)
{
$
(
'#vm-create-network-list'
).
append
(
'Not added to any network!'
);
}
});
return
false
;
});
$
(
"[data-slider]"
).
each
(
function
()
{
$
(
"[data-slider]"
).
each
(
function
()
{
if
(
$
(
this
).
css
(
'display'
)
!=
"none"
)
if
(
$
(
this
).
css
(
'display'
)
!=
"none"
)
$
(
this
).
simpleSlider
();
$
(
this
).
simpleSlider
();
...
...
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