From fcdeda91d97c869fe567ee0237f537bafb6aab64 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 5 Mar 2019 19:36:14 +0100 Subject: [PATCH] Show the iCal sharing link instead of directly open it (references #141) --- localization/en/strings.php | 3 ++- public/js/grocy.js | 5 +++++ public/viewjs/calendar.js | 5 ++++- views/calendar.blade.php | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/localization/en/strings.php b/localization/en/strings.php index 94f4e579..ea5998e9 100644 --- a/localization/en/strings.php +++ b/localization/en/strings.php @@ -335,7 +335,8 @@ return array( 'This is for statistical purposes only' => 'This is for statistical purposes only', 'You have to select a recipe' => 'You have to select a recipe', 'Key type' => 'Key type', - 'Export as iCal' => 'Export as iCal', + 'Share/Integrate calendar (iCal)' => 'Share/Integrate calendar (iCal)', + 'Use the following (public) URL to share or integrate the calendar in iCal format' => 'Use the following (public) URL to share or integrate the calendar in iCal format', 'Allow partial units in stock' => 'Allow partial units in stock', 'Enable tare weight handling' => 'Enable tare weight handling', 'This is useful e.g. for flour in jars - on purchase/consume/inventory you always weigh the whole jar, the amount to be posted is then automatically calculated based on what is in stock and the tare weight defined below' => 'This is useful e.g. for flour in jars - on purchase/consume/inventory you always weigh the whole jar, the amount to be posted is then automatically calculated based on what is in stock and the tare weight defined below', diff --git a/public/js/grocy.js b/public/js/grocy.js index 9f60a332..560bd445 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -506,3 +506,8 @@ $(".locale-number-format[data-format='currency']").each(function () { $(this).text(parseFloat($(this).text()).toLocaleString(undefined, { style: "currency", currency: Grocy.Currency })); }); + +$(document).on("click", ".easy-link-copy-textbox", function() +{ + $(this).select(); +}); diff --git a/public/viewjs/calendar.js b/public/viewjs/calendar.js index b8725b95..7b8aa5b0 100644 --- a/public/viewjs/calendar.js +++ b/public/viewjs/calendar.js @@ -17,7 +17,10 @@ $("#ical-button").on("click", function(e) Grocy.Api.Get('calendar/ical/sharing-link', function(result) { - location.href = result.url; + bootbox.alert({ + title: L('Share/Integrate calendar (iCal)'), + message: L('Use the following (public) URL to share or integrate the calendar in iCal format') + '' + }); }, function(xhr) { diff --git a/views/calendar.blade.php b/views/calendar.blade.php index d38f8f62..7f790e4a 100644 --- a/views/calendar.blade.php +++ b/views/calendar.blade.php @@ -19,7 +19,7 @@

@yield('title') -  {{ $L('Export as iCal') }} +  {{ $L('Share/Integrate calendar (iCal)') }}