refactor js of new todo form: share projects and contexts array over all edit forms

this will hopefully decrease memory usage and also the get-form ajax should result in less data to be retrieved
This commit is contained in:
Reinier Balt 2009-03-30 22:37:03 +02:00
parent ae30869f85
commit f0e5c3841d
3 changed files with 6 additions and 3 deletions

View file

@ -70,6 +70,7 @@
<script type="text/javascript" charset="utf-8">
var contextNames = <%= context_names_for_autocomplete %>;
var projectNames = <%= project_names_for_autocomplete %>
function askIfNewContextProvided() {
var givenContextName = $('todo_context_name').value;
@ -80,7 +81,7 @@
return confirm('New context "' + givenContextName + '" will be also created. Are you sure?');
}
var projectAutoCompleter = new Autocompleter.Local('todo_project_name', 'project_list', <%= project_names_for_autocomplete %>, {choices:100,autoSelect:false});
var projectAutoCompleter = new Autocompleter.Local('todo_project_name', 'project_list', projectNames, {choices:100,autoSelect:false});
function selectDefaultContext() {
todoContextNameElement = $('todo_context_name');