Skip to content

Firefly III: a personal finances manager

Various Javascript related fixes.

James Cole6c9990e0be8b
diff --git a/public/js/ff/categories/index.js b/public/js/ff/categories/index.js
index 8bf673924b..fd6f59934c 100644
--- a/public/js/ff/categories/index.js
+++ b/public/js/ff/categories/index.js
@@ -11,7 +11,7 @@ $(function () {
}
}
- if (typeof categoryID !== 'undefined' && typeof categoryDate !== undefined) {
+ if (typeof categoryID !== 'undefined' && typeof categoryDate !== 'undefined') {
columnChart('chart/category/' + categoryID + '/period/' + categoryDate, 'period-specific-period');
}
diff --git a/public/js/ff/categories/show.js b/public/js/ff/categories/show.js
index 8bf673924b..fd6f59934c 100644
--- a/public/js/ff/categories/show.js
+++ b/public/js/ff/categories/show.js
@@ -11,7 +11,7 @@ $(function () {
}
}
- if (typeof categoryID !== 'undefined' && typeof categoryDate !== undefined) {
+ if (typeof categoryID !== 'undefined' && typeof categoryDate !== 'undefined') {
columnChart('chart/category/' + categoryID + '/period/' + categoryDate, 'period-specific-period');
}
diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js
index d0a928ca2b..080ac4c93f 100644
--- a/public/js/ff/charts.js
+++ b/public/js/ff/charts.js
@@ -6,7 +6,7 @@
* of the MIT license. See the LICENSE file for details.
*/
-/* globals $, Chart, currencySymbol,mon_decimal_point ,accounting, mon_thousands_sep, frac_digits */
+/* globals $, Chart, currencySymbol,mon_decimal_point ,accounting, mon_thousands_sep, frac_digits, noDataForChart */
var allCharts = {};
@@ -155,8 +155,10 @@ function drawAChart(URI, container, chartType, options, colorData) {
// remove the chart container + parent
var holder = $('#' + container).parent().parent();
if (holder.hasClass('box')) {
- // remove box
- holder.remove();
+ // find box-body:
+ var boxBody = holder.find('.box-body');
+ boxBody.empty().append($('<p>').append($('<em>').text(noDataForChart)));
+ //holder.remove();
}
return;
}
diff --git a/resources/views/accounts/index.twig b/resources/views/accounts/index.twig
index f433cddf8b..84f653aacb 100644
--- a/resources/views/accounts/index.twig
+++ b/resources/views/accounts/index.twig
@@ -39,7 +39,7 @@
{% block scripts %}
<script type="text/javascript">
- var what = '{{ what }}';
+ var what = '{{ what|escape }}';
</script>
<script type="text/javascript" src="js/lib/bootstrap-sortable.js"></script>
{% endblock %}
diff --git a/resources/views/accounts/show_with_date.twig b/resources/views/accounts/show_with_date.twig
index 92b700eb21..e872140108 100644
--- a/resources/views/accounts/show_with_date.twig
+++ b/resources/views/accounts/show_with_date.twig
@@ -91,7 +91,7 @@
{% block scripts %}
<script type="text/javascript">
var accountID = {{ account.id }};
- var dateString = "{{ date }}";
+ var dateString = "{{ date|escape }}";
// uri's for charts:
var incomeByCategoryUri = '{{ route('chart.account.incomeByCategory', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
diff --git a/resources/views/export/index.twig b/resources/views/export/index.twig
index 50b0123c5d..f5fcd3dadf 100644
--- a/resources/views/export/index.twig
+++ b/resources/views/export/index.twig
@@ -98,7 +98,7 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
- var jobKey = "{{ job.key }}";
+ var jobKey = "{{ job.key|escape }}";
</script>
<script type="text/javascript" src="js/ff/export/index.js"></script>
{% endblock %}
diff --git a/resources/views/layout/default.twig b/resources/views/layout/default.twig
index 71009c1e20..6aed4659ed 100644
--- a/resources/views/layout/default.twig
+++ b/resources/views/layout/default.twig
@@ -180,23 +180,23 @@
currentPeriod: "{{ dpCurrent }}",
previousPeriod: "{{ dpPrevious }}",
nextPeriod: "{{ dpNext }}",
- everything: '{{ 'everything'|_ }}',
- customRangeLabel: '{{ 'customRange'|_ }}',
- applyLabel: '{{ 'apply'|_ }}',
- cancelLabel: '{{ 'cancel'|_ }}',
- fromLabel: '{{ 'from'|_ }}',
- toLabel: '{{ 'to'|_ }}',
+ everything: '{{ 'everything'|_|escape }}',
+ customRangeLabel: '{{ 'customRange'|_|escape }}',
+ applyLabel: '{{ 'apply'|_|escape }}',
+ cancelLabel: '{{ 'cancel'|_|escape }}',
+ fromLabel: '{{ 'from'|_|escape }}',
+ toLabel: '{{ 'to'|_|escape }}',
ranges: {{ dpRanges|json_encode|raw }}
};
var token = "{{ csrf_token() }}";
- var language = "{{ language }}";
+ var language = "{{ language|escape }}";
var currencyCode = '{{ getCurrencyCode()|escape('js') }}';
var currencySymbol = '{{ getCurrencySymbol()|escape('js') }}';
var mon_decimal_point = "{{ localeconv.mon_decimal_point|escape('js') }}";
var mon_thousands_sep = "{{ localeconv.mon_thousands_sep|escape('js') }}";
var frac_digits = {{ localeconv.frac_digits }};
-
+ var noDataForChart = '{{ trans('firefly.no_data_for_chart')|escape }}';
var showFullList = '{{ trans('firefly.show_full_list') }}';
var showOnlyTop = '{{ trans('firefly.show_only_top',{number:listLength}) }}';