Skip to content

Commit

Permalink
Cache les tags système dans la page des tags (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
polosson committed May 5, 2021
1 parent d2db189 commit c69b067
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Ce projet adhère au principe du [Semantic Versioning](https://semver.org/spec/v
(numéro client) du bénéficiaire (voir #122) et les numéros de téléphone des techniciens et des bénéficiaires.
- Corrige l'affichage des numéros légaux de l'entreprise (SIRET, etc.) sur les devis et factures.
- Corrige le nom des fichiers uploadés comme documents du matériel pour qu'il conserve son extension (#132).
- N'affiche plus les tags protégés (tags système) dans la page des étiquettes, pour éviter les confusions (#134).

## 0.12.0 (2021-03-29)

Expand Down
6 changes: 0 additions & 6 deletions client/src/pages/Tags/Tags.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@
color: $text-light-color;
}
}

&--protected {
.Tags__item__name {
color: $text-muted-color;
}
}
}
}

Expand Down
9 changes: 1 addition & 8 deletions client/src/pages/Tags/Tags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,19 @@
<h3 v-if="tags.length === 0" class="Tags__empty">
{{ $t('page-tags.no-item') }}
</h3>
<div
v-for="tag in tags"
:key="tag.id"
class="Tags__item"
:class="{ 'Tags__item--protected': isProtected(tag.name) }"
>
<div v-for="tag in tags" :key="tag.id" class="Tags__item">
<span class="Tags__item__name">
<i class="fas fa-tag" />
{{ tag.name }}
</span>
<button
v-if="!isProtected(tag.name)"
v-tooltip="$t('action-edit')"
class="Tags__edit-button info"
@click="edit(tag.id, tag.name)"
>
<i class="fas fa-edit" />
</button>
<button
v-if="!isProtected(tag.name)"
v-tooltip="$t('action-trash')"
class="Tags__edit-button warning"
@click="remove(tag.id)"
Expand Down
6 changes: 1 addition & 5 deletions client/src/pages/Tags/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
},
computed: {
tags() {
return store.state.tags.list;
return store.getters['tags/publicList'];
},

isFetched() {
Expand All @@ -29,10 +29,6 @@ export default {
store.dispatch('tags/fetch');
},
methods: {
isProtected(tagName) {
return store.getters['tags/isProtected'](tagName);
},

addTag() {
Alert.Prompt(this.$t, 'page-tags.prompt-add', {
placeholder: 'page-tags.tag-name',
Expand Down
4 changes: 4 additions & 0 deletions client/src/stores/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export default {
state.list.filter((tag) => !getters.isProtected(tag.name)),
),

publicList: (state, getters) => state.list.filter(
(tag) => !getters.isProtected(tag.name),
),

isProtected: (state) => (tagName) => (
state.protected.includes(tagName.toLowerCase())
),
Expand Down

0 comments on commit c69b067

Please sign in to comment.