mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various Javascript fixes.
This commit is contained in:
parent
811026dc4a
commit
9352ee3e25
@ -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".');
|
||||
}
|
||||
|
||||
|
@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,5 +90,6 @@ function sortStop(event, ui) {
|
||||
|
||||
current.animate({backgroundColor: "#5cb85c"}, 200, function () {
|
||||
$(this).animate({backgroundColor: originalBG}, 200);
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 () {
|
||||
|
@ -49,7 +49,7 @@ function updateBar(data) {
|
||||
$('#import-status-bar').text(data.stepsDone + '/' + data.steps);
|
||||
|
||||
if (data.percentage >= 100) {
|
||||
importComplete(data);
|
||||
importComplete();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
@ -15,7 +15,7 @@ $(function () {
|
||||
|
||||
if ($('#inputDateRange').length > 0) {
|
||||
|
||||
var picker = $('#inputDateRange').daterangepicker(
|
||||
$('#inputDateRange').daterangepicker(
|
||||
{
|
||||
locale: {
|
||||
format: 'YYYY-MM-DD',
|
||||
|
@ -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 = $('<span>').text(' (' + accounting.formatMoney(sum) + ')').addClass('text-danger amount-warning').appendTo(par);
|
||||
$('<span>').text(' (' + accounting.formatMoney(sum) + ')').addClass('text-danger amount-warning').appendTo(par);
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
/** global: zoomLevel, latitude, longitude, google */
|
||||
/** global: zoomLevel, latitude, longitude, google, apiKey */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
@ -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);
|
@ -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);
|
@ -8,6 +8,8 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/** global: what */
|
||||
|
||||
$(document).ready(function () {
|
||||
"use strict";
|
||||
|
||||
|
@ -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();
|
||||
|
@ -80,7 +80,9 @@
|
||||
var zoomLevel = 6;
|
||||
{% endif %}
|
||||
|
||||
var apiKey = "{{ apiKey }}";
|
||||
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
|
||||
<script src="js/ff/tags/create.js"></script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3&key={{ apiKey }}"></script>
|
||||
<script src="js/ff/tags/create-edit.js"></script>
|
||||
{% endblock %}
|
||||
|
@ -59,12 +59,13 @@
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
{% if Input.old('latitude') %}
|
||||
var latitude = "{{ Input.old('latitude') }}";
|
||||
var latitude = {{ Input.old('latitude') }};
|
||||
{% else %}
|
||||
var latitude = "52.3167";
|
||||
var latitude = {{ tag.latitude }};
|
||||
{% endif %}
|
||||
|
||||
{% if Input.old('latitude') and Input.old('longitude') and Input.old('zoomLevel') %}
|
||||
{% if (Input.old('latitude') and Input.old('longitude') and Input.old('zoomLevel'))
|
||||
or (tag.latitude and tag.longitude and tag.zoomLevel) %}
|
||||
var doPlaceMarker = true;
|
||||
{% else %}
|
||||
var doPlaceMarker = false;
|
||||
@ -73,16 +74,18 @@
|
||||
{% if Input.old('longitude') %}
|
||||
var longitude = "{{ Input.old('longitude') }}";
|
||||
{% else %}
|
||||
var longitude = "5.5500";
|
||||
var longitude = {{ tag.longitude }};
|
||||
{% endif %}
|
||||
|
||||
{% if Input.old('zoomLevel') %}
|
||||
var zoomLevel = {{ Input.old('zoomLevel') }};
|
||||
{% else %}
|
||||
var zoomLevel = 6;
|
||||
var zoomLevel = {{ tag.zoomLevel }};
|
||||
{% endif %}
|
||||
|
||||
var apiKey = "{{ apiKey }}";
|
||||
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
|
||||
<script src="js/ff/tags/edit.js"></script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3&key={{ apiKey }}"></script>
|
||||
<script src="js/ff/tags/create-edit.js"></script>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user