rao-resources_controller 0.0.49.pre → 0.0.51.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: ed77f13d64e453c1739f049490a162ecb6ae2692e773488fe2800e1d9706671a
4
+ data.tar.gz: 5e56b6a6b51aca5497681d3b30581fc0fe8d8db312ffa6923b44845c9b833587
5
5
  SHA512:
6
- metadata.gz: 67449b0e3579bb1b00fd22a4c53f8655c1f05f1fb91e20dff37bd2320f67decbfa549aa1ce8346d21b0445433ae52fea577a0ba8c10e093c5aa34ccb58dd464e
7
- data.tar.gz: '059aace6a67a1d8f82e8db32055223c7f088f3d83f28e8bcd42328b1c3db0ee9220caf988da6aeea30fd067988d6a688cc69564de3a797be44d765782552c477'
6
+ metadata.gz: 8ba4b9b0276212d1c74f18f69e1cd412d68f9f93afabf9e6656745c21785277c084da11b37c582ca561f4792c1b1667544698a7fd71d3536b08f4fc4fb7f7115
7
+ data.tar.gz: 8da548cadd086c29e6db291cc69f229d9d5fda29dba384c61d7a426e5310a359cef3c91df58d28bbfb3b62b5b303da0bcda7ed9ba9a0f09f4c5ce0c1d6d0693b
@@ -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
 
@@ -16,7 +16,7 @@ module Rao
16
16
 
17
17
  def store_location
18
18
  return if request.referer.nil?
19
- truncate_location_history(9)
19
+ truncate_location_history(3)
20
20
  logger.debug "[LocationHistoryConcern] Storing last location [#{request.referer}]"
21
21
  location_history[Time.zone.now] = request.referer
22
22
  end
@@ -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.51.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-28 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.21
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Resources Controllers for Ruby on Rails.