ez-permissions-ui 0.4.3 → 0.4.4

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: 78161fd32bbf8dff95d5c0fe28fa762b97cfd8d8035e52e07557e52bde3491c1
4
- data.tar.gz: 9111b9832cc4b1eac6c249caa776a9e7dd08396474429f5a56b180f161e63f76
3
+ metadata.gz: 6494854d1be39d0a937be37cd761aadedd8e7eb78041d33390fdc24b019cacee
4
+ data.tar.gz: 669177bb4d51df4c3f3e39a6949d1dcc6ac6bf5022f4abd211d20b7fa385e853
5
5
  SHA512:
6
- metadata.gz: 4803da33f6ea863c290939db61ee8c687968f036998e5fed8d213c202b4dac7d59320ae38f727e19ed34f126eaaad62f50bbe9000fa5ea1eb925f1d88a4e5933
7
- data.tar.gz: 7fe24ba4b0633ecde5e924c521ef3ea7b2e95d83728d3b0177da4aaeeb0030bde5146b4cd1d068d94208e208c44b3eea72e2d950b0ae141b30fecdcd8d5d60a4
6
+ metadata.gz: 3d0ff495e35e0aafc271e742d1a27bccf249c664c5e247435c434c5b354ea9e84227d327667563bb115aa70b9edf78d0e4721f315560f1c62a6471b30a579531
7
+ data.tar.gz: 43fb10206d5c58e8ac50fca467a512d662c56c28a59efdac403610aa9ec7329bf01859829395ee2142feda20c7cfcf1ae00b715ad05e4e6389e5e80865de7028
@@ -16,18 +16,21 @@
16
16
  thead class=(css_for 'table-thead')
17
17
  tr class=(css_for 'table-thead-tr')
18
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')
20
- - actions_names.each do |action_name|
21
- th class=(css_for 'table-thead-th') = action_name.humanize
19
+ th class=(css_for 'table-thead-th')
20
+ th class=(css_for 'table-thead-th')
22
21
  tbody class=(css_for 'table-tbody')
23
22
  - resources_names.select { |r| groups[group].map(&:name).include?(r.to_sym) }.each do |resource_name|
24
23
  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)
24
+ td class=(css_for 'table-tbody-td-name') style="width: 30%" = resource_name.humanize
25
+ td class=(css_for 'table-tbody-td-action') style="width: 10%" id=("permission-#{resource_name}-all")
26
+ = div_for 'table-permission-check'
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
+ = label_tag "permission-checkbox-#{resource_name}", t('permissions.fields.all')
29
+ td class=(css_for 'table-tbody-td-action')
30
+ - actions_names.sort.each do |action_name|
31
+ = div_for 'table-permission-check'
32
+ = permission_checkbox(resource_name, action_name)
33
+ = permissions_label(resource_name, action_name)
31
34
 
32
35
 
33
36
  = f.submit t('permissions.actions.update'), class: css_for('permissions-submit-button')
@@ -58,6 +58,14 @@ module Ez
58
58
  id: "permission-checkbox-#{resource_name}-#{action_name}"
59
59
  end
60
60
 
61
+ def permissions_label(resource_name, action_name)
62
+ permission_id = permission_id(resource_name, action_name)
63
+
64
+ return unless permission_id
65
+
66
+ label_tag "permission-checkbox-#{resource_name}-#{action_name}", action_name.humanize
67
+ end
68
+
61
69
  def all_granted?(resource_name = nil)
62
70
  if resource_name
63
71
  role_permissions.select { |p| p.resource == resource_name }.size ==
@@ -3,7 +3,7 @@
3
3
  module Ez
4
4
  module Permissions
5
5
  module UI
6
- VERSION = '0.4.3'
6
+ VERSION = '0.4.4'
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.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volodya Sveredyuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ez-permissions
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  - !ruby/object:Gem::Version
273
273
  version: '0'
274
274
  requirements: []
275
- rubygems_version: 3.0.3
275
+ rubygems_version: 3.1.2
276
276
  signing_key:
277
277
  specification_version: 4
278
278
  summary: UI extension for ez-permissions.