This commit is contained in:
James Cole 2018-01-22 18:37:59 +01:00
parent bc4d801c12
commit 9a26d6d49f
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
9 changed files with 33 additions and 34 deletions

View File

@ -32,7 +32,7 @@ $(document).ready(function () {
function setAutocompletes() { function setAutocompletes() {
$.getJSON('json/categories').done(function (data) { $.getJSON('json/categories').done(function (data) {
$('input[name="category"]').typeahead({source: data}); $('input[name="category"]').typeahead({source: data, autoSelect: false});
}); });
$.getJSON('json/tags').done(function (data) { $.getJSON('json/tags').done(function (data) {

View File

@ -296,7 +296,7 @@ function updateTriggerInput(selectList) {
function createAutoComplete(input, URI) { function createAutoComplete(input, URI) {
input.typeahead('destroy'); input.typeahead('destroy');
$.getJSON(URI).done(function (data) { $.getJSON(URI).done(function (data) {
input.typeahead({source: data}); input.typeahead({source: data, autoSelect: false});
}); });
} }

View File

@ -24,17 +24,16 @@ $(document).ready(function () {
"use strict"; "use strict";
$.getJSON('json/categories').done(function (data) { $.getJSON('json/categories').done(function (data) {
$('input[name="category"]').typeahead({source: data}); $('input[name="category"]').typeahead({source: data, autoSelect: false});
}); });
$.getJSON('json/tags').done(function (data) { $.getJSON('json/tags').done(function (data) {
var opt = { var opt = {
typeahead: { source: data,
source: data, afterSelect: function () {
afterSelect: function () { this.$element.val("");
this.$element.val(""); },
} autoSelect: false
}
}; };
$('input[name="tags"]').tagsinput( $('input[name="tags"]').tagsinput(
opt opt

View File

@ -26,18 +26,18 @@ $(document).ready(function () {
// destination account names: // destination account names:
if ($('input[name^="destination_account_name["]').length > 0) { if ($('input[name^="destination_account_name["]').length > 0) {
$.getJSON('json/expense-accounts').done(function (data) { $.getJSON('json/expense-accounts').done(function (data) {
$('input[name^="destination_account_name["]').typeahead({source: data}); $('input[name^="destination_account_name["]').typeahead({source: data, autoSelect: false});
}); });
} }
// source account name // source account name
if ($('input[name^="source_account_name["]').length > 0) { if ($('input[name^="source_account_name["]').length > 0) {
$.getJSON('json/revenue-accounts').done(function (data) { $.getJSON('json/revenue-accounts').done(function (data) {
$('input[name^="source_account_name["]').typeahead({source: data}); $('input[name^="source_account_name["]').typeahead({source: data, autoSelect: false});
}); });
} }
$.getJSON('json/categories').done(function (data) { $.getJSON('json/categories').done(function (data) {
$('input[name^="category["]').typeahead({source: data}); $('input[name^="category["]').typeahead({source: data, autoSelect: false});
}); });
}); });

View File

@ -47,12 +47,11 @@ function runModernizer() {
function setCommonAutocomplete() { function setCommonAutocomplete() {
$.getJSON('json/tags').done(function (data) { $.getJSON('json/tags').done(function (data) {
var opt = { var opt = {
typeahead: { source: data,
source: data, afterSelect: function () {
afterSelect: function () { this.$element.val("");
this.$element.val(""); },
} autoSelect: false,
}
}; };
$('input[name="tags"]').tagsinput( $('input[name="tags"]').tagsinput(
opt opt
@ -61,18 +60,18 @@ function setCommonAutocomplete() {
if ($('input[name="destination_account_name"]').length > 0) { if ($('input[name="destination_account_name"]').length > 0) {
$.getJSON('json/expense-accounts').done(function (data) { $.getJSON('json/expense-accounts').done(function (data) {
$('input[name="destination_account_name"]').typeahead({source: data}); $('input[name="destination_account_name"]').typeahead({source: data, autoSelect: false});
}); });
} }
if ($('input[name="source_account_name"]').length > 0) { if ($('input[name="source_account_name"]').length > 0) {
$.getJSON('json/revenue-accounts').done(function (data) { $.getJSON('json/revenue-accounts').done(function (data) {
$('input[name="source_account_name"]').typeahead({source: data}); $('input[name="source_account_name"]').typeahead({source: data, autoSelect: false});
}); });
} }
$.getJSON('json/categories').done(function (data) { $.getJSON('json/categories').done(function (data) {
$('input[name="category"]').typeahead({source: data}); $('input[name="category"]').typeahead({source: data, autoSelect: false});
}); });
} }

View File

@ -98,7 +98,7 @@ function updateNativeCurrency(useAccountCurrency) {
*/ */
function updateDescription() { function updateDescription() {
$.getJSON('json/transaction-journals/' + what).done(function (data) { $.getJSON('json/transaction-journals/' + what).done(function (data) {
$('input[name="description"]').typeahead('destroy').typeahead({source: data}); $('input[name="description"]').typeahead('destroy').typeahead({source: data, autoSelect: false});
}); });
$('#ffInput_description').focus(); $('#ffInput_description').focus();
} }

View File

@ -94,7 +94,7 @@ function getAccountId() {
*/ */
function setAutocompletes() { function setAutocompletes() {
$.getJSON('json/transaction-journals/' + what).done(function (data) { $.getJSON('json/transaction-journals/' + what).done(function (data) {
$('input[name="description"]').typeahead({source: data}); $('input[name="description"]').typeahead({source: data, autoSelect: false});
}); });
} }

View File

@ -33,23 +33,23 @@ $(document).ready(function () {
$.getJSON('json/expense-accounts').done(function (data) { $.getJSON('json/expense-accounts').done(function (data) {
destAccounts = data; destAccounts = data;
$('input[name$="destination_account_name]"]').typeahead({source: destAccounts}); $('input[name$="destination_account_name]"]').typeahead({source: destAccounts, autoSelect: false});
}); });
$.getJSON('json/revenue-accounts').done(function (data) { $.getJSON('json/revenue-accounts').done(function (data) {
srcAccounts = data; srcAccounts = data;
$('input[name$="source_account_name]"]').typeahead({source: srcAccounts}); $('input[name$="source_account_name]"]').typeahead({source: srcAccounts, autoSelect: false});
}); });
$.getJSON('json/categories').done(function (data) { $.getJSON('json/categories').done(function (data) {
categories = data; categories = data;
$('input[name$="category]"]').typeahead({source: categories}); $('input[name$="category]"]').typeahead({source: categories, autoSelect: false});
}); });
$.getJSON('json/transaction-journals/' + what).done(function (data) { $.getJSON('json/transaction-journals/' + what).done(function (data) {
descriptions = data; descriptions = data;
$('input[name="journal_description"]').typeahead({source: descriptions}); $('input[name="journal_description"]').typeahead({source: descriptions, autoSelect: false});
$('input[name$="description]"]').typeahead({source: descriptions}); $('input[name$="description]"]').typeahead({source: descriptions, autoSelect: false});
}); });
$.getJSON('json/tags').done(function (data) { $.getJSON('json/tags').done(function (data) {
@ -59,7 +59,8 @@ $(document).ready(function () {
source: data, source: data,
afterSelect: function () { afterSelect: function () {
this.$element.val(""); this.$element.val("");
} },
autoSelect: false
} }
}; };
$('input[name="tags"]').tagsinput( $('input[name="tags"]').tagsinput(
@ -114,17 +115,17 @@ function cloneDivRow() {
source.find('input[name$="][amount]"]').val("").on('input', calculateSum); source.find('input[name$="][amount]"]').val("").on('input', calculateSum);
if (destAccounts.length > 0) { if (destAccounts.length > 0) {
source.find('input[name$="destination_account_name]"]').typeahead({source: destAccounts}); source.find('input[name$="destination_account_name]"]').typeahead({source: destAccounts, autoSelect: false});
} }
if (destAccounts.length > 0) { if (destAccounts.length > 0) {
source.find('input[name$="source_account_name]"]').typeahead({source: srcAccounts}); source.find('input[name$="source_account_name]"]').typeahead({source: srcAccounts, autoSelect: false});
} }
if (categories.length > 0) { if (categories.length > 0) {
source.find('input[name$="category]"]').typeahead({source: categories}); source.find('input[name$="category]"]').typeahead({source: categories, autoSelect: false});
} }
if (descriptions.length > 0) { if (descriptions.length > 0) {
source.find('input[name$="description]"]').typeahead({source: descriptions}); source.find('input[name$="description]"]').typeahead({source: descriptions, autoSelect: false});
} }
$('div.split_row_holder').append(source); $('div.split_row_holder').append(source);

File diff suppressed because one or more lines are too long