Various small changes.

This commit is contained in:
James Cole
2017-03-03 18:19:25 +01:00
parent 978e3e615c
commit 8fb6c1a0c8
10 changed files with 83 additions and 26 deletions

View File

@@ -102,7 +102,7 @@ function currencySelect(e) {
$('#' + spanId).text(symbol);
// close the menu (hack hack)
$('#' + menuID).click();
$('#' + menuID).dropdown('toggle');
return false;

View File

@@ -6,19 +6,16 @@
* See the LICENSE file for details.
*/
/** global: what,Modernizr, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, doSwitch, middleCrumbUrl */
/** global: what,Modernizr, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, middleCrumbUrl */
$(document).ready(function () {
"use strict";
// respond to switch buttons when
// creating stuff:
if (doSwitch == true) {
updateButtons();
updateForm();
updateLayout();
updateDescription();
}
// respond to switch buttons
updateButtons();
updateForm();
updateLayout();
updateDescription();
if (!Modernizr.inputtypes.date) {
$('input[type="date"]').datepicker(
@@ -28,11 +25,27 @@ $(document).ready(function () {
);
}
// update currency
$('select[name="source_account_id"]').on('change', updateCurrency)
// get JSON things:
getJSONautocomplete();
});
function updateCurrency() {
// get value:
var accountId = $('select[name="source_account_id"]').val();
console.log('account id is ' + accountId);
var currencyPreference = accountInfo[accountId].preferredCurrency;
console.log('currency pref is ' + currencyPreference);
$('.currency-option[data-id="' + currencyPreference + '"]').click();
$('[data-toggle="dropdown"]').parent().removeClass('open');
$('select[name="source_account_id"]').focus();
}
function updateDescription() {
$.getJSON('json/transaction-journals/' + what).done(function (data) {
$('input[name="description"]').typeahead('destroy').typeahead({source: data});