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

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

parents 783c63d0 9585aa95
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,8 @@
},
"SELECTED_GEOCODER" : {
"PROVIDER": "addok"
}
},
"DISPLAY_FORBIDDEN_PROJECTS": true,
"DISPLAY_FORBIDDEN_PROJECTS_DEFAULT": true
}
\ No newline at end of file
......@@ -232,7 +232,7 @@ export default {
...mapState('projects', [
'projects'
]),
...mapGetters( 'projects', [
...mapGetters('projects', [
'project'
]),
APPLICATION_NAME() {
......
......@@ -50,7 +50,7 @@ let onConfigLoaded = function(config){
window.proxy_url=config.VUE_APP_DJANGO_API_BASE+"proxy/";
axios.all([
store.dispatch("USER_INFO"),
store.dispatch('projects/GET_ALL_PROJECTS'),
store.dispatch('projects/GET_PROJECTS'),
store.dispatch("GET_STATIC_PAGES"),
store.dispatch("GET_USER_LEVEL_PROJECTS"),
store.dispatch("map/GET_AVAILABLE_LAYERS"),
......
......@@ -56,7 +56,7 @@ const projectAPI = {
}
},
async deleteProject(projectSlug) {
async deleteProject(baseUrl, projectSlug) {
const response = await axios.delete(
`${baseUrl}projects/${projectSlug}`
);
......
......@@ -13,7 +13,8 @@ const projects = {
filters: {
moderation: null,
access_level: null,
user_access_level: null
user_access_level: null,
accessible: null
},
searchProjectsFilter: null,
isProjectsListSearched: null,
......@@ -31,8 +32,13 @@ const projects = {
},
SET_PROJECTS(state, projects) {
state.projects = projects.results;
state.count = projects.count;
if (projects.results) {
state.projects = projects.results;
state.count = projects.count;
} else {
state.projects = projects;
state.count = projects.length;
}
},
ADD_PROJECT(state, project) {
......
......@@ -29,6 +29,20 @@
@filter="setProjectsFilters"
/>
<div
v-if="configuration.DISPLAY_FORBIDDEN_PROJECTS"
id="forbidden-projects"
class="ui toggle checkbox"
>
<input
v-model="displayForbiddenProjects"
type="checkbox"
/>
<label>
N'afficher que les projets disponibles à la consultation
</label>
</div>
<!-- LISTE DES PROJETS -->
<div v-if="projects" class="ui divided items">
<div v-for="project in projects" class="item" :key="project.slug">
......@@ -124,9 +138,16 @@ export default {
ProjectsMenu,
Pagination
},
data() {
return {
displayForbiddenProjects: false
}
},
computed: {
...mapState([
'configuration',
'user',
'USER_LEVEL_PROJECTS'
]),
......@@ -157,6 +178,32 @@ export default {
this.getData();
}
}
},
displayForbiddenProjects(newValue) {
if (newValue) {
this.SET_PROJECTS_FILTER({
filter: 'accessible',
value: 'true'
});
} else {
this.SET_PROJECTS_FILTER({
filter: 'accessible',
value: null
});
}
this.getData();
}
},
created() {
this.SET_PROJECTS_FILTER({
filter: 'accessible',
value: 'true'
});
this.displayForbiddenProjects = this.configuration.DISPLAY_FORBIDDEN_PROJECTS_DEFAULT;
if (this.$store.getters.project) {
this.$store.commit("SET_PROJECT_SLUG", null);
}
},
......@@ -194,20 +241,30 @@ export default {
setProjectsFilters(e) {
this.SET_PROJECTS_FILTER(e);
}
},
created() {
if (this.$store.getters.project) {
this.$store.commit("SET_PROJECT_SLUG", null);
}
},
},
}
};
</script>
<style scoped>
<style lang="less" scoped>
.flex {
display: flex;
justify-content: space-between;
}
#forbidden-projects.checkbox {
font-size: 1.2em;
font-weight: 600;
label {
color: rgb(94, 94, 94);
}
input:checked ~ label::before {
background-color: teal !important;
}
input:checked ~ label {
color: teal !important;
}
}
</style>
\ No newline at end of file
......@@ -1051,7 +1051,7 @@ export default {
},
deleteProject() {
projectAPI.deleteProject(this.project.slug)
projectAPI.deleteProject(this.API_BASE_URL, this.project.slug)
.then((response) => {
if (response === 'success') {
this.GET_ALL_PROJECTS();
......
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