File tree 4 files changed +31
-7
lines changed
4 files changed +31
-7
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" roles-list-view" >
3
3
<div >
4
- <div v-for =" groupName in Object.keys(objectsByGroups)" >
5
- <h4 class =" is-small has-font-weight-bold has-text-transform-upper" >{{ groupName }}</h4 >
6
- <label v-for =" role in objectsByGroups[groupName]" class =" cursor-pointer" >
7
- <input type =" checkbox" :value =" role" :disabled =" userRolePriority > role.meta.priority" v-model =" checkedRelations" />
4
+ <div
5
+ v-for =" groupName in Object.keys(objectsByGroups)"
6
+ :key =" groupName"
7
+ >
8
+ <h4 class =" is-small has-font-weight-bold has-text-transform-upper" >
9
+ {{ groupName }}
10
+ </h4 >
11
+ <label
12
+ v-for =" role in objectsByGroups[groupName]"
13
+ class =" cursor-pointer"
14
+ :key =" role.attributes.name"
15
+ >
16
+ <input
17
+ type =" checkbox"
18
+ :value =" role"
19
+ :disabled =" userRolePriority > role.meta.priority"
20
+ v-model =" checkedRelations"
21
+ >
8
22
<span >{{ getRoleLabel(role.attributes.name, role.attributes.description) }}</span >
9
23
</label >
10
24
</div >
11
25
</div >
12
26
13
27
<div class =" save-relations" >
14
- <input type =" hidden" :id =" `${relationName}addRelated`" :name =" `relations[${relationName}][addRelated]`" v-model =" relationsData" />
28
+ <input
29
+ :id =" `${relationName}addRelated`"
30
+ :name =" `relations[${relationName}][addRelated]`"
31
+ type =" hidden"
32
+ v-model =" relationsData"
33
+ >
15
34
</div >
16
35
</div >
17
36
</template >
Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ export const PaginatedContentMixin = {
74
74
requestUrl = requestUrl . replace ( 'view/relationships' , 'view/0/relationships' ) ;
75
75
}
76
76
77
+ if ( requestUrl . indexOf ( 'view/resources' ) >= 0 ) {
78
+ requestUrl = requestUrl . replace ( 'view/resources' , 'view/0/resources' ) ;
79
+ }
80
+
77
81
// if requestQueue is populated then abort all fetch request and start over
78
82
if ( this . requestsQueue . length > 0 ) {
79
83
this . requestController . abort ( ) ;
Original file line number Diff line number Diff line change 33
33
34
34
<div >
35
35
{% set rolesGroups = config(' RolesGroups' ) ? config(' RolesGroups' ) : {} %}
36
+ {% set userRoles = user and user .roles ? user .roles : [] %}
36
37
<roles -list-view
37
38
relation-name ={{ relationName }}
38
39
relation-label =" {{ Layout.tr (relationName ) }}"
39
40
:related-objects =" objects"
40
41
:groups =" {{ rolesGroups | length == 0 ? ' {}' : rolesGroups | json_encode }}"
41
- :user-roles =" {{ user . roles | default ([])| json_encode }}"
42
+ :user-roles =" {{ userRoles | default ([])| json_encode }}"
42
43
@remove-relations =" setRemovedRelated" >
43
44
</roles -list-view >
44
45
{% do Form.unlockField (' relations.' ~ relationName ~ ' .addRelated' ) %}
Original file line number Diff line number Diff line change 79
79
{{ element(' Form/custom_right' ) }}
80
80
81
81
{# if `roles` in relationships (`users` only) display custom roles element #}
82
- {% if ' roles' in object .relationships | keys %}
82
+ {% if ' roles' in object .relationships | keys or object . type == ' users ' %}
83
83
{{ element(' Form/roles' ) }}
84
84
{% endif %}
85
85
You can’t perform that action at this time.
0 commit comments