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

Merge branch 'develop' into redmine-issues/14072

parents 78362019 aff0471f
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,20 @@ ...@@ -4,6 +4,20 @@
<div class="content"> <div class="content">
{{ currentFeature.title || currentFeature.feature_id }} {{ currentFeature.title || currentFeature.feature_id }}
<div class="ui icon right floated compact buttons"> <div class="ui icon right floated compact buttons">
<router-link
v-if="displayToListButton"
id="feature-detail-to-features-list"
:to="{
name: 'liste-signalements',
params: { slug: $route.params.slug },
}"
custom
>
<div class="ui button tiny-margin teal">
<i class="ui icon arrow right" />
Retour à la liste des signalements
</div>
</router-link>
<span <span
v-if="featuresCount" v-if="featuresCount"
id="feature-count" id="feature-count"
...@@ -87,6 +101,7 @@ ...@@ -87,6 +101,7 @@
slug_signal: slugSignal, slug_signal: slugSignal,
slug_type_signal: $route.params.slug_type_signal || featureType.slug, slug_type_signal: $route.params.slug_type_signal || featureType.slug,
}, },
query: $route.query
}" }"
class="ui button button-hover-orange tiny-margin" class="ui button button-hover-orange tiny-margin"
data-tooltip="Éditer le signalement" data-tooltip="Éditer le signalement"
...@@ -145,7 +160,11 @@ export default { ...@@ -145,7 +160,11 @@ export default {
fastEditionMode: { fastEditionMode: {
type: Boolean, type: Boolean,
default: false, default: false,
} },
displayToListButton: {
type: Boolean,
default: false,
},
}, },
computed: { computed: {
...@@ -202,4 +221,8 @@ export default { ...@@ -202,4 +221,8 @@ export default {
#next-feature { #next-feature {
margin-right: .5rem !important; margin-right: .5rem !important;
} }
#feature-detail-to-features-list {
line-height: 0;
margin-right: 5px;
}
</style> </style>
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
:slug-signal="slugSignal" :slug-signal="slugSignal"
:feature-type="featureType" :feature-type="featureType"
:fast-edition-mode="project.fast_edition_mode" :fast-edition-mode="project.fast_edition_mode"
:display-to-list-button="displayToListButton"
@setIsCancelling="isCanceling = true" @setIsCancelling="isCanceling = true"
@tofeature="pushNgo" @tofeature="pushNgo"
/> />
...@@ -120,6 +121,30 @@ export default { ...@@ -120,6 +121,30 @@ export default {
FeatureComments FeatureComments
}, },
beforeRouteEnter (to, from, next) {
// if the user edited the feature, coming from filtered features details browsing,
// display a button to turn back to the list view, in order to start again from the list
// because order changes after edition, depending the sort criteria
// in beforeRouteEnter, the component is not mounted and this doesn't exist yet, thus we store the value in window object
window.displayToListButton = false; // reinitialisation of the value
if (from.query.offset !== undefined) { // if a queryset for filtered features is stored in the route from
window.displayToListButton = true; // toggle the value to display the button
}
next(); // continue page loading
},
beforeRouteLeave (to, from, next) {
if (// In case of filtered listed featuers, if the user wants to edit a feature,
from.query.offset >= 0 &&
to.name === 'editer-signalement' &&
!this.confirmLeave() // warn the user that features order might change
){
next(false);
} else {// Navigate to next view
next();
}
},
data() { data() {
return { return {
attachments: [], attachments: [],
...@@ -141,6 +166,7 @@ export default { ...@@ -141,6 +166,7 @@ export default {
featuresCount: null, featuresCount: null,
isCanceling: false, isCanceling: false,
slugSignal: '', slugSignal: '',
displayToListButton: false,
}; };
}, },
...@@ -157,6 +183,14 @@ export default { ...@@ -157,6 +183,14 @@ export default {
]), ]),
}, },
watch: {
'$route.query'(newValue, oldValue) {
if (newValue !== oldValue) { //* Navigate back or forward to the previous or next URL
this.initPage(); //* doesn't update the page at query changes, thus it is done manually here
}
},
},
created() { created() {
if (this.$route.params.slug_type_signal) { if (this.$route.params.slug_type_signal) {
this.SET_CURRENT_FEATURE_TYPE_SLUG(this.$route.params.slug_type_signal); this.SET_CURRENT_FEATURE_TYPE_SLUG(this.$route.params.slug_type_signal);
...@@ -165,6 +199,8 @@ export default { ...@@ -165,6 +199,8 @@ export default {
mounted() { mounted() {
this.initPage(); this.initPage();
// when this is available, set the value with previously stored value in windows to pass it as a prop
this.displayToListButton = window.displayToListButton;
}, },
beforeDestroy() { beforeDestroy() {
...@@ -228,6 +264,10 @@ export default { ...@@ -228,6 +264,10 @@ export default {
this.DISCARD_LOADER(); this.DISCARD_LOADER();
}, },
confirmLeave() {
return window.confirm('Vous allez quittez la vue signalement filtré, l\'ordre des signalements pourrait changer après édition d\'un signalement.');
},
async pushNgo(newEntry) { async pushNgo(newEntry) {
this.$router.push(newEntry); //* update the params or queries in the route/url this.$router.push(newEntry); //* update the params or queries in the route/url
await this.getPageInfo(); await this.getPageInfo();
......
...@@ -809,7 +809,6 @@ export default { ...@@ -809,7 +809,6 @@ export default {
this.updateStore(); this.updateStore();
} }
this.sendingFeature = true; this.sendingFeature = true;
console.log(this.sendingFeature);
this.$store.dispatch('feature/SEND_FEATURE', this.currentRouteName) this.$store.dispatch('feature/SEND_FEATURE', this.currentRouteName)
.then(() => this.sendingFeature = false); .then(() => this.sendingFeature = false);
} }
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
null null
" "
:init-opacity="getOpacity(feature_type, option)" :init-opacity="getOpacity(feature_type, option)"
:geom-type="feature_type.customfield_set.geomType" :geom-type="feature_type.geom_type"
@set="setColorsStyle" @set="setColorsStyle"
/> />
</div> </div>
......
...@@ -53,17 +53,21 @@ ...@@ -53,17 +53,21 @@
ref="map" ref="map"
/> />
<div <router-link
id="features-list" id="features-list"
class="ui button fluid teal" :to="{
@click="$router.push({
name: 'liste-signalements', name: 'liste-signalements',
params: { slug: slug }, params: { slug: slug },
})" }"
custom
> >
<i class="ui icon arrow right" /> <div
Voir tous les signalements class="ui button fluid teal"
</div> >
<i class="ui icon arrow right" />
Voir tous les signalements
</div>
</router-link>
<div <div
id="popup" id="popup"
......
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