mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-27 20:38:48 +01:00
Fix for Ticket #630 http://dev.rousette.org.uk/ticket/630
This commit is contained in:
parent
b96def669d
commit
d2c5775a69
1 changed files with 15 additions and 1 deletions
|
|
@ -24,7 +24,21 @@
|
|||
:html=> { :id=>'todo-form-new-action', :name=>'todo', :class => 'inline-form' },
|
||||
:before => "$('todo_new_action_submit').startWaiting()",
|
||||
:complete => "$('todo_new_action_submit').stopWaiting()",
|
||||
:condition => "!$('todo_new_action_submit').isWaiting()") do -%>
|
||||
:condition => "!$('todo_new_action_submit').isWaiting() && askIfNewContextProvided()") do -%>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
function askIfNewContextProvided() {
|
||||
var contexts = new Array(<%= @contexts.map{|c| '\'' + c.name + '\''}.join(", ") %>);
|
||||
var givenContextName = $('todo_context_name').value;
|
||||
if (givenContextName.length == 0) return true; // show rails validation error
|
||||
for (var i = 0; i < contexts.length; ++i) {
|
||||
if (contexts[i] == givenContextName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return confirm('New context "' + givenContextName + '" will be also created. Are you sure?');
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="status"><%= error_messages_for("item", :object_name => 'action') %></div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue