ez-permissions-ui 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77fb006981688e6b4fff3a625e42d785e75f243a39f7313e5c3b6dc7ef877ad6
4
- data.tar.gz: 1676d3636dfbb00d044eb2775a687c2b3b41a5b5844821c88398816d2c41a53b
3
+ metadata.gz: 78161fd32bbf8dff95d5c0fe28fa762b97cfd8d8035e52e07557e52bde3491c1
4
+ data.tar.gz: 9111b9832cc4b1eac6c249caa776a9e7dd08396474429f5a56b180f161e63f76
5
5
  SHA512:
6
- metadata.gz: 1cb98f3d5babe722a2f537fd7f918bbc00ad7faddb0e15b4f6b9ff9efce2545d2356834d3565fc3f4e42fa457befae768a7f755686fbafc59e16d3a4dbc2f7bd
7
- data.tar.gz: e386991e0e0bc6e6cdfa277e3e0ee912d323fbeaf55220aeae56f37e355c4c3101d6a94decc9c47f66cb07b41baa9288b3d62201659f393ee6a34c07b2f9e892
6
+ metadata.gz: 4803da33f6ea863c290939db61ee8c687968f036998e5fed8d213c202b4dac7d59320ae38f727e19ed34f126eaaad62f50bbe9000fa5ea1eb925f1d88a4e5933
7
+ data.tar.gz: 7fe24ba4b0633ecde5e924c521ef3ea7b2e95d83728d3b0177da4aaeeb0030bde5146b4cd1d068d94208e208c44b3eea72e2d950b0ae141b30fecdcd8d5d60a4
@@ -10,22 +10,24 @@
10
10
  = label_tag "grant_all", t('permissions.actions.grant_all')
11
11
 
12
12
  = form_for :permissions, url: form_url do |f|
13
- table class=(css_for 'table')
14
- thead class=(css_for 'table-thead')
15
- tr class=(css_for 'table-thead-tr')
16
- th class=(css_for 'table-thead-th') = t('permissions.fields.resource')
17
- th class=(css_for 'table-thead-th') = t('permissions.fields.all')
18
- - actions_names.each do |action_name|
19
- th class=(css_for 'table-thead-th') = action_name.humanize
20
- tbody class=(css_for 'table-tbody')
21
- - resources_names.each do |resource_name|
22
- tr class=(css_for 'table-tbody-tr') id=("resource-#{resource_name}")
23
- td class=(css_for 'table-tbody-td-name') style="width: 70%" = resource_name.humanize
24
- td class=(css_for 'table-tbody-td-action') id=("permission-#{resource_name}-all")
25
- = check_box_tag "all_permissions[]", "all-permission-#{resource_name}", all_granted?(resource_name), class: 'toggle-all-resource-actions', id: "permission-checkbox-#{resource_name}"
13
+ - group_names.each do |group|
14
+ br
15
+ table class=(css_for 'table')
16
+ thead class=(css_for 'table-thead')
17
+ tr class=(css_for 'table-thead-tr')
18
+ th class=(css_for 'table-thead-th') = group.to_s.humanize.presence
19
+ th class=(css_for 'table-thead-th') = t('permissions.fields.all')
26
20
  - actions_names.each do |action_name|
27
- td class=(css_for 'table-tbody-td-action') id=("permission-#{resource_name}-#{action_name}")
28
- = permission_checkbox(resource_name, action_name)
21
+ th class=(css_for 'table-thead-th') = action_name.humanize
22
+ tbody class=(css_for 'table-tbody')
23
+ - resources_names.select { |r| groups[group].map(&:name).include?(r.to_sym) }.each do |resource_name|
24
+ tr class=(css_for 'table-tbody-tr') id=("resource-#{resource_name}")
25
+ td class=(css_for 'table-tbody-td-name') style="width: 70%" = resource_name.humanize
26
+ td class=(css_for 'table-tbody-td-action') id=("permission-#{resource_name}-all")
27
+ = check_box_tag "all_permissions[]", "all-permission-#{resource_name}", all_granted?(resource_name), class: 'toggle-all-resource-actions', id: "permission-checkbox-#{resource_name}"
28
+ - actions_names.each do |action_name|
29
+ td class=(css_for 'table-tbody-td-action') id=("permission-#{resource_name}-#{action_name}")
30
+ = permission_checkbox(resource_name, action_name)
29
31
 
30
32
 
31
33
  = f.submit t('permissions.actions.update'), class: css_for('permissions-submit-button')
@@ -8,6 +8,14 @@ module Ez
8
8
 
9
9
  form
10
10
 
11
+ def groups
12
+ @groups ||= Ez::Permissions::DSL.resources.group_by(&:group)
13
+ end
14
+
15
+ def group_names
16
+ @group_names ||= groups.keys.compact.map(&:to_s).sort.map(&:to_sym)
17
+ end
18
+
11
19
  def actions_names
12
20
  @actions_names ||= permissions_actions
13
21
  .map(&:action)
@@ -3,7 +3,7 @@
3
3
  module Ez
4
4
  module Permissions
5
5
  module UI
6
- VERSION = '0.4.1'
6
+ VERSION = '0.4.3'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez-permissions-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volodya Sveredyuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-24 00:00:00.000000000 Z
11
+ date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ez-permissions
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.1
19
+ version: 0.4.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.1
26
+ version: 0.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cells-rails
29
29
  requirement: !ruby/object:Gem::Requirement