rao-resources_controller 0.0.42.pre → 0.0.43.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concerns/rao/resources_controller/aasm_concern.rb +30 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d458ba14cebf204d6eea9d9b16d831e64a974a9435fe45c9fc9e554074973461
|
4
|
+
data.tar.gz: c2abe900f2fec8f00ffc78c1c849bd12f330f64c02c706acc95a784ca2117a74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 321c82d515d3b7bfb1795110f3004c04075bed4e543c8c996cd5934ab60c3b3b6373c070cd87fbd9e08476c666e4f14929bdcc470b59aeae446a7b513f6dbc2a
|
7
|
+
data.tar.gz: b7a50cd744a65dfcc61f76b4a126763eb409d9c6f20f217a1ccc829b38c52b561c4d18996d9ad9540df17301ee84f8df61311862780e1a18e66ecdb5f6188738
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Rao
|
2
|
+
module ResourcesController
|
3
|
+
module AasmConcern
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
before_action :load_resource_for_trigger_event, only: [:trigger_event]
|
8
|
+
end
|
9
|
+
|
10
|
+
def trigger_event
|
11
|
+
if @resource.aasm(permitted_params_for_trigger_event[:machine_name].to_sym).fire!(permitted_params_for_trigger_event[:event_name].to_sym)
|
12
|
+
flash[:notice] = t('controller.aasm_concern.trigger_event.success', state: @resource.aasm(permitted_params_for_trigger_event[:machine_name].to_sym).current_state, event: permitted_params_for_trigger_event[:event_name])
|
13
|
+
else
|
14
|
+
flash[:notice] = t('controller.aasm_concern.trigger_event.failure', state: @resource.aasm(permitted_params_for_trigger_event[:machine_name].to_sym).current_state, event: permitted_params_for_trigger_event[:event_name])
|
15
|
+
end
|
16
|
+
redirect_back(fallback_location: root_path)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def permitted_params_for_trigger_event
|
22
|
+
params.permit!
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_resource_for_trigger_event
|
26
|
+
load_resource
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rao-resources_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.43.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- README.md
|
148
148
|
- Rakefile
|
149
149
|
- app/concerns/rao/controller/autosubmit_concern.rb
|
150
|
+
- app/concerns/rao/resources_controller/aasm_concern.rb
|
150
151
|
- app/concerns/rao/resources_controller/acts_as_list_concern.rb
|
151
152
|
- app/concerns/rao/resources_controller/acts_as_published_concern.rb
|
152
153
|
- app/concerns/rao/resources_controller/awesome_nested_set_concern.rb
|
@@ -209,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
210
|
- !ruby/object:Gem::Version
|
210
211
|
version: 1.3.1
|
211
212
|
requirements: []
|
212
|
-
rubygems_version: 3.1.
|
213
|
+
rubygems_version: 3.1.4
|
213
214
|
signing_key:
|
214
215
|
specification_version: 4
|
215
216
|
summary: Resources Controllers for Ruby on Rails.
|