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

Merge branch 'REDMINE-ISSUES/12411v3' into 'develop'

REDMINE_ISSUES-12411

See merge request !184
parents b427f403 8f56ec93
No related branches found
No related tags found
No related merge requests found
......@@ -128,7 +128,7 @@
>Visibilité des signalements publiés</label
>
<Dropdown
:options="levelPermissions"
:options="levelPermissionsPub"
:selected="form.access_level_pub_feature.name"
:selection.sync="form.access_level_pub_feature"
/>
......@@ -259,18 +259,37 @@ export default {
},
levelPermissions(){
let self = this;
let levels = []
this.levelsPermissions.map(function(item) {
if (item.user_type_id != "super_contributor")
levels.push({
'name': self.traslateRoleToFrench(item.user_type_id),
'value': item.user_type_id,
})
if (!self.form.moderation && item.user_type_id == "moderator"){
levels.pop()
let levels = new Array();
if(self.levelsPermissions){
self.levelsPermissions.map(function(item) {
if (item.user_type_id != "super_contributor")
levels.push({
'name': self.traslateRoleToFrench(item.user_type_id),
'value': item.user_type_id,
})
if (!self.form.moderation && item.user_type_id == "moderator"){
levels.pop()
}
});
}
return levels;
},
levelPermissionsPub(){
let self = this;
let levels = new Array();
if(self.levelsPermissions){
self.levelsPermissions.map(function(item) {
if (item.user_type_id != "super_contributor"
&& item.user_type_id != "admin"
&& item.user_type_id != "moderator"){
levels.push({
'name': self.traslateRoleToFrench(item.user_type_id),
'value': item.user_type_id,
})
}
});
return levels
}
return levels;
}
},
......@@ -286,7 +305,7 @@ export default {
},
traslateRoleToFrench(role){
if (role == "admin") return "Administrateur de projet";
if (role == "admin") return "Administrateur projet";
if (role == "moderator") return "Modérateur";
if (role == "contributor") return "Contributeur";
if (role == "logged_user") return "Utilisateur connecté";
......@@ -494,27 +513,38 @@ export default {
this.form.is_project_type = false;
}
//* transform string values to objects for dropdowns display (could be in a computed)
this.form.access_level_pub_feature = {
name: this.project.access_level_pub_feature,
value: this.levelPermissions.find(
(el) => el.name === this.project.access_level_pub_feature
).value,
};
this.form.access_level_arch_feature = {
name: this.project.access_level_arch_feature,
value: this.levelPermissions.find(
(el) => el.name === this.project.access_level_arch_feature
).value,
};
if(this.levelPermissionsPub){
let value = {}
value = this.levelPermissionsPub.find(
(el) => el.name === this.project.access_level_pub_feature
)
if(value){
this.form.access_level_pub_feature = {
name: this.project.access_level_pub_feature,
value: value.value ,
};
}
}
if(this.levelPermissions){
let value = {}
value = this.levelPermissions.find(
(el) => el.name === this.project.access_level_arch_feature
)
if(value){
this.form.access_level_arch_feature = {
name: this.project.access_level_arch_feature,
value: value.value ,
};
}
}
},
},
watch: {
'form.moderation': function (newValue){
if(newValue){
this.form.access_level_pub_feature = { name: "", value: "" };
this.form.access_level_arch_feature = { name: "", value: "" };
}
if(!newValue){
this.form.access_level_pub_feature = { name: "", value: "" };
this.form.access_level_arch_feature = { name: "", value: "" };
}
}
},
created() {
......
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