cm-admin 3.0.6 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/stylesheets/cm_admin/base/form.scss +2 -1
- data/app/views/cm_admin/roles/permissions.html.slim +35 -34
- data/lib/cm_admin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49dc645a75c337ee382e9980b395273206e2ee40351538f78464a0033910151f
|
4
|
+
data.tar.gz: a9be1c0fd8595bedfbaf5f228eedc006ed605472e79e579c617bdb2a67dfc35e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f01da5ade710831c3bb80380a950a159dd61196d61f981645f14ffe4a7f79a2067370a90c225dad5359b304128081a02d734c3187166526f244bbdd0dfa2db
|
7
|
+
data.tar.gz: 0f7da2b13d58d3438eda3dd084210420b83220651fddbc066d2dfe0a7f2f414df306348226247ae8baa6b97c0c38ca4808da681ab6b7b6e7963f0ac0467764b5
|
data/Gemfile.lock
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
z-index: 5;
|
14
14
|
}
|
15
15
|
.form-container {
|
16
|
+
margin-bottom: 24px;
|
16
17
|
.form-title {
|
17
18
|
@extend .h6, .fw-semibold;
|
18
19
|
color: $primary-text-clr;
|
@@ -32,7 +33,7 @@
|
|
32
33
|
|
33
34
|
.form-section-container {
|
34
35
|
@extend .p-4;
|
35
|
-
margin-bottom:
|
36
|
+
margin-bottom: 40px;
|
36
37
|
}
|
37
38
|
|
38
39
|
.form-submit-button-container {
|
@@ -1,38 +1,39 @@
|
|
1
|
-
.form-page.permission-form
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
.permission-form__checkbox-wrapper
|
18
|
-
- saved_permission = @ar_object.cm_permissions.where(ar_model_name: model.name)
|
19
|
-
- available_actions = model.available_actions.reject {|x| ['custom_action_modal', 'custom_action', 'create', 'update'].include?(x.name)}
|
20
|
-
- is_checked = (saved_permission.count >= available_actions.count)
|
21
|
-
input.form-check-input[type="checkbox" value="" data-behaviour="permission-check-all" checked=is_checked]
|
22
|
-
.cm-checkbox-label
|
23
|
-
span.action-name
|
24
|
-
| All
|
25
|
-
- model.available_actions.each do |action|
|
26
|
-
- permission = @ar_object.cm_permissions.where(ar_model_name: model.name, action_name: action.name).first
|
27
|
-
- unless ['custom_action_modal', 'custom_action', 'create', 'update'].include?(action.name)
|
1
|
+
.form-page.permission-form
|
2
|
+
.form-page__body
|
3
|
+
.form-container
|
4
|
+
= form_for CmPermission.new, url: cm_admin.send('cm_create_role_permission_cm_role_path', @ar_object), method: :post do |f|
|
5
|
+
- cm_models = CmAdmin.config.cm_admin_models.sort_by{|k, v| k.display_name}
|
6
|
+
.form-section-container
|
7
|
+
- cm_models.each do |model|
|
8
|
+
- next if model.override_policy == true
|
9
|
+
.row
|
10
|
+
.col.form-container
|
11
|
+
p.form-title
|
12
|
+
= model.model_name
|
13
|
+
.form-container__inner
|
14
|
+
.row
|
15
|
+
.col
|
16
|
+
.form-field.disabled
|
28
17
|
.form-check
|
29
18
|
.permission-form__checkbox-wrapper
|
30
|
-
|
19
|
+
- saved_permission = @ar_object.cm_permissions.where(ar_model_name: model.name)
|
20
|
+
- available_actions = model.available_actions.reject {|x| ['custom_action_modal', 'custom_action', 'create', 'update'].include?(x.name)}
|
21
|
+
- is_checked = (saved_permission.count >= available_actions.count)
|
22
|
+
input.form-check-input[type="checkbox" value="" data-behaviour="permission-check-all" checked=is_checked]
|
31
23
|
.cm-checkbox-label
|
32
24
|
span.action-name
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
25
|
+
| All
|
26
|
+
- model.available_actions.each do |action|
|
27
|
+
- permission = @ar_object.cm_permissions.where(ar_model_name: model.name, action_name: action.name).first
|
28
|
+
- unless ['custom_action_modal', 'custom_action', 'create', 'update'].include?(action.name)
|
29
|
+
.form-check
|
30
|
+
.permission-form__checkbox-wrapper
|
31
|
+
input.form-check-input[type="checkbox" value="#{action.name}" checked=permission.present? name="role_permission[#{model.name}][#{action.name}][is_checked]" data-behaviour="permission-check-box"]
|
32
|
+
.cm-checkbox-label
|
33
|
+
span.action-name
|
34
|
+
= action.display_name || action.name.titleize
|
35
|
+
.cm-select-tag class="#{permission.present? ? '' : 'hidden'}"
|
36
|
+
= select_tag(:policy_scope_name, options_for_select(model.policy_scopes.map{|policy_hash| [policy_hash[:display_name], policy_hash[:scope_name]]}, permission&.scope_name), {name: "role_permission[#{model.name}][#{action.name}][scope_name]", class: 'select-2', id: "policy-scope-#{model.name}-#{action.name}"})
|
37
|
+
.form-submit-button-container
|
38
|
+
= f.submit 'Save Changes', class: "btn-cta"
|
39
|
+
= link_to 'Discard', cm_admin.send('cm_index_cm_role_path'), class: "btn-secondary ml-10"
|
data/lib/cm_admin/version.rb
CHANGED