rao-resources_controller 0.0.49.pre → 0.0.50.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: 49403d74f7f8f424205b8f94e50b24c5eeded006ddad1656d35b5bdb4a0edfc8
4
- data.tar.gz: 860e42fee2505e0f0b62063a78003e90e6522af30aa59bae78396677ff6863d4
3
+ metadata.gz: 9a77482ef8736751ebab6c1ea43335f9c83b0df9b12e765956adb94ae366befe
4
+ data.tar.gz: 475e4173a5e082f3547532b233083b402741c46f1c14fd62ccbd7daeb700d1ef
5
5
  SHA512:
6
- metadata.gz: 67449b0e3579bb1b00fd22a4c53f8655c1f05f1fb91e20dff37bd2320f67decbfa549aa1ce8346d21b0445433ae52fea577a0ba8c10e093c5aa34ccb58dd464e
7
- data.tar.gz: '059aace6a67a1d8f82e8db32055223c7f088f3d83f28e8bcd42328b1c3db0ee9220caf988da6aeea30fd067988d6a688cc69564de3a797be44d765782552c477'
6
+ metadata.gz: 8e8f943e0eb527ae4e4c27299334a094d66dd1dd4917c1d460862a0ddd058f0fc0c6481f9cb5160f72f501c73f56536ac4a597cbbbccb3babed15f61662a508f
7
+ data.tar.gz: 1de3255653c1cc23f8c804e8b6d1c83f3393d039970dfaa2b2c01204fdb29e1ce90f92a0b4dd5fc7ed1e3c9b51bebd2dfe203b338ffddb377019afc9f3c83e5e
@@ -8,11 +8,26 @@ module Rao
8
8
  end
9
9
 
10
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])
11
+ begin
12
+ result = @resource.aasm(permitted_params_for_trigger_event[:machine_name].to_sym).fire!(permitted_params_for_trigger_event[:event_name].to_sym)
13
+ rescue ActiveRecord::RecordInvalid => e
14
+ result = false
15
+ end
16
+
17
+ if result
18
+ flash[:notice] = t(
19
+ 'rao.resources_controller.aasm_concern.trigger_event.success',
20
+ event: permitted_params_for_trigger_event[:event_name],
21
+ state: @resource.aasm(permitted_params_for_trigger_event[:machine_name].to_sym).current_state
22
+ )
13
23
  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])
24
+ flash[:danger] = t(
25
+ 'rao.resources_controller.aasm_concern.trigger_event.failure',
26
+ event: permitted_params_for_trigger_event[:event_name],
27
+ errors: @resource.errors.full_messages.to_sentence
28
+ )
15
29
  end
30
+
16
31
  redirect_back(fallback_location: root_path)
17
32
  end
18
33
 
@@ -34,6 +34,7 @@ de:
34
34
  resources_controller:
35
35
  aasm_concern:
36
36
  trigger_event:
37
+ failure: "Der Vorgang %{event} war nicht erfolgreich. Es traten folgende Fehler auf: %{errors}"
37
38
  success: "Der Vorgang %{event} war erfolgreich. Der neue Status ist %{state}."
38
39
  base:
39
40
  form_buttons:
@@ -34,6 +34,7 @@ en:
34
34
  resources_controller:
35
35
  aasm_concern:
36
36
  trigger_event:
37
+ failure: "The event %{event} failed. Errors: %{errors}"
37
38
  success: "The event %{event} completed successfully. The new state is %{state}."
38
39
  base:
39
40
  form_buttons:
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.49.pre
4
+ version: 0.0.50.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: 2023-04-11 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: 1.3.1
212
212
  requirements: []
213
- rubygems_version: 3.4.11
213
+ rubygems_version: 3.4.20
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Resources Controllers for Ruby on Rails.