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>
pull/24194/head
Julien Veyssier 6 years ago committed by npmbuildbot-nextcloud[bot]
parent ce9590618c
commit 777fe3bf18
  1. 4
      apps/weather_status/js/weather-status.js
  2. 2
      apps/weather_status/js/weather-status.js.map
  3. 14
      apps/weather_status/src/App.vue

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -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)
}
},

Loading…
Cancel
Save