EditProjectRoles component

This commit is contained in:
richard-dds
2018-10-17 13:16:10 -04:00
parent 943ddcb5f2
commit 0a3c43576f
4 changed files with 87 additions and 2 deletions

View File

@@ -0,0 +1,58 @@
import FormMixin from '../../mixins/form'
import textinput from '../text_input'
import Selector from '../selector'
import Modal from '../../mixins/modal'
import toggler from '../toggler'
export default {
name: 'edit-environment-role',
mixins: [FormMixin, Modal],
components: {
toggler,
Modal,
Selector,
textinput
},
props: {
choices: Array,
initialData: String,
revoke: Boolean,
},
data: function () {
return {
new_role: this.initialData,
}
},
methods: {
change: function (e) {
e.preventDefault()
this.new_role = this.revoke ? "" : e.target.value
},
cancel: function () {
this.new_role = this.initialData
},
},
computed: {
displayName: function () {
for (var arr in this.choices) {
if (this.choices[arr][0] == this.new_role) {
return this.choices[arr][1].name
}
}
return this.new_role ? this.new_role : "no access"
},
label_class: function () {
return this.displayName === "no access" ?
"label" : "label label--success"
},
},
newRole: function () {
return this.revoke ? "" : this.new_role
}
}

View File

@@ -0,0 +1,23 @@
import FormMixin from '../../mixins/form'
import Modal from '../../mixins/modal'
import toggler from '../toggler'
import EditEnvironmentRole from './edit_environment_role'
export default {
name: 'edit-project-roles',
mixins: [FormMixin, Modal],
components: {
toggler,
EditEnvironmentRole,
},
props: {
name: String
},
data: function() {
return { revoke: false }
}
}