diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index bfa7f86356..9263a25937 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -63,7 +63,6 @@ class HomeController extends Controller // a possible problem with the budgets. if ($label === strval(trans('firefly.everything')) || $label === strval(trans('firefly.customRange'))) { $isCustomRange = true; - //Preferences::set('viewRange', 'custom'); Log::debug('Range is now marked as "custom".'); } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index f404a08e26..c000fd6fd5 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -76,6 +76,7 @@ class TagController extends Controller { $subTitle = trans('firefly.new_tag'); $subTitleIcon = 'fa-tag'; + $apiKey = env('GOOGLE_MAPS_API_KEY', ''); $preFilled = [ 'tagMode' => 'nothing', @@ -91,7 +92,7 @@ class TagController extends Controller Session::flash('gaEventCategory', 'tags'); Session::flash('gaEventAction', 'create'); - return view('tags.create', compact('subTitle', 'subTitleIcon')); + return view('tags.create', compact('subTitle', 'subTitleIcon', 'apiKey')); } /** @@ -138,6 +139,7 @@ class TagController extends Controller { $subTitle = trans('firefly.edit_tag', ['tag' => $tag->tag]); $subTitleIcon = 'fa-tag'; + $apiKey = env('GOOGLE_MAPS_API_KEY', ''); /* * Default tag options (again) @@ -167,7 +169,7 @@ class TagController extends Controller Session::flash('gaEventCategory', 'tags'); Session::flash('gaEventAction', 'edit'); - return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'tagOptions')); + return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'tagOptions', 'apiKey')); } /** diff --git a/public/js/ff/accounts/show.js b/public/js/ff/accounts/show.js index 7cff7dc249..12851e0d75 100644 --- a/public/js/ff/accounts/show.js +++ b/public/js/ff/accounts/show.js @@ -90,5 +90,6 @@ function sortStop(event, ui) { current.animate({backgroundColor: "#5cb85c"}, 200, function () { $(this).animate({backgroundColor: originalBG}, 200); + return undefined; }); } diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js index 8fc2915fc5..0e9ff49d21 100644 --- a/public/js/ff/charts.js +++ b/public/js/ff/charts.js @@ -147,7 +147,7 @@ function doubleYNonStackedChart(URI, container) { { display: true, ticks: { - callback: function (tickValue, index, ticks) { + callback: function (tickValue) { "use strict"; return accounting.formatMoney(tickValue); @@ -161,7 +161,7 @@ function doubleYNonStackedChart(URI, container) { { display: true, ticks: { - callback: function (tickValue, index, ticks) { + callback: function (tickValue) { "use strict"; return accounting.formatMoney(tickValue); diff --git a/public/js/ff/firefly.js b/public/js/ff/firefly.js index c3b1b46bd7..82a22f16c1 100644 --- a/public/js/ff/firefly.js +++ b/public/js/ff/firefly.js @@ -7,7 +7,7 @@ * * See the LICENSE file for details. */ -/** global: moment, dateRangeConfig, accounting, currencySymbol, mon_decimal_point, frac_digits, showFullList, showOnlyTop */ +/** global: moment, dateRangeConfig, accounting, currencySymbol, mon_decimal_point, frac_digits, showFullList, showOnlyTop, mon_thousands_sep */ $(function () { diff --git a/public/js/ff/import/status.js b/public/js/ff/import/status.js index 1a48091eaf..cf97ab9935 100644 --- a/public/js/ff/import/status.js +++ b/public/js/ff/import/status.js @@ -49,7 +49,7 @@ function updateBar(data) { $('#import-status-bar').text(data.stepsDone + '/' + data.steps); if (data.percentage >= 100) { - importComplete(data); + importComplete(); return; } return; diff --git a/public/js/ff/reports/index.js b/public/js/ff/reports/index.js index 67be970157..d59c0b3d30 100644 --- a/public/js/ff/reports/index.js +++ b/public/js/ff/reports/index.js @@ -15,7 +15,7 @@ $(function () { if ($('#inputDateRange').length > 0) { - var picker = $('#inputDateRange').daterangepicker( + $('#inputDateRange').daterangepicker( { locale: { format: 'YYYY-MM-DD', diff --git a/public/js/ff/split/journal/from-store.js b/public/js/ff/split/journal/from-store.js index a614d77d4e..a7323a12a6 100644 --- a/public/js/ff/split/journal/from-store.js +++ b/public/js/ff/split/journal/from-store.js @@ -8,7 +8,7 @@ * See the LICENSE file for details. */ -/** global: originalSum, amount, accounting */ +/** global: originalSum, accounting */ var destAccounts = {}; var srcAccounts = {}; @@ -61,7 +61,6 @@ function cloneRow() { "use strict"; var source = $('.table.split-table tbody tr').last().clone(); var count = $('.split-table tbody tr').length + 1; - var index = count - 1; source.removeClass('initial-row'); source.find('.count').text('#' + count); @@ -162,6 +161,6 @@ function calculateSum() { if (sum != originalSum) { var holder = $('#journal_amount_holder'); var par = holder.find('p.form-control-static'); - var amount = $('').text(' (' + accounting.formatMoney(sum) + ')').addClass('text-danger amount-warning').appendTo(par); + $('').text(' (' + accounting.formatMoney(sum) + ')').addClass('text-danger amount-warning').appendTo(par); } } \ No newline at end of file diff --git a/public/js/ff/tags/edit.js b/public/js/ff/tags/create-edit.js similarity index 95% rename from public/js/ff/tags/edit.js rename to public/js/ff/tags/create-edit.js index 53b66933c4..9670302e30 100644 --- a/public/js/ff/tags/edit.js +++ b/public/js/ff/tags/create-edit.js @@ -7,7 +7,7 @@ * * See the LICENSE file for details. */ -/** global: zoomLevel, latitude, longitude, google */ +/** global: zoomLevel, latitude, longitude, google, apiKey */ $(function () { "use strict"; diff --git a/public/js/ff/tags/create.js b/public/js/ff/tags/create.js deleted file mode 100644 index b252d00ae9..0000000000 --- a/public/js/ff/tags/create.js +++ /dev/null @@ -1,115 +0,0 @@ -/* - * create.js - * Copyright (C) 2016 thegrumpydictator@gmail.com - * - * This software may be modified and distributed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International License. - * - * See the LICENSE file for details. - */ - -/** global: zoomLevel, latitude, longitude, google */ - -$(function () { - "use strict"; - - $('#clearLocation').click(clearLocation); - -}); - -/* - Some vars as prep for the map: - */ -var map; -var markers = []; -var setTag = false; - -var mapOptions = { - zoom: zoomLevel, - center: new google.maps.LatLng(latitude, longitude), - disableDefaultUI: true -}; - -/* - Clear location and reset zoomLevel. - */ -function clearLocation() { - "use strict"; - deleteMarkers(); - $('input[name="latitude"]').val(""); - $('input[name="longitude"]').val(""); - $('input[name="zoomLevel"]').val("6"); - setTag = false; - $('input[name="setTag"]').val('false'); - return false; -} - -function initialize() { - "use strict"; - /* - Create new map: - */ - map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); - - /* - Respond to click event. - */ - google.maps.event.addListener(map, 'rightclick', function (event) { - placeMarker(event); - }); - - /* - Respond to zoom event. - */ - google.maps.event.addListener(map, 'zoom_changed', function () { - saveZoomLevel(); - }); - /* - Maybe place marker? - */ - if(doPlaceMarker == true) { - var myLatlng = new google.maps.LatLng(latitude,longitude); - var fakeEvent = {}; - fakeEvent.latLng = myLatlng; - placeMarker(fakeEvent); - - } -} - -/** - * save zoom level of map into hidden input. - */ -function saveZoomLevel() { - "use strict"; - $('input[name="zoomLevel"]').val(map.getZoom()); -} - -/** - * Place marker on map. - * @param event - */ -function placeMarker(event) { - "use strict"; - deleteMarkers(); - var marker = new google.maps.Marker({position: event.latLng, map: map}); - $('input[name="latitude"]').val(event.latLng.lat()); - $('input[name="longitude"]').val(event.latLng.lng()); - markers.push(marker); - setTag = true; - $('input[name="setTag"]').val('true'); -} - - -/** - * Deletes all markers in the array by removing references to them. - */ -function deleteMarkers() { - "use strict"; - for (var i = 0; i < markers.length; i++) { - markers[i].setMap(null); - } - markers = []; -} - - -google.maps.event.addDomListener(window, 'load', initialize); \ No newline at end of file diff --git a/public/js/ff/tags/index.js b/public/js/ff/tags/index.js index 1234a027ba..990b265895 100644 --- a/public/js/ff/tags/index.js +++ b/public/js/ff/tags/index.js @@ -12,104 +12,4 @@ $(function () { "use strict"; - - $('#clearLocation').click(clearLocation); - }); - -/* - Some vars as prep for the map: - */ -var map; -var markers = []; -var setTag = false; - -var mapOptions = { - zoom: zoomLevel, - center: new google.maps.LatLng(latitude, longitude), - disableDefaultUI: true -}; - -/* - Clear location and reset zoomLevel. - */ -function clearLocation() { - "use strict"; - deleteMarkers(); - $('input[name="latitude"]').val(""); - $('input[name="longitude"]').val(""); - $('input[name="zoomLevel"]').val("6"); - setTag = false; - $('input[name="setTag"]').val('false'); - return false; -} - -function initialize() { - "use strict"; - /* - Create new map: - */ - map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); - - /* - Respond to click event. - */ - google.maps.event.addListener(map, 'rightclick', function (event) { - placeMarker(event); - }); - - /* - Respond to zoom event. - */ - google.maps.event.addListener(map, 'zoom_changed', function () { - saveZoomLevel(); - }); - /* - Maybe place marker? - */ - if(doPlaceMarker == true) { - var myLatlng = new google.maps.LatLng(latitude,longitude); - var fakeEvent = {}; - fakeEvent.latLng = myLatlng; - placeMarker(fakeEvent); - - } -} - -/** - * save zoom level of map into hidden input. - */ -function saveZoomLevel() { - "use strict"; - $('input[name="zoomLevel"]').val(map.getZoom()); -} - -/** - * Place marker on map. - * @param event - */ -function placeMarker(event) { - "use strict"; - deleteMarkers(); - var marker = new google.maps.Marker({position: event.latLng, map: map}); - $('input[name="latitude"]').val(event.latLng.lat()); - $('input[name="longitude"]').val(event.latLng.lng()); - markers.push(marker); - setTag = true; - $('input[name="setTag"]').val('true'); -} - - -/** - * Deletes all markers in the array by removing references to them. - */ -function deleteMarkers() { - "use strict"; - for (var i = 0; i < markers.length; i++) { - markers[i].setMap(null); - } - markers = []; -} - - -google.maps.event.addDomListener(window, 'load', initialize); \ No newline at end of file diff --git a/public/js/ff/transactions/create-edit.js b/public/js/ff/transactions/create-edit.js index 44796c50bb..9719b76d6b 100644 --- a/public/js/ff/transactions/create-edit.js +++ b/public/js/ff/transactions/create-edit.js @@ -8,6 +8,8 @@ * See the LICENSE file for details. */ +/** global: what */ + $(document).ready(function () { "use strict"; diff --git a/public/js/ff/transactions/create.js b/public/js/ff/transactions/create.js index 0440006594..9c006e305e 100644 --- a/public/js/ff/transactions/create.js +++ b/public/js/ff/transactions/create.js @@ -8,7 +8,7 @@ * See the LICENSE file for details. */ -/** global: what, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt */ +/** global: what, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, doSwitch, middleCrumbUrl */ $(document).ready(function () { "use strict"; @@ -37,7 +37,6 @@ function updateForm() { $('input[name="what"]').val(what); switch (what) { - default: case 'withdrawal': // show source_id and dest_name: $('#source_account_id_holder').show(); @@ -80,6 +79,7 @@ function updateForm() { } break; + default: case 'transfer': // show source_id and dest_id: $('#source_account_id_holder').show(); diff --git a/resources/views/tags/create.twig b/resources/views/tags/create.twig index 95b99f7d9d..1864f85843 100644 --- a/resources/views/tags/create.twig +++ b/resources/views/tags/create.twig @@ -80,7 +80,9 @@ var zoomLevel = 6; {% endif %} + var apiKey = "{{ apiKey }}"; + - - + + {% endblock %} diff --git a/resources/views/tags/edit.twig b/resources/views/tags/edit.twig index e6a089d269..d427e05273 100644 --- a/resources/views/tags/edit.twig +++ b/resources/views/tags/edit.twig @@ -59,12 +59,13 @@ {% block scripts %} - - + + {% endblock %}