rao-resources_controller 0.0.38.pre → 0.0.43.pre

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: fa8fb0bde025e6f254edd55f8907fcbc15f32c2ca30b8ef6229f1615c0eb3f06
4
- data.tar.gz: 76c78f1bb6d73fc2e9ffad3eb249ab566808084acc80258f480a6687d5afd669
3
+ metadata.gz: d458ba14cebf204d6eea9d9b16d831e64a974a9435fe45c9fc9e554074973461
4
+ data.tar.gz: c2abe900f2fec8f00ffc78c1c849bd12f330f64c02c706acc95a784ca2117a74
5
5
  SHA512:
6
- metadata.gz: 19cfcf313f3899b814f1f5876aa3d5631ab3ffa6ee20753b7a44ed1b870429c5541cb12776fd6b4dbedaee1c6befb6bbbe353d408c7de1cdfca3de5f30d9726c
7
- data.tar.gz: 6802f9532edfc00d8b7f92a394d262ddde29a1622c4f0db642abc392e8e7d82eaf40a6ecfb3a8af865ae357a7f0fbbb6a3190f5c83387db22d0324722335db1a
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.38.pre
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: 2019-12-13 00:00:00.000000000 Z
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.0.6
213
+ rubygems_version: 3.1.4
213
214
  signing_key:
214
215
  specification_version: 4
215
216
  summary: Resources Controllers for Ruby on Rails.