Begins checkbox logic for capability form.
This commit is contained in:
parent
b01cf7dfb5
commit
57d89a8351
|
@ -116,6 +116,7 @@
|
|||
v-if="index == editingCapability"
|
||||
class="tainacan-form"
|
||||
colspan="4">
|
||||
<template v-if="capability.roles">
|
||||
<b-field :addons="false">
|
||||
<label class="label is-inline-block">
|
||||
{{ $i18n.get('label_associated_roles') }}
|
||||
|
@ -123,18 +124,18 @@
|
|||
:title="$i18n.get('label_associated_roles')"
|
||||
:message="$i18n.get('info_associated_roles')"/>
|
||||
</label>
|
||||
<template v-if="capability.roles.length">
|
||||
<b-checkbox
|
||||
v-for="(role, roleIndex) of capability.roles"
|
||||
:key="roleIndex"
|
||||
size="is-small"
|
||||
@input="updateRole(role, index)"
|
||||
:value="role.slug"
|
||||
@input="($event) => updateRole(role.slug, index, $event)"
|
||||
name="roles">
|
||||
{{ role }}
|
||||
{{ role.name }}
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
</template>
|
||||
<p v-else>{{ $i18n.get('info_no_role_associated_capability') }}</p>
|
||||
</b-field>
|
||||
</td>
|
||||
</transition>
|
||||
</tr>
|
||||
|
@ -179,11 +180,11 @@
|
|||
else
|
||||
this.editingCapability = capabilityKey;
|
||||
},
|
||||
updateRole(role, capabilityKey) {
|
||||
if (role)
|
||||
this.disassociateCapabilityWithRole({ capability: capabilityKey, role: role })
|
||||
updateRole(role, capabilityKey, value) {
|
||||
if (value)
|
||||
this.associateCapabilityWithRole({ capabilityKey: capabilityKey, role: role })
|
||||
else
|
||||
this.disassociateCapabilityWithRole({ capability: capabilityKey, role: role })
|
||||
this.disassociateCapabilityWithRole({ capabilityKey: capabilityKey, role: role })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue