Skip to content
Snippets Groups Projects
Commit aff0471f authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA :bicyclist:
Browse files

Merge branch 'redmine-issues/14293' into 'develop'

REDINE_ISSUE-14293|Parcours d'une liste de signalements - Si j'édite un signalement et que je le valide, je ne suis plus en mode liste

See merge request !437
parents 9a865020 f320313d
No related branches found
No related tags found
1 merge request!437REDINE_ISSUE-14293|Parcours d'une liste de signalements - Si j'édite un signalement et que je le valide, je ne suis plus en mode liste
...@@ -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"
...@@ -73,6 +87,7 @@ ...@@ -73,6 +87,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"
...@@ -128,6 +143,10 @@ export default { ...@@ -128,6 +143,10 @@ export default {
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
displayToListButton: {
type: Boolean,
default: false,
},
}, },
computed: { computed: {
...@@ -184,4 +203,8 @@ export default { ...@@ -184,4 +203,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
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
:features-count="featuresCount" :features-count="featuresCount"
:slug-signal="slugSignal" :slug-signal="slugSignal"
:feature-type="featureType" :feature-type="featureType"
:display-to-list-button="displayToListButton"
@setIsCancelling="isCanceling = true" @setIsCancelling="isCanceling = true"
@tofeature="pushNgo" @tofeature="pushNgo"
/> />
...@@ -118,6 +119,30 @@ export default { ...@@ -118,6 +119,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: [],
...@@ -139,6 +164,7 @@ export default { ...@@ -139,6 +164,7 @@ export default {
featuresCount: null, featuresCount: null,
isCanceling: false, isCanceling: false,
slugSignal: '', slugSignal: '',
displayToListButton: false,
}; };
}, },
...@@ -155,6 +181,14 @@ export default { ...@@ -155,6 +181,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);
...@@ -163,6 +197,8 @@ export default { ...@@ -163,6 +197,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() {
...@@ -226,6 +262,10 @@ export default { ...@@ -226,6 +262,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);
} }
......
...@@ -75,17 +75,21 @@ ...@@ -75,17 +75,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