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
No related merge requests found
......@@ -4,6 +4,20 @@
<div class="content">
{{ currentFeature.title || currentFeature.feature_id }}
<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
v-if="featuresCount"
id="feature-count"
......@@ -73,6 +87,7 @@
slug_signal: slugSignal,
slug_type_signal: $route.params.slug_type_signal || featureType.slug,
},
query: $route.query
}"
class="ui button button-hover-orange tiny-margin"
data-tooltip="Éditer le signalement"
......@@ -128,6 +143,10 @@ export default {
type: Object,
default: () => {},
},
displayToListButton: {
type: Boolean,
default: false,
},
},
computed: {
......@@ -184,4 +203,8 @@ export default {
#next-feature {
margin-right: .5rem !important;
}
#feature-detail-to-features-list {
line-height: 0;
margin-right: 5px;
}
</style>
\ No newline at end of file
......@@ -10,6 +10,7 @@
:features-count="featuresCount"
:slug-signal="slugSignal"
:feature-type="featureType"
:display-to-list-button="displayToListButton"
@setIsCancelling="isCanceling = true"
@tofeature="pushNgo"
/>
......@@ -118,6 +119,30 @@ export default {
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() {
return {
attachments: [],
......@@ -139,6 +164,7 @@ export default {
featuresCount: null,
isCanceling: false,
slugSignal: '',
displayToListButton: false,
};
},
......@@ -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() {
if (this.$route.params.slug_type_signal) {
this.SET_CURRENT_FEATURE_TYPE_SLUG(this.$route.params.slug_type_signal);
......@@ -163,6 +197,8 @@ export default {
mounted() {
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() {
......@@ -226,6 +262,10 @@ export default {
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) {
this.$router.push(newEntry); //* update the params or queries in the route/url
await this.getPageInfo();
......
......@@ -809,7 +809,6 @@ export default {
this.updateStore();
}
this.sendingFeature = true;
console.log(this.sendingFeature);
this.$store.dispatch('feature/SEND_FEATURE', this.currentRouteName)
.then(() => this.sendingFeature = false);
}
......
......@@ -75,17 +75,21 @@
ref="map"
/>
<div
<router-link
id="features-list"
class="ui button fluid teal"
@click="$router.push({
:to="{
name: 'liste-signalements',
params: { slug: slug },
})"
}"
custom
>
<i class="ui icon arrow right" />
Voir tous les signalements
</div>
<div
class="ui button fluid teal"
>
<i class="ui icon arrow right" />
Voir tous les signalements
</div>
</router-link>
<div
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