mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-22 16:56:10 +01:00
Dynamically load autocompletes
This cuts something like 100ms off of page load times! Closes #1011
This commit is contained in:
parent
8de74939ea
commit
9ab69adb38
10 changed files with 30 additions and 24 deletions
|
|
@ -187,11 +187,16 @@ function project_defaults(){
|
|||
function enable_rich_interaction(){
|
||||
$('input.Date').datepicker({'dateFormat': dateFormat, 'firstDay': weekStart});
|
||||
/* Autocomplete */
|
||||
$('input[name=context_name]').autocomplete(contextNames, {matchContains: true});
|
||||
$('input[name=project[default_context_name]]').autocomplete(contextNames, {matchContains: true});
|
||||
$('input[name=project_name]').autocomplete(projectNames, {matchContains: true});
|
||||
$('input[name=tag_list]:not(.ac_input)').autocomplete(tagNames, {multiple: true,multipleSeparator:',',matchContains:true});
|
||||
$('input[name=predecessor_list]:not(.ac_input)').autocomplete('/todos/auto_complete_for_predecessor',
|
||||
$('input[name=context_name]').autocomplete(
|
||||
relative_to_root('contexts.autocomplete'), {matchContains: true});
|
||||
$('input[name=project[default_context_name]]').autocomplete(
|
||||
relative_to_root('contexts.autocomplete'), {matchContains: true});
|
||||
$('input[name=project_name]').autocomplete(
|
||||
relative_to_root('projects.autocomplete'), {matchContains: true});
|
||||
$('input[name=tag_list]:not(.ac_input)').autocomplete(
|
||||
relative_to_root('tags.autocomplete'), {multiple: true,multipleSeparator:',',matchContains:true});
|
||||
$('input[name=predecessor_list]:not(.ac_input)').autocomplete(
|
||||
relative_to_root('auto_complete_for_predecessor'),
|
||||
{multiple: true,multipleSeparator:','});
|
||||
|
||||
/* have to bind on keypress because of limitataions of live() */
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ $.Autocompleter = function(input, options) {
|
|||
// limit abortion to this input
|
||||
port: "autocomplete" + input.name,
|
||||
dataType: options.dataType,
|
||||
type: 'POST',
|
||||
type: 'GET',
|
||||
url: options.url,
|
||||
data: $.extend({
|
||||
q: lastWord(term),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue