Skip to content

Commit

Permalink
Merge pull request #55 from Fliplet/fix-ID-2640
Browse files Browse the repository at this point in the history
ID-2640 [Fix] Ensures click listeners are only fired once for each widget version
  • Loading branch information
tonytlwu authored Oct 10, 2022
2 parents c3a1fd1 + 9e7cfb6 commit 1f0ae0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if items.length}}
<div data-list-id="{{id}}" data-filter-id="{{id}}" data-list-uuid="{{uuid}}" class="list list-default {{#if swipeToSave}}list-swipe-save{{/if}}">
<div data-list-1-0-1-id="{{id}}" data-filter-id="{{id}}" data-list-uuid="{{uuid}}" class="list list-default {{#if swipeToSave}}list-swipe-save{{/if}}">
{{#if swipeToSave}}
<div class="filter-wrapper">
<ul class="list-save-filter">
Expand Down
11 changes: 5 additions & 6 deletions js/build.js
Original file line number Diff line number Diff line change
@@ -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))) {
Expand All @@ -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
});
}
Expand Down

0 comments on commit 1f0ae0a

Please sign in to comment.