effective_resources 0.8.22 → 0.8.23
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 +4 -4
- data/README.md +7 -0
- data/app/controllers/concerns/effective/crud_controller.rb +19 -18
- data/app/controllers/concerns/effective/flash_messages.rb +3 -1
- data/app/models/effective/resources/relation.rb +1 -1
- data/app/views/application/destroy.js.erb +1 -5
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2351c882edaa8001b94935acbca780edc8ab05e7
|
4
|
+
data.tar.gz: 75f007247f863e9b558cea41b4e43cff121e1e18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63101f42de0d3bbd16e50a7b62620021e5894bad5872cd749764b44ba948c9bcee859e5a8e0cacce49486d82b950d6aea57aff2223f0c72e4ffe61823d268d6a
|
7
|
+
data.tar.gz: 50d7e165820db6cdd024f375c1b7a87549e6dd327a06b937ff625bda4fdc4fc4f34dca9d6e51619150fa93348609c922af2fd11639fc2a1bf40556081352634e
|
data/README.md
CHANGED
@@ -175,6 +175,13 @@ to render just the `Save` button, with appropriate data-disable, title, etc.
|
|
175
175
|
= f.save 'Will be appended'
|
176
176
|
```
|
177
177
|
|
178
|
+
### Remote Delete will automatically fade out the closest match
|
179
|
+
|
180
|
+
```
|
181
|
+
= link_to 'Delete', post_path(post), remote: true,
|
182
|
+
data: { confirm: "Really delete #{post}?", method: :delete, closest: '.post' }
|
183
|
+
```
|
184
|
+
|
178
185
|
### acts_as_tokened
|
179
186
|
|
180
187
|
Quickly adds rails 5 `has_secure_token` to your model, along with some `Post.find()` enhancements to work with tokens instead of IDs.
|
@@ -157,7 +157,7 @@ module Effective
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def index
|
160
|
-
Rails.logger.info '
|
160
|
+
Rails.logger.info 'Processed by Effective::CrudController#index'
|
161
161
|
|
162
162
|
@page_title ||= resource_plural_name.titleize
|
163
163
|
EffectiveResources.authorize!(self, :index, resource_klass)
|
@@ -173,7 +173,7 @@ module Effective
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def new
|
176
|
-
Rails.logger.info '
|
176
|
+
Rails.logger.info 'Processed by Effective::CrudController#new'
|
177
177
|
|
178
178
|
self.resource ||= resource_scope.new
|
179
179
|
|
@@ -201,7 +201,7 @@ module Effective
|
|
201
201
|
end
|
202
202
|
|
203
203
|
def create
|
204
|
-
Rails.logger.info '
|
204
|
+
Rails.logger.info 'Processed by Effective::CrudController#create'
|
205
205
|
|
206
206
|
self.resource ||= resource_scope.new
|
207
207
|
|
@@ -239,7 +239,7 @@ module Effective
|
|
239
239
|
end
|
240
240
|
|
241
241
|
def show
|
242
|
-
Rails.logger.info '
|
242
|
+
Rails.logger.info 'Processed by Effective::CrudController#show'
|
243
243
|
|
244
244
|
self.resource ||= resource_scope.find(params[:id])
|
245
245
|
|
@@ -250,7 +250,7 @@ module Effective
|
|
250
250
|
end
|
251
251
|
|
252
252
|
def edit
|
253
|
-
Rails.logger.info '
|
253
|
+
Rails.logger.info 'Processed by Effective::CrudController#edit'
|
254
254
|
|
255
255
|
self.resource ||= resource_scope.find(params[:id])
|
256
256
|
|
@@ -261,7 +261,7 @@ module Effective
|
|
261
261
|
end
|
262
262
|
|
263
263
|
def update
|
264
|
-
Rails.logger.info '
|
264
|
+
Rails.logger.info 'Processed by Effective::CrudController#update'
|
265
265
|
|
266
266
|
self.resource ||= resource_scope.find(params[:id])
|
267
267
|
|
@@ -297,7 +297,7 @@ module Effective
|
|
297
297
|
end
|
298
298
|
|
299
299
|
def destroy
|
300
|
-
Rails.logger.info '
|
300
|
+
Rails.logger.info 'Processed by Effective::CrudController#destroy'
|
301
301
|
|
302
302
|
self.resource = resource_scope.find(params[:id])
|
303
303
|
|
@@ -307,7 +307,7 @@ module Effective
|
|
307
307
|
|
308
308
|
respond_to do |format|
|
309
309
|
if save_resource(resource, action)
|
310
|
-
request.format = :html if specific_redirect_path?
|
310
|
+
request.format = :html if specific_redirect_path?(action)
|
311
311
|
|
312
312
|
format.html do
|
313
313
|
flash[:success] ||= resource_flash(:success, resource, action)
|
@@ -320,16 +320,13 @@ module Effective
|
|
320
320
|
end
|
321
321
|
else
|
322
322
|
flash.delete(:success)
|
323
|
+
request.format = :html # Don't run destroy.js.erb
|
323
324
|
|
324
325
|
format.html do
|
325
326
|
flash[:danger] = (flash.now[:danger].presence || resource_flash(:danger, resource, action))
|
326
327
|
redirect_to(resource_redirect_path(action))
|
327
328
|
end
|
328
329
|
|
329
|
-
format.js do
|
330
|
-
flash.now[:danger] ||= resource_flash(:danger, resource, action)
|
331
|
-
# destroy.js.erb
|
332
|
-
end
|
333
330
|
end
|
334
331
|
end
|
335
332
|
end
|
@@ -339,7 +336,7 @@ module Effective
|
|
339
336
|
|
340
337
|
respond_to do |format|
|
341
338
|
if save_resource(resource, action, (send(resource_params_method_name) rescue {}))
|
342
|
-
request.format = :html if specific_redirect_path?
|
339
|
+
request.format = :html if specific_redirect_path?(action)
|
343
340
|
|
344
341
|
format.html do
|
345
342
|
flash[:success] ||= resource_flash(:success, resource, action)
|
@@ -579,11 +576,15 @@ module Effective
|
|
579
576
|
|
580
577
|
# Based on the incoming params[:commit] or passed action
|
581
578
|
def commit_action(action = nil)
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
579
|
+
if action.present?
|
580
|
+
self.class.submits[action.to_s] ||
|
581
|
+
self.class.submits.find { |_, v| v[:action] == action }.try(:last) ||
|
582
|
+
{ action: action }
|
583
|
+
else # Get the current commit
|
584
|
+
self.class.submits[params[:commit].to_s] ||
|
585
|
+
self.class.submits.find { |_, v| v[:action] == :save }.try(:last) ||
|
586
|
+
{ action: :save }
|
587
|
+
end
|
587
588
|
end
|
588
589
|
|
589
590
|
def specific_redirect_path?(action = nil)
|
@@ -47,10 +47,12 @@ module Effective
|
|
47
47
|
|
48
48
|
def action_verb(action)
|
49
49
|
action = action.to_s.gsub('_', ' ')
|
50
|
-
word = action.split(' ').first
|
50
|
+
word = action.split(' ').first.to_s
|
51
51
|
|
52
52
|
if word.end_with?('e')
|
53
53
|
action.sub(word, word + 'd')
|
54
|
+
elsif ['a', 'i', 'o', 'u', 'y'].include?(word[-1])
|
55
|
+
action
|
54
56
|
else
|
55
57
|
action.sub(word, word + 'ed')
|
56
58
|
end
|
@@ -1,5 +1 @@
|
|
1
|
-
|
2
|
-
<% @resource = instance_variable_get('@' + resource.name) if resource.name %>
|
3
|
-
|
4
|
-
EffectiveForm.remote_form_payload = "<%= j render_resource_form(resource) %>";
|
5
|
-
EffectiveForm.remote_form_flash = <%= raw flash.to_json %>;
|
1
|
+
EffectiveForm.finishDelete();
|
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.8.
|
4
|
+
version: 0.8.23
|
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: 2018-06-
|
11
|
+
date: 2018-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|