diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2020-11-18 17:19:24 +0100 |
---|---|---|
committer | npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com> | 2020-12-16 14:05:53 +0000 |
commit | 777fe3bf18f2a6c6887d623eb889cc7895823ebe (patch) | |
tree | df368148700cc8f577647dd78714058397722dbb /apps/weather_status/src | |
parent | ce9590618ccd431c5caa183a0e1009b2feb775bf (diff) | |
download | nextcloud-server-777fe3bf18f2a6c6887d623eb889cc7895823ebe.tar.gz nextcloud-server-777fe3bf18f2a6c6887d623eb889cc7895823ebe.zip |
delete a weather favorite when its icon is clicked
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/weather_status/src')
-rw-r--r-- | apps/weather_status/src/App.vue | 14 |
1 files changed, 11 insertions, 3 deletions
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 @@ <ActionButton v-for="f in displayedFavorites" :key="f" icon="icon-starred" - @click="onFavoriteClick(f)"> + @click="onFavoriteClick($event, f)"> {{ f }} </ActionButton> </Actions> @@ -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) } }, |