Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
716cc5ef
authored
Feb 12, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webui: better template name checking (ajax)
parent
5685b1c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
20 deletions
+31
-20
one/templates/new-template-flow.html
+31
-20
No files found.
one/templates/new-template-flow.html
View file @
716cc5ef
...
...
@@ -69,26 +69,37 @@
$
(
"#new-template-size-summary-"
+
v
).
show
();
});
$
(
'#new-template-step-2 nav .next'
).
attr
(
"disabled"
,
"disabled"
);
$
(
"#new-template-name"
).
change
(
function
(
e
){
var
s
=
$
(
this
).
val
();
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'/ajax/template_name_unique/'
+
s
,
'success'
:
function
(
data
,
b
,
c
)
{
if
(
s
!=
$
(
"#new-template-name"
).
val
())
{
return
True
;
}
if
(
data
==
"True"
)
{
$
(
'#new-template-name'
).
removeClass
(
"error"
);
$
(
'#new-template-step-2 nav .next'
).
removeAttr
(
"disabled"
);
}
else
{
$
(
'#new-template-name'
).
addClass
(
"error"
);
$
(
'#new-template-step-2 nav .next'
).
attr
(
"disabled"
,
"disabled"
);
}
}
});
});
$
(
"#new-template-name"
).
keyup
(
function
(){
var
timer
;
return
function
(
e
){
var
self
=
this
;
clearTimeout
(
timer
);
console
.
log
(
'asdasdasdasd'
);
timer
=
setTimeout
(
function
(){
console
.
log
(
'asd'
);
var
s
=
$
(
self
).
val
();
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'/ajax/template_name_unique/'
+
s
,
'success'
:
function
(
data
,
b
,
c
)
{
if
(
s
!=
$
(
"#new-template-name"
).
val
())
{
return
true
;
}
if
(
data
==
"True"
)
{
$
(
'#new-template-name'
).
removeClass
(
"error"
);
$
(
'#new-template-step-2 nav .next'
).
removeAttr
(
"disabled"
);
$
(
'#new-template-name'
).
removeProp
(
"title"
);
}
else
{
$
(
'#new-template-name'
).
addClass
(
"error"
);
$
(
'#new-template-step-2 nav .next'
).
attr
(
"disabled"
,
"disabled"
);
$
(
'#new-template-name'
).
prop
(
"title"
,
gettext
(
'Please choose a different name.'
));
}
}
});
},
1000
)
}
}());
})
</script>
</div>
...
...
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