From 777fe3bf18f2a6c6887d623eb889cc7895823ebe Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 18 Nov 2020 17:19:24 +0100 Subject: delete a weather favorite when its icon is clicked Signed-off-by: Julien Veyssier Signed-off-by: npmbuildbot-nextcloud[bot] --- apps/weather_status/src/App.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'apps/weather_status/src') diff --git a/apps/weather_status/src/App.vue b/apps/weather_status/src/App.vue index 81edc28eaf4..6fcc764ac97 100644 --- a/apps/weather_status/src/App.vue +++ b/apps/weather_status/src/App.vue @@ -63,7 +63,7 @@ + @click="onFavoriteClick($event, f)"> {{ f }} @@ -439,8 +439,16 @@ export default { } network.saveFavorites(this.favorites) }, - onFavoriteClick(favAddress) { - if (favAddress !== this.address) { + onFavoriteClick(e, favAddress) { + // clicked on the icon + if (e.target.classList.contains('action-button__icon')) { + const i = this.favorites.indexOf(favAddress) + if (i !== -1) { + this.favorites.splice(i, 1) + } + network.saveFavorites(this.favorites) + } else if (favAddress !== this.address) { + // clicked on the text this.setAddress(favAddress) } }, -- cgit v1.2.3