mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 11:10:12 +01:00
AJAX loading of context names
To make askIfNewContextProvided work again, allowing people to add actions again
This commit is contained in:
parent
c3b3e3ea04
commit
fdba48c769
1 changed files with 11 additions and 0 deletions
|
|
@ -141,6 +141,17 @@ function setup_container_toggles(){
|
|||
|
||||
function askIfNewContextProvided() {
|
||||
var givenContextName = $('#todo_context_name').val();
|
||||
var contextNames = [];
|
||||
var contextNamesRequest = $.ajax({url: relative_to_root('contexts.autocomplete'),
|
||||
async: false,
|
||||
dataType: "text",
|
||||
data: "q="+givenContextName,
|
||||
success: function(result){
|
||||
lines = result.split("\n");
|
||||
for(var i = 0; i < lines.length; i++){
|
||||
contextNames.push(lines[i].split("|")[0]);
|
||||
}
|
||||
}});
|
||||
if (givenContextName.length == 0) return true; // do nothing and depend on rails validation error
|
||||
for (var i = 0; i < contextNames.length; ++i) {
|
||||
if (contextNames[i] == givenContextName) return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue