Skip to content
Snippets Groups Projects
Commit bf6670ef authored by Timothee P's avatar Timothee P :sunflower:
Browse files

add switch between delete and modify select mode

parent f714c215
No related branches found
No related tags found
2 merge requests!295Version 3.0.0,!232REDMINE_ISSUE-11834
...@@ -4,9 +4,17 @@ ...@@ -4,9 +4,17 @@
<table id="table-features" class="ui compact table dataTable"> <table id="table-features" class="ui compact table dataTable">
<thead> <thead>
<tr> <tr>
<th class="dt-center"></th> <th class="dt-center">
<div @click="switchMode" class="switch-buttons pointer" :data-tooltip="`Passer en mode ${mode === 'modify' ? 'suppression':'édition'}`">
<div><i :class="['icon pencil', {disabled: mode !== 'modify'}]"></i></div>
<span class="grey">|&nbsp;</span>
<div><i :class="['icon trash', {disabled: mode !== 'delete'}]"></i></div>
</div>
</th>
<th class="dt-center"> <th class="dt-center">
<div class="pointer" @click="changeSort('status')">
Statut Statut
<i <i
:class="{ :class="{
...@@ -14,21 +22,23 @@ ...@@ -14,21 +22,23 @@
up: isSortedDesc('status'), up: isSortedDesc('status'),
}" }"
class="icon sort" class="icon sort"
@click="changeSort('status')"
/> />
</div>
</th> </th>
<th class="dt-center"> <th class="dt-center">
Type <div class="pointer" @click="changeSort('feature_type')">
<i Type
:class="{ <i
down: isSortedAsc('feature_type'), :class="{
up: isSortedDesc('feature_type'), down: isSortedAsc('feature_type'),
}" up: isSortedDesc('feature_type'),
class="icon sort" }"
@click="changeSort('feature_type')" class="icon sort"
/> />
</div>
</th> </th>
<th class="dt-center"> <th class="dt-center">
<div class="pointer" @click="changeSort('title')">
Nom Nom
<i <i
:class="{ :class="{
...@@ -36,10 +46,11 @@ ...@@ -36,10 +46,11 @@
up: isSortedDesc('title'), up: isSortedDesc('title'),
}" }"
class="icon sort" class="icon sort"
@click="changeSort('title')"
/> />
</div>
</th> </th>
<th class="dt-center"> <th class="dt-center">
<div class="pointer" @click="changeSort('updated_on')">
Dernière modification Dernière modification
<i <i
:class="{ :class="{
...@@ -47,30 +58,32 @@ ...@@ -47,30 +58,32 @@
up: isSortedDesc('updated_on'), up: isSortedDesc('updated_on'),
}" }"
class="icon sort" class="icon sort"
@click="changeSort('updated_on')"
/> />
</div>
</th> </th>
<th class="dt-center" v-if="user"> <th class="dt-center" v-if="user">
Auteur <div class="pointer" @click="changeSort('display_creator')">
<i Auteur
:class="{ <i
down: isSortedAsc('display_creator'), :class="{
up: isSortedDesc('display_creator'), down: isSortedAsc('display_creator'),
}" up: isSortedDesc('display_creator'),
class="icon sort" }"
@click="changeSort('display_creator')" class="icon sort"
/> />
</div>
</th> </th>
<th class="dt-center" v-if="user"> <th class="dt-center" v-if="user">
Dernier éditeur <div class="pointer" @click="changeSort('display_last_editor')">
<i Dernier éditeur
:class="{ <i
down: isSortedAsc('display_last_editor'), :class="{
up: isSortedDesc('display_last_editor'), down: isSortedAsc('display_last_editor'),
}" up: isSortedDesc('display_last_editor'),
class="icon sort" }"
@click="changeSort('display_last_editor')" class="icon sort"
/> />
</div>
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -78,7 +91,7 @@ ...@@ -78,7 +91,7 @@
<tr v-for="(feature, index) in paginatedFeatures" :key="index"> <tr v-for="(feature, index) in paginatedFeatures" :key="index">
<td class="dt-center"> <td class="dt-center">
<div <div
:class="['ui checkbox', {disabled: !canEditFeature(feature)}]" :class="['ui checkbox', {disabled: !checkRights(feature)}]"
> >
<input <input
type="checkbox" type="checkbox"
...@@ -86,12 +99,13 @@ ...@@ -86,12 +99,13 @@
@input="storeClickedFeature(feature)" @input="storeClickedFeature(feature)"
:id="feature.id" :id="feature.id"
:value="feature.id" :value="feature.id"
:disabled="!canEditFeature(feature)" :disabled="!checkRights(feature)"
name="select" name="select"
/> />
<label for="select"></label> <label for="select"></label>
</div> </div>
{{canDeleteFeature(feature)}} <!-- {{canDeleteFeature(feature)}}
{{canEditFeature(feature)}} -->
</td> </td>
<td class="dt-center"> <td class="dt-center">
...@@ -257,6 +271,7 @@ export default { ...@@ -257,6 +271,7 @@ export default {
"featuresCount", "featuresCount",
"pagination", "pagination",
"sort", "sort",
"mode"
], ],
computed: { computed: {
...@@ -340,7 +355,21 @@ export default { ...@@ -340,7 +355,21 @@ export default {
} else { } else {
return false return false
} }
},
checkRights(feature) {
switch (this.mode) {
case 'modify':
return this.canEditFeature(feature)
case 'delete':
return this.canDeleteFeature(feature)
}
},
switchMode() {
this.$emit('update:mode', this.mode === 'modify' ? 'delete' : 'modify');
this.$emit('update:clickedFeatures', []);
this.$store.commit("feature/UPDATE_CHECKED_FEATURES", []);
}, },
getUserName(feature) { getUserName(feature) {
...@@ -374,6 +403,9 @@ export default { ...@@ -374,6 +403,9 @@ export default {
} }
}, },
}, },
destroyed() {
this.$store.commit("feature/UPDATE_CHECKED_FEATURES", []);
},
}; };
</script> </script>
...@@ -468,7 +500,23 @@ table.dataTable th.dt-center, table.dataTable td.dt-center, table.dataTable td.d ...@@ -468,7 +500,23 @@ table.dataTable th.dt-center, table.dataTable td.dt-center, table.dataTable td.d
i.icon.sort:not(.down):not(.up) { i.icon.sort:not(.down):not(.up) {
color: rgb(220, 220, 220); color: rgb(220, 220, 220);
} }
.pointer:hover {
cursor: pointer;
}
.switch-buttons {
display: flex;
justify-content: center;
align-items: baseline;
}
.grey {
color: #bbbbbb;
}
.ui.dropdown .menu .left.menu, .ui.dropdown > .left.menu .menu {
margin-right: 0 !important;
}
/* /*
Max width before this PARTICULAR table gets nasty Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px This query will take effect for any screen smaller than 760px
......
...@@ -43,12 +43,12 @@ ...@@ -43,12 +43,12 @@
@click="toggleAddFeature" @click="toggleAddFeature"
class="ui dropdown button compact button-hover-green" class="ui dropdown button compact button-hover-green"
data-tooltip="Ajouter un signalement" data-tooltip="Ajouter un signalement"
data-position="bottom left" data-position="bottom right"
> >
<i class="plus fitted icon"></i> <i class="plus fitted icon"></i>
<div <div
v-if="showAddFeature" v-if="showAddFeature"
class="menu transition visible" class="menu left transition visible"
style="z-index: 9999" style="z-index: 9999"
> >
<div class="header">Ajouter un signalement du type</div> <div class="header">Ajouter un signalement du type</div>
...@@ -70,16 +70,16 @@ ...@@ -70,16 +70,16 @@
<div <div
v-if="checkedFeatures.length > 0" v-if="checkedFeatures.length > 0 && mode === 'modify'"
@click="toggleModifyStatus" @click="toggleModifyStatus"
class="ui dropdown button compact button-hover-green margin-left-25" class="ui dropdown button compact button-hover-green margin-left-25"
data-tooltip="Modifier le statut des Signalements" data-tooltip="Modifier le statut des Signalements"
data-position="bottom center" data-position="bottom right"
> >
<i class="pencil fitted icon"></i> <i class="pencil fitted icon"></i>
<div <div
v-if="showModifyStatus" v-if="showModifyStatus"
class="menu transition visible" class="menu left transition visible"
style="z-index: 9999" style="z-index: 9999"
> >
<div class="header">Modifier le statut des Signalements</div> <div class="header">Modifier le statut des Signalements</div>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</div> </div>
<div <div
v-if="checkedFeatures.length" v-if="checkedFeatures.length > 0 && mode === 'delete'"
@click="modalAllDelete" @click="modalAllDelete"
class="ui button compact button-hover-red margin-left-25" class="ui button compact button-hover-red margin-left-25"
data-tooltip="Effacer tous les types de signalements sélectionnés" data-tooltip="Effacer tous les types de signalements sélectionnés"
...@@ -170,8 +170,9 @@ ...@@ -170,8 +170,9 @@
v-on:update:page="handlePageChange" v-on:update:page="handlePageChange"
v-on:update:sort="handleSortChange" v-on:update:sort="handleSortChange"
:paginatedFeatures="paginatedFeatures" :paginatedFeatures="paginatedFeatures"
:checkedFeatures.sync="checkedFeatures" :checkedFeatures="checkedFeatures"
:clickedFeatures.sync="clickedFeatures" :clickedFeatures.sync="clickedFeatures"
:mode.sync="mode"
:featuresCount="featuresCount" :featuresCount="featuresCount"
:pagination="pagination" :pagination="pagination"
:sort="sort" :sort="sort"
...@@ -260,6 +261,7 @@ export default { ...@@ -260,6 +261,7 @@ export default {
baseUrl: this.$store.state.configuration.BASE_URL, baseUrl: this.$store.state.configuration.BASE_URL,
clickedFeatures: [], clickedFeatures: [],
modalAllDeleteOpen: false, modalAllDeleteOpen: false,
mode: "modify",
map: null, map: null,
zoom: null, zoom: null,
lat: null, lat: null,
...@@ -743,6 +745,10 @@ export default { ...@@ -743,6 +745,10 @@ export default {
padding: 0 !important; padding: 0 !important;
} }
.ui.dropdown .menu .left.menu, .ui.dropdown > .left.menu .menu {
margin-right: 0 !important;
}
@media screen and (min-width: 767px) { @media screen and (min-width: 767px) {
.twelve-wide { .twelve-wide {
width: 75% !important; width: 75% !important;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment