effective_resources 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e01b50384fc2d41b95913769c539276b592257b4f36109917a02afe5a74a8584
4
- data.tar.gz: 005a5676dca6e1d0e14a19ad96f31d834a85fdec527514bc75b86d040b3ed2f0
3
+ metadata.gz: 2b4cbe9d018c7ea4cb40727d321530ba562c0ca873bea3c7e82492cd7d518b64
4
+ data.tar.gz: f1249c47c44c4095c30441aa636746f298c8591585e14ac948391693ea98cec5
5
5
  SHA512:
6
- metadata.gz: 0d135e3a5f848c0ee8f40d89e5412a4576fdd4e25068cd5df6ee3d01d3901db36f10c034376dc9bc253cc0f7aebbdce242cebca9c988e8a2bb315621aee80f80
7
- data.tar.gz: c7808cfa20c0b8c7b256a0dc5d46ba0b39bf6c638d1200820cd93c50228b8c456b77f9adbe34039825c6e0a00dc5312b6da4ab51a464769ac8b11f91393dcd78
6
+ metadata.gz: 1b6ae58c5d781ff5ad6378ad6df6f8f5388dd33213fa57c1d2ea902b593d72088e60dbb551fd5185acd442354803c02383b53d7414304ea53740e6c0db5c9d74
7
+ data.tar.gz: 2df964ebabaa075f388d96ad5e78f9a5d5b27a2071b5320a4f1593fdb882fd717491ddc3ca66a84d027952ed4638f3fa817f48869a2d2d4c4870b831741f3d3f
@@ -31,22 +31,26 @@ module Effective
31
31
  end
32
32
 
33
33
  (member_post_actions - crud_actions).each do |action| # default true means it will be overwritten by dsl methods
34
- buttons[action.to_s.titleize] = case action
34
+ action_name = action.to_s.titleize
35
+
36
+ buttons[action_name] = case action
35
37
  when :archive
36
- { action: action, default: true, if: -> { !resource.archived? }, class: 'btn btn-danger', 'data-method' => :post, 'data-confirm' => "Really #{action} @resource?"}
38
+ { action: action, default: true, if: -> { !resource.archived? }, class: 'btn btn-danger', 'data-method' => :post, 'data-confirm' => "Really #{action_name} @resource?"}
37
39
  when :unarchive
38
- { action: action, default: true, if: -> { resource.archived? }, 'data-method' => :post, 'data-confirm' => "Really #{action} @resource?" }
40
+ { action: action, default: true, if: -> { resource.archived? }, 'data-method' => :post, 'data-confirm' => "Really #{action_name} @resource?" }
39
41
  else
40
- { action: action, default: true, 'data-method' => :post, 'data-confirm' => "Really #{action} @resource?"}
42
+ { action: action, default: true, 'data-method' => :post, 'data-confirm' => "Really #{action_name} @resource?"}
41
43
  end
42
44
  end
43
45
 
44
46
  member_delete_actions.each do |action|
47
+ action_name = action.to_s.titleize
48
+
45
49
  if action == :destroy
46
50
  next if buttons.values.find { |v| v[:action] == :archive }.present?
47
51
  buttons['Delete'] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really delete @resource?" }
48
52
  else
49
- buttons[action.to_s.titleize] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really #{action} @resource?" }
53
+ buttons[action_name] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really #{action_name} @resource?" }
50
54
  end
51
55
  end
52
56
 
@@ -81,24 +85,26 @@ module Effective
81
85
  member_post_actions.each do |action|
82
86
  next if crud_actions.include?(action)
83
87
 
84
- actions[action.to_s.titleize] = { action: action, default: true, 'data-method' => :post, 'data-confirm' => "Really #{action} @resource?" }
88
+ action_name = action.to_s.titleize
85
89
 
86
- actions[action.to_s.titleize] = case action
90
+ actions[action_name] = case action
87
91
  when :archive
88
- { action: action, default: true, if: -> { !resource.archived? }, class: 'btn btn-danger', 'data-method' => :post, 'data-confirm' => "Really #{action} @resource?"}
92
+ { action: action, default: true, if: -> { !resource.archived? }, class: 'btn btn-danger', 'data-method' => :post, 'data-confirm' => "Really #{action_name} @resource?"}
89
93
  when :unarchive
90
- { action: action, default: true, if: -> { resource.archived? }, 'data-method' => :post, 'data-confirm' => "Really #{action} @resource?" }
94
+ { action: action, default: true, if: -> { resource.archived? }, 'data-method' => :post, 'data-confirm' => "Really #{action_name} @resource?" }
91
95
  else
92
- { action: action, default: true, 'data-method' => :post, 'data-confirm' => "Really #{action} @resource?" }
96
+ { action: action, default: true, 'data-method' => :post, 'data-confirm' => "Really #{action_name} @resource?" }
93
97
  end
94
98
  end
95
99
 
96
100
  member_delete_actions.each do |action|
101
+ action_name = action.to_s.titleize
102
+
97
103
  if action == :destroy
98
104
  next if actions.find { |_, v| v[:action] == :archive }.present?
99
105
  actions['Delete'] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really delete @resource?" }
100
106
  else
101
- actions[action.to_s.titleize] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really #{action} @resource?" }
107
+ actions[action_name] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really #{action_name} @resource?" }
102
108
  end
103
109
  end
104
110
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.5.3'.freeze
2
+ VERSION = '1.5.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-18 00:00:00.000000000 Z
11
+ date: 2020-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails