Skip to content

Commit

Permalink
Merge pull request #24194 from nextcloud/enh/noid/clear-weather-favor…
Browse files Browse the repository at this point in the history
…ites

Add action to clear all weather favorites
  • Loading branch information
Julien Veyssier authored Dec 16, 2020
2 parents bf5aa88 + 777fe3b commit 15e4f1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/weather_status/js/weather-status.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/weather_status/js/weather-status.js.map

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions apps/weather_status/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
}
},
Expand Down

0 comments on commit 15e4f1c

Please sign in to comment.