From d7e755cbb15d38336df62f2cd0bbf69e89ffe266 Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Wed, 6 Jul 2022 11:42:49 +0100 Subject: [PATCH 1/2] Wait for Fliplet() to resolve before using T() --- js/build.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/build.js b/js/build.js index 7add030..478b711 100644 --- a/js/build.js +++ b/js/build.js @@ -21,9 +21,9 @@ Fliplet.Widget.instance('list', function(data) { } }); - var swipeToSaveLabel = data.swipeToSaveLabel || T('widgets.list.noImages.defaultListName'); - Fliplet().then(function() { + var swipeToSaveLabel = data.swipeToSaveLabel || T('widgets.list.noImages.defaultListName'); + $container.translate({ swipeToSaveLabel: swipeToSaveLabel }); if (data.swipeToSave) { From 9e7cfb655f05887d557813ea300011bff7a3b51e Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Mon, 10 Oct 2022 17:20:20 +0100 Subject: [PATCH 2/2] Change widget name to include version --- build.html | 2 +- js/build.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.html b/build.html index a10cb0f..ec5a6e3 100644 --- a/build.html +++ b/build.html @@ -1,5 +1,5 @@ {{#if items.length}} -
+
{{#if swipeToSave}}
    diff --git a/js/build.js b/js/build.js index 478b711..13d43ee 100644 --- a/js/build.js +++ b/js/build.js @@ -1,19 +1,18 @@ -Fliplet.Widget.instance('list', function(data) { +Fliplet.Widget.instance('list-1-0-1', function(data) { var $container = $(this); var _this = this; $container.find('.linked[data-list-item-id]').click(function(event) { event.preventDefault(); - var $container = $(this); + var $listItem = $(this); - if ($container.parents('.list-swipe.swiping').length) { + if ($listItem.parents('.list-swipe.swiping').length) { return; } - var data = Fliplet.Widget.getData($container.parents('[data-list-id]').attr('data-list-id')); var itemData = _.find(data.items, { - id: $container.attr('data-list-item-id') + id: $listItem.attr('data-list-item-id') }); if (!_.isUndefined(itemData) && (!_.isUndefined(itemData.linkAction) && !_.isEmpty(itemData.linkAction))) { @@ -28,7 +27,7 @@ Fliplet.Widget.instance('list', function(data) { if (data.swipeToSave) { window.ui = window.ui || {}; - window.ui['swipeSavedList' + $container.attr('data-list-uuid')] = new SwipeSaveList(_this, { + window.ui['swipeSavedList' + data.uuid] = new SwipeSaveList(_this, { savedListLabel: swipeToSaveLabel }); }