effective_resources 0.6.5 → 0.6.6

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
  SHA1:
3
- metadata.gz: 3a87b01a9c51ff1343a94289520ae4eefa1a7945
4
- data.tar.gz: 0ffe44c2a4fe358869fdc11a53c5c18af9ad1da3
3
+ metadata.gz: de07d91667dae627d9daa3ba2845183b8198b358
4
+ data.tar.gz: eaf9018db22cd67c3be329ca8efae1ca7b2746d8
5
5
  SHA512:
6
- metadata.gz: 4fec545b778f1f190adaa1825a4efc98505d7e53f86c4ca5480b2ac959b7f3000d058fb92cb131f00e7d91ef442774afb2074f0801e84a09649e77610e68f032
7
- data.tar.gz: d8b42dd69ee0533a69f510c76506a527fab95c7aa8f49cf3a309c8fb1506f7aebb5fb6d273c98b8ff7f653d0bb68fadb0dd86f14e66c658cbf3cb855c1b89053
6
+ metadata.gz: cf67c6412c21180e8eb7d9d65532f33331e363491339bc7dd35bed0948447a0227c5873e74f9ec3992d4b51d0b567ed1f9f5fef32b7b0fb8f97b69832aff74fb
7
+ data.tar.gz: 32690b451edd5997a6d84c1ed6ce46288b395edad831d65184ce783b2afbcb69e68aae8bfbe50bddb1086f100db2fcc48fea0d9f178b9a31b486a426a19d733b
@@ -12,9 +12,19 @@ module Effective
12
12
  }
13
13
  end
14
14
  end
15
+
16
+ define_callbacks :resource_render
15
17
  end
16
18
 
17
19
  module ClassMethods
20
+
21
+ # https://github.com/rails/rails/blob/v5.1.4/actionpack/lib/abstract_controller/callbacks.rb
22
+ def before_render(*names, &blk)
23
+ _insert_callbacks(names, blk) do |name, options|
24
+ set_callback(:resource_render, :before, name, options)
25
+ end
26
+ end
27
+
18
28
  # Add the following to your controller for a simple member action
19
29
  # member_action :print
20
30
  #
@@ -118,6 +128,8 @@ module Effective
118
128
  if resource_datatable_class
119
129
  @datatable ||= resource_datatable_class.new(self, resource_datatable_attributes)
120
130
  end
131
+
132
+ run_callbacks(:resource_render)
121
133
  end
122
134
 
123
135
  def new
@@ -129,6 +141,8 @@ module Effective
129
141
 
130
142
  @page_title ||= "New #{resource_name.titleize}"
131
143
  EffectiveResources.authorized?(self, :new, resource)
144
+
145
+ run_callbacks(:resource_render)
132
146
  end
133
147
 
134
148
  def create
@@ -157,6 +171,8 @@ module Effective
157
171
 
158
172
  @page_title ||= resource.to_s
159
173
  EffectiveResources.authorized?(self, :show, resource)
174
+
175
+ run_callbacks(:resource_render)
160
176
  end
161
177
 
162
178
  def edit
@@ -164,6 +180,8 @@ module Effective
164
180
 
165
181
  @page_title ||= "Edit #{resource}"
166
182
  EffectiveResources.authorized?(self, :edit, resource)
183
+
184
+ run_callbacks(:resource_render)
167
185
  end
168
186
 
169
187
  def update
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '0.6.5'.freeze
2
+ VERSION = '0.6.6'.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: 0.6.5
4
+ version: 0.6.6
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: 2017-10-30 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails