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

Merge branch 'develop' into evol/redmine-ticket-11083-full-responsive-design

parents 174afded b901b8ed
No related branches found
No related tags found
1 merge request!38Evol/redmine ticket 11083 full responsive design
This commit is part of merge request !38. Comments created here will be created in the context of that merge request.
...@@ -162,14 +162,14 @@ export default new Vuex.Store({ ...@@ -162,14 +162,14 @@ export default new Vuex.Store({
}, },
USER_INFO({ state, commit }) { USER_INFO({ state, commit }) {
if (state.user) { if (!state.user) {
axios axios
.get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}user_info/`) .get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}user_info/`)
.then((response) => { .then((response) => {
if (response && response.status === 200) { if (response && response.status === 200) {
const user = response.data.user; const user = response.data.user;
commit("SET_USER", user); commit("SET_USER", user);
window.localStorage.setItem("user", JSON.stringify(user)); //? toujours nécessaire ? //window.localStorage.setItem("user", JSON.stringify(user)); // ? nécessaire ?
} }
}) })
.catch(() => { .catch(() => {
...@@ -178,16 +178,17 @@ export default new Vuex.Store({ ...@@ -178,16 +178,17 @@ export default new Vuex.Store({
} }
}, },
LOGOUT({ commit }) { LOGOUT({ commit, dispatch }) {
const pageNoRedirect = ["liste-signalements", "details-type-signalement", "details-signalement", "project_detail", "mentions", "aide", "index"] // const pageNoRedirect = ["liste-signalements", "details-type-signalement", "details-signalement", "project_detail", "mentions", "aide", "index"]
axios axios
.get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}logout/`) .get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}logout/`)
.then((response) => { .then((response) => {
if (response && response.status === 200) { if (response && response.status === 200) {
commit("SET_USER", false); commit("SET_USER", false);
commit("SET_USER_LEVEL_PROJECTS", null); commit("SET_USER_LEVEL_PROJECTS", null);
commit("SET_USER_PERMISSIONS", null); dispatch("GET_USER_LEVEL_PERMISSIONS");
if (!pageNoRedirect.includes(router.history.current.name)) router.push("/"); // if (!pageNoRedirect.includes(router.history.current.name)) router.push("/");
router.push("/");
} }
}) })
.catch((error) => { .catch((error) => {
......
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
<p><i class="check icon"></i> {{ tempMessage }}</p> <p><i class="check icon"></i> {{ tempMessage }}</p>
</div> </div>
</div> </div>
<div id="message_info" class="fullwidth">
<div v-if="infoMessage" class="ui info message" style="text-align: left;">
<div class="header">
<i class="info circle icon"></i> Informations
</div>
<ul class="list">
{{ infoMessage }}
</ul>
</div>
</div>
<div class="row"> <div class="row">
<div class="four wide middle aligned column"> <div class="four wide middle aligned column">
...@@ -463,6 +473,7 @@ export default { ...@@ -463,6 +473,7 @@ export default {
data() { data() {
return { return {
infoMessage: '',
geojsonImport: [], geojsonImport: [],
fileToImport: { name: "", size: 0 }, fileToImport: { name: "", size: 0 },
slug: this.$route.params.slug, slug: this.$route.params.slug,
...@@ -524,7 +535,17 @@ export default { ...@@ -524,7 +535,17 @@ export default {
suscribe: !this.is_suscriber, suscribe: !this.is_suscriber,
projectSlug: this.$route.params.slug, projectSlug: this.$route.params.slug,
}) })
.then((data) => (this.is_suscriber = data.is_suscriber)); .then((data) => {
this.is_suscriber = data.is_suscriber;
this.isModalOpen = false;
if (this.is_suscriber)
this.infoMessage = 'Vous êtes maintenant abonné aux notifications de ce projet.';
else
this.infoMessage = "Vous ne recevrez plus les notifications de ce projet.";
setTimeout(function(){
this.infoMessage = '';
}.bind(this), 3000);
});
}, },
}, },
created() { created() {
...@@ -537,7 +558,7 @@ export default { ...@@ -537,7 +558,7 @@ export default {
}, },
mounted() { mounted() {
if (this.project) { if (this.project && this.permissions.can_view_project) {
this.$store.dispatch("map/INITIATE_MAP"); this.$store.dispatch("map/INITIATE_MAP");
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?output=geojson`; const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?output=geojson`;
let self = this; let self = this;
......
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