rao-resources_controller 0.0.40.pre → 0.0.45.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: db88331dbd01f7e29a6badb62ec18de036d412801f352ed9a85c71925511d385
4
- data.tar.gz: 0f1cdb273732a121fd83f3e0dce524263f78289e4bc0d83f58701f0f83e27de2
3
+ metadata.gz: b93048ab064f7bb3d4553fa12d7f8564d686da125a1f16d03395a95d46720973
4
+ data.tar.gz: 9aaffc9871640c4546f830134be0d1745038f2b481930a79ff959eebac07fcb9
5
5
  SHA512:
6
- metadata.gz: e39f85c4b3c35240a947c20ab6175b77c96238949c61ee87aa92e3b3db1db6615718c6809aa28be816255ecdfe8f8173cdcb5572993e7736247c0900bcf18a0f
7
- data.tar.gz: '09045674e336b87b719207ba5e60e8e8a3ef53d5389658d954404f6bf7f3caaedbd1789b0a911cd29c3c64d99f1f6c0c07dc69edebb369e475335fedcb7b7ac4'
6
+ metadata.gz: 9b2815a70f6de89e0539c40b00d0b0d7de45288b16cf1a53056f55c4e5502e42a56fd9dde92f6fbb6ece542be073d41e351ef516bdc7a7ce454046d523a3ad4a
7
+ data.tar.gz: 6ecca432d871e488dd00564ab1aaf47688457774a6e37cd4391c60dab412fb6df5849b87356bede0cf137dc534d01bedb671df2939a7629c3dcd93b5fd338497
@@ -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.40.pre
4
+ version: 0.0.45.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-03-17 00:00:00.000000000 Z
11
+ date: 2020-07-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.