mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-09-03 20:52:58 -05:00
Fix edit rules
This commit is contained in:
@@ -71,7 +71,6 @@ $(function () {
|
||||
|
||||
// when you click on a currency, this happens:
|
||||
$('.currency-option').on('click', currencySelect);
|
||||
console.log('Form thing done');
|
||||
// build the data range:
|
||||
// $('#daterange').text(dateRangeMeta.title).daterangepicker(
|
||||
// {
|
||||
|
||||
@@ -55,30 +55,4 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// var objectGroupAC = new Bloodhound({
|
||||
// datumTokenizer: Bloodhound.tokenizers.obj.whitespace('title'),
|
||||
// queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
// prefetch: {
|
||||
// url: 'api/v1/autocomplete/object-groups?uid=' + uid,
|
||||
// filter: function (list) {
|
||||
// return $.map(list, function (obj) {
|
||||
// return obj;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// remote: {
|
||||
// url: 'api/v1/autocomplete/object-groups?query=%QUERY&uid=' + uid,
|
||||
// wildcard: '%QUERY',
|
||||
// filter: function (list) {
|
||||
// return $.map(list, function (obj) {
|
||||
// return obj;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// objectGroupAC.initialize();
|
||||
// $('input[name="object_group"]').typeahead({hint: true, highlight: true,}, {source: objectGroupAC, displayKey: 'title', autoSelect: false});
|
||||
|
||||
});
|
||||
|
||||
@@ -20,25 +20,27 @@
|
||||
|
||||
/** global: triggerCount, actionCount */
|
||||
|
||||
var autocompletes = {};
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
$(".content-wrapper form input:enabled:visible:first").first().focus().select();
|
||||
if (triggerCount > 0) {
|
||||
console.log('trigger count is larger than zero, call onAddNewTrigger.');
|
||||
//console.log('trigger count is larger than zero, call onAddNewTrigger.');
|
||||
onAddNewTrigger();
|
||||
}
|
||||
|
||||
if (actionCount > 0) {
|
||||
console.log('action count is larger than zero, call onAddNewAction.');
|
||||
//console.log('action count is larger than zero, call onAddNewAction.');
|
||||
onAddNewAction();
|
||||
}
|
||||
|
||||
if (triggerCount === 0) {
|
||||
console.log('trigger count is zero, add trigger.');
|
||||
//console.log('trigger count is zero, add trigger.');
|
||||
addNewTrigger();
|
||||
}
|
||||
if (actionCount === 0) {
|
||||
console.log('action count is zero, add action.');
|
||||
//console.log('action count is zero, add action.');
|
||||
addNewAction();
|
||||
}
|
||||
makeRuleStrict();
|
||||
@@ -52,7 +54,7 @@ $(function () {
|
||||
|
||||
function makeRuleStrict() {
|
||||
var value = $('#ffInput_strict').is(':checked');
|
||||
if(value) {
|
||||
if (value) {
|
||||
// is checked, stop processing triggers is not relevant.
|
||||
$('.trigger-stop-processing').prop('checked', false);
|
||||
$('.trigger-stop-processing').prop('disabled', true);
|
||||
@@ -174,7 +176,7 @@ function onAddNewAction() {
|
||||
"use strict";
|
||||
console.log('Now in onAddNewAction()');
|
||||
|
||||
var selectQuery = 'select[name^="actions["][name$="][type]"]';
|
||||
var selectQuery = 'select[name^="actions["][name$="][type]"]';
|
||||
var selectResult = $(selectQuery);
|
||||
|
||||
console.log('Select query is "' + selectQuery + '" and the result length is ' + selectResult.length);
|
||||
@@ -203,7 +205,7 @@ function onAddNewTrigger() {
|
||||
"use strict";
|
||||
console.log('Now in onAddNewTrigger()');
|
||||
|
||||
var selectQuery = 'select[name^="triggers["][name$="][type]"]';
|
||||
var selectQuery = 'select[name^="triggers["][name$="][type]"]';
|
||||
var selectResult = $(selectQuery);
|
||||
|
||||
console.log('Select query is "' + selectQuery + '" and the result length is ' + selectResult.length);
|
||||
@@ -231,9 +233,9 @@ function onAddNewTrigger() {
|
||||
function updateActionInput(selectList) {
|
||||
console.log('Now in updateActionInput() for a select list, currently with value "' + selectList.val() + '".');
|
||||
// the actual row this select list is in:
|
||||
var parent = selectList.parent().parent();
|
||||
var parent = selectList.parent().parent();
|
||||
// the text input we're looking for:
|
||||
var inputQuery = 'input[name^="actions["][name$="][value]"]';
|
||||
var inputQuery = 'input[name^="actions["][name$="][value]"]';
|
||||
var inputResult = parent.find(inputQuery);
|
||||
|
||||
console.log('Searching for children in this row with query "' + inputQuery + '" resulted in ' + inputResult.length + ' results.');
|
||||
@@ -258,7 +260,10 @@ function updateActionInput(selectList) {
|
||||
case 'remove_all_tags':
|
||||
console.log('Select list value is ' + selectList.val() + ', so input needs to be disabled.');
|
||||
inputResult.prop('disabled', true);
|
||||
inputResult.typeahead('destroy');
|
||||
if (autocompletes[inputResult[0].name] !== undefined) {
|
||||
console.log('Must destroy AC at ', inputResult[0].name);
|
||||
autocompletes[inputResult[0].name].destroy();
|
||||
}
|
||||
break;
|
||||
case 'set_budget':
|
||||
console.log('Select list value is ' + selectList.val() + ', so input needs auto complete.');
|
||||
@@ -300,7 +305,10 @@ function updateActionInput(selectList) {
|
||||
break;
|
||||
default:
|
||||
console.log('Select list value is ' + selectList.val() + ', destroy auto complete, do nothing else.');
|
||||
inputResult.typeahead('destroy');
|
||||
if (autocompletes[inputResult[0].name] !== undefined) {
|
||||
console.log('Must destroy AC at ', inputResult[0].name);
|
||||
autocompletes[inputResult[0].name].destroy();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -313,9 +321,9 @@ function updateActionInput(selectList) {
|
||||
function updateTriggerInput(selectList) {
|
||||
console.log('Now in updateTriggerInput() for a select list, currently with value "' + selectList.val() + '".');
|
||||
// the actual row this select list is in:
|
||||
var parent = selectList.parent().parent();
|
||||
var parent = selectList.parent().parent();
|
||||
// the text input we're looking for:
|
||||
var inputQuery = 'input[name^="triggers["][name$="][value]"]';
|
||||
var inputQuery = 'input[name^="triggers["][name$="][value]"]';
|
||||
var inputResult = parent.find(inputQuery);
|
||||
|
||||
console.log('Searching for children in this row with query "' + inputQuery + '" resulted in ' + inputResult.length + ' results.');
|
||||
@@ -386,7 +394,10 @@ function updateTriggerInput(selectList) {
|
||||
case 'any_external_url':
|
||||
console.log('Select list value is ' + selectList.val() + ', so input needs to be disabled.');
|
||||
inputResult.prop('disabled', true);
|
||||
inputResult.typeahead('destroy');
|
||||
if (autocompletes[inputResult[0].name] !== undefined) {
|
||||
console.log('Must destroy AC at ', inputResult[0].name);
|
||||
autocompletes[inputResult[0].name].destroy();
|
||||
}
|
||||
break;
|
||||
case 'currency_is':
|
||||
case 'foreign_currency_is':
|
||||
@@ -402,7 +413,10 @@ function updateTriggerInput(selectList) {
|
||||
break;
|
||||
default:
|
||||
console.log('Select list value is ' + selectList.val() + ', destroy auto complete, do nothing else.');
|
||||
inputResult.typeahead('destroy');
|
||||
if (autocompletes[inputResult[0].name] !== undefined) {
|
||||
console.log('Must destroy AC at ', inputResult[0].name);
|
||||
autocompletes[inputResult[0].name].destroy();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -414,11 +428,11 @@ function updateTriggerInput(selectList) {
|
||||
*/
|
||||
function createAutoComplete(input, URL) {
|
||||
|
||||
//console.log('The name is ',inputResult.prop('name'));
|
||||
var inputItem = document.getElementsByName(input.prop('name'))[0];
|
||||
console.log('Create AC at "' + inputItem.name + '".');
|
||||
|
||||
// append URL:
|
||||
var lastChar = URL[URL.length - 1];
|
||||
var lastChar = URL[URL.length - 1];
|
||||
var urlParamSplit = '?';
|
||||
if ('&' === lastChar) {
|
||||
urlParamSplit = '';
|
||||
@@ -426,7 +440,7 @@ function createAutoComplete(input, URL) {
|
||||
|
||||
var finalURL = URL + urlParamSplit + 'query=';
|
||||
|
||||
new BootstrapSimpleAutocomplete(inputItem, {
|
||||
autocompletes[inputItem.name] = new BootstrapSimpleAutocomplete(inputItem, {
|
||||
fetchFunction: function (query) {
|
||||
// Custom data fetching logic
|
||||
return fetch(finalURL + encodeURIComponent(query),
|
||||
@@ -443,8 +457,8 @@ function createAutoComplete(input, URL) {
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
var result = [];
|
||||
for(var i in data) {
|
||||
if(data.hasOwnProperty(i)) {
|
||||
for (var i in data) {
|
||||
if (data.hasOwnProperty(i)) {
|
||||
result.push(data[i].name);
|
||||
}
|
||||
}
|
||||
@@ -453,60 +467,8 @@ function createAutoComplete(input, URL) {
|
||||
});
|
||||
},
|
||||
});
|
||||
// return;
|
||||
//
|
||||
//
|
||||
//
|
||||
// console.log('Now in createAutoComplete("' + URL + '").');
|
||||
// input.typeahead('destroy');
|
||||
//
|
||||
// // append URL:
|
||||
// var lastChar = URL[URL.length - 1];
|
||||
// var urlParamSplit = '?';
|
||||
// if ('&' === lastChar) {
|
||||
// urlParamSplit = '';
|
||||
// }
|
||||
// var source = new Bloodhound({
|
||||
// datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
|
||||
// queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
// prefetch: {
|
||||
// url: URL + urlParamSplit + 'uid=' + uid,
|
||||
// filter: function (list) {
|
||||
// return $.map(list, function (item) {
|
||||
// if (item.hasOwnProperty('active') && item.active === true) {
|
||||
// return {name: item.name};
|
||||
// }
|
||||
// if (item.hasOwnProperty('active') && item.active === false) {
|
||||
// return;
|
||||
// }
|
||||
// if (item.hasOwnProperty('active')) {
|
||||
// console.log(item.active);
|
||||
// }
|
||||
// return {name: item.name};
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// remote: {
|
||||
// url: URL + urlParamSplit + 'query=%QUERY&uid=' + uid,
|
||||
// wildcard: '%QUERY',
|
||||
// filter: function (list) {
|
||||
// return $.map(list, function (item) {
|
||||
// if (item.hasOwnProperty('active') && item.active === true) {
|
||||
// return {name: item.name};
|
||||
// }
|
||||
// if (item.hasOwnProperty('active') && item.active === false) {
|
||||
// return;
|
||||
// }
|
||||
// if (item.hasOwnProperty('active')) {
|
||||
// console.log(item.active);
|
||||
// }
|
||||
// return {name: item.name};
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// source.initialize();
|
||||
// input.typeahead({hint: true, highlight: true,}, {source: source, displayKey: 'name', autoSelect: false});
|
||||
console.log('Number of ACs:', Object.keys(autocompletes).length);
|
||||
|
||||
}
|
||||
|
||||
function testRuleTriggers() {
|
||||
|
||||
@@ -106,34 +106,6 @@ function makeAutoComplete() {
|
||||
});
|
||||
},
|
||||
});
|
||||
//
|
||||
//
|
||||
//
|
||||
// // input link-journal
|
||||
// var source = new Bloodhound({
|
||||
// datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
|
||||
// queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
// prefetch: {
|
||||
// url: acURL + '?uid=' + uid,
|
||||
// filter: function (list) {
|
||||
// return $.map(list, function (item) {
|
||||
// return item;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// remote: {
|
||||
// url: acURL + '?query=%QUERY&uid=' + uid,
|
||||
// wildcard: '%QUERY',
|
||||
// filter: function (list) {
|
||||
// return $.map(list, function (item) {
|
||||
// return item;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// source.initialize();
|
||||
// $('.link-journal').typeahead({hint: true, highlight: true,}, {source: source, displayKey: 'name', autoSelect: false})
|
||||
// .on('typeahead:select', selectedJournal);
|
||||
}
|
||||
|
||||
function selectedJournal(event) {
|
||||
|
||||
Reference in New Issue
Block a user