rao-resources_controller 0.0.39.pre → 0.0.44.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: b02e20936f04390cc576ea2a7487076b08ab48d43a9ed2671026fbdf7a2f8d4e
4
- data.tar.gz: 2581eb8e8911d3ec4f6ced31afd2152983472be97f85c3cfe1c1d6d20e4316ba
3
+ metadata.gz: fcd34fcb1c9fd9106d0fe2534b6d94c5ada97ede7f23b53a0ea4fbc51300f6ac
4
+ data.tar.gz: a722dfd5902c76ee2690a4b3107d103def7cb8d423635675fd698aa2c7a13c58
5
5
  SHA512:
6
- metadata.gz: e2d1f4c5e410134c46ffd0e1ef6feb70a09ae40ca6ec8d05c65d76255429c1784569e980a9f6e828f0c98ac3e36f3c2910d3a01e5dde47602e631e5f696122f9
7
- data.tar.gz: 98887f55269b61d59373c7ad7cdcee34bf1c3b1950617b6ded82de4e1690c966307f26c87df85f6284dcf49dc9656a30f03e30eb94fb36529ac8103e3efd2277
6
+ metadata.gz: c93d9671784c6e9a1ac8a3f428bf2db2fb8bdc2aab4fce48b8bbad2d9ca2a0e672f11aac7b2413249042bfd95b88dce71e1bd3198461fca3ee4e4ff92ac92982
7
+ data.tar.gz: ddbf8be123007bbb2151f358c1e3715f6140840d03e37e79bcf7e29dd20bdc7797a56fb99a567703cc4f45930de4af7888d9043fe96064c2d3f0dbbd211792e0
@@ -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('rao.resources_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('rao.resources_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
@@ -9,9 +9,13 @@ module Rao
9
9
  module ResourcesController::BatchActionsConcern
10
10
  def destroy_many
11
11
  @collection = load_collection_scope.where(id: params[:ids])
12
+ count = @collection.count
12
13
  @collection.destroy_all
13
14
 
14
- respond_with @collection, location: after_destroy_many_location, notice: t('.success', count: @collection.count)
15
+ default_message = t('.success', inflections.merge(count: count))
16
+ respond_with @collection,
17
+ location: after_destroy_many_location,
18
+ notice: t('rao.resources_controller.batch_actions_concern.destroy_many.success', inflections.merge(count: count, default: default_message))
15
19
  end
16
20
 
17
21
  private
@@ -44,4 +44,7 @@ de:
44
44
  show_actions:
45
45
  back: "Zurück"
46
46
  delete: "Löschen"
47
- edit: "Bearbeiten"
47
+ edit: "Bearbeiten"
48
+ batch_actions_concern:
49
+ destroy_many:
50
+ success: "%{count} %{collection_name} wurden gelöscht."
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.39.pre
4
+ version: 0.0.44.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-01-30 00:00:00.000000000 Z
11
+ date: 2020-06-28 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.2
213
+ rubygems_version: 3.1.4
213
214
  signing_key:
214
215
  specification_version: 4
215
216
  summary: Resources Controllers for Ruby on Rails.