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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 225265f8be85ba6e2675e209908e36bc57e9dd1ccc1cfcd26c160f0cb55cd810
4
- data.tar.gz: 687cd0d960e38566ff3adcfe4ddebd840d7839f96cbea947a9d440c5c103803d
3
+ metadata.gz: d458ba14cebf204d6eea9d9b16d831e64a974a9435fe45c9fc9e554074973461
4
+ data.tar.gz: c2abe900f2fec8f00ffc78c1c849bd12f330f64c02c706acc95a784ca2117a74
5
5
  SHA512:
6
- metadata.gz: 1f9c2cae5e41e3b96fa11da8d7ddaec198fb4afaa291e7da05a74286ee0fa6731cfac1dd3b4c1004f9cbe061bd0d91bed0d7286ceee782672ca0bc7c642a6511
7
- data.tar.gz: f10056f3297ce576e18a71525966d1804e126cbf04f0b2b1dcb0f7f7e0b5c3f404d12272e7a038f4f4ceb472648d514b9b7117afc0be611587bfcea984a3518e
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.42.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: 2020-05-20 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.1.3
213
+ rubygems_version: 3.1.4
213
214
  signing_key:
214
215
  specification_version: 4
215
216
  summary: Resources Controllers for Ruby on Rails.