cm-admin 0.5.8 → 0.6.1

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: 66abe7aa4429da591b8c42766dce265104e59e7807c8ff52de628b7932768379
4
- data.tar.gz: 35af15138ef79c97af5446e40e04f9008bbeca657dc6781396a5eba2c4314256
3
+ metadata.gz: 2e28d75f3c079c84bbf3e36a395b277390810ae103b87f2678b15c5c12210257
4
+ data.tar.gz: f207f2665af3246e6f285c626dcfc23bd2f6160b893e665311e4e0babf42f919
5
5
  SHA512:
6
- metadata.gz: 8e532c2897602d9d5b83cc609bc6382d9a5aae1928d7f1b77a6d612dba8b329f29b3f6f4a12a366e462ebef819bc46e1c8726498798c7cce9a4103f866a4ecc0
7
- data.tar.gz: dbbc22f148540d5b1f0370d41ceece55490069810960a903247245bf0896e00d5c1cfc3b46680e80b22a7103016c6cafd8cbf91bcbb36a9cd9b1bb5075c29357
6
+ metadata.gz: 2c1834f17fa138e419d25cd20140ee6e9b78594a3ce8d37f1834eb113f9e88def0b9532b09e3d4c0f0c3e5d1334ddb88d298274b4e70e12779d9e349732d215e
7
+ data.tar.gz: 0e2781411e73d8ba757462451992f65292a47bb9d9042546a0b70486e7d38e6a60209bf4130ca08d47dc6617ecec75558f15f586c21c90187d998ba9ec74f699
@@ -43,13 +43,14 @@
43
43
  span
44
44
  i.fa.fa-angle-down
45
45
  .popup-card.table-export-popup.hidden
46
- - if edit_action.any?
46
+ - if edit_action.any? && policy([:cm_admin, @model.name.classify.constantize]).edit?
47
47
  = link_to "#{page_url('edit', ar_object)}" do
48
48
  .popup-option Edit
49
49
  - custom_actions.each do |custom_action|
50
- - if custom_action.display_if.call(ar_object)
51
- = link_to custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb do
52
- .popup-option = custom_action.name.titleize
50
+ - if custom_action.name.present? && policy([:cm_admin, @model.name.classify.constantize]).send(:"#{custom_action.name}?")
51
+ - if custom_action.display_if.call(ar_object)
52
+ = link_to custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb do
53
+ .popup-option = custom_action.name.titleize
53
54
 
54
55
  .cm-pagination
55
56
  .cm-pagination__lhs Showing #{@ar_object.pagy.from} to #{@ar_object.pagy.to} out of #{@ar_object.pagy.count}
@@ -1,6 +1,6 @@
1
1
  ul.nav.nav-pills
2
2
  - @model.available_tabs.each do |nav_item|
3
- - if policy([:cm_admin, @model.name.classify.constantize]).send(:"#{nav_item.custom_action}?")
3
+ - if nav_item.custom_action.present? && policy([:cm_admin, @model.name.classify.constantize]).send(:"#{nav_item.custom_action}?")
4
4
  li.nav-item
5
5
  - nav_item_action_name = nav_item.custom_action.present? ? nav_item.custom_action : 'show'
6
6
  = link_to nav_item.nav_item_name.to_s.titleize, "/cm_admin/#{@model.name.underscore.pluralize}/#{@ar_object.id}/#{nav_item.custom_action}", class: "nav-link #{ nav_item_action_name == action_name ? 'active' : ''}"
@@ -21,20 +21,22 @@
21
21
  .popup-option.pointer data-bs-toggle='modal' data-bs-target='#exportmodal'
22
22
  span Export
23
23
  - new_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('new')}
24
- - if new_action.any?
24
+ - if new_action.any? && policy([:cm_admin, @model.name.classify.constantize]).new?
25
25
  = link_to 'Add', "#{page_url('new')}", class: 'primary-btn ml-2'
26
26
  - @model.available_actions.select{|act| act if act.route_type == 'collection'}.each do |custom_action|
27
- - if custom_action.display_type == :button
28
- = link_to custom_action.name.titleize, @model.ar_model.table_name + '/' + custom_action.path, class: 'primary-btn ml-2', method: custom_action.verb
29
- - elsif custom_action.display_type == :modal
30
- = link_to custom_action.name.titleize, '', class: 'primary-btn ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
27
+ - if custom_action.name.present? && policy([:cm_admin, @model.name.classify.constantize]).send(:"#{custom_action.name}?")
28
+ - if custom_action.display_type == :button
29
+ = link_to custom_action.name.titleize, @model.ar_model.table_name + '/' + custom_action.path, class: 'primary-btn ml-2', method: custom_action.verb
30
+ - elsif custom_action.display_type == :modal
31
+ = link_to custom_action.name.titleize, '', class: 'primary-btn ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
31
32
  - elsif @model.current_action.name == 'show'
32
33
  - @model.available_actions.select{|act| act if act.route_type == 'member'}.each do |custom_action|
33
- - if custom_action.display_type == :button && custom_action.display_if.call(@ar_object)
34
- = link_to custom_action.name.titleize, custom_action.path.gsub(':id', params[:id]), class: 'primary-btn ml-2', method: custom_action.verb
35
- - elsif custom_action.display_type == :modal && custom_action.display_if.call(@ar_object)
36
- = link_to custom_action.name.titleize, '', class: 'primary-btn ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
34
+ - if custom_action.name.present? && policy([:cm_admin, @model.name.classify.constantize]).send(:"#{custom_action.name}?")
35
+ - if custom_action.display_type == :button && custom_action.display_if.call(@ar_object)
36
+ = link_to custom_action.name.titleize, custom_action.path.gsub(':id', params[:id]), class: 'primary-btn ml-2', method: custom_action.verb
37
+ - elsif custom_action.display_type == :modal && custom_action.display_if.call(@ar_object)
38
+ = link_to custom_action.name.titleize, '', class: 'primary-btn ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
37
39
 
38
40
  - edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
39
- - if edit_action.any?
41
+ - if edit_action.any? && policy([:cm_admin, @model.name.classify.constantize]).edit?
40
42
  = link_to "Edit #{@model.name}", "#{page_url('edit', @ar_object)}", class: 'primary-btn ml-2'
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = "0.5.8"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cm-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sajinmp
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-03-24 00:00:00.000000000 Z
13
+ date: 2022-03-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pagy