rao-resources_controller 0.0.48.pre → 0.0.50.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concerns/rao/resources_controller/aasm_concern.rb +18 -3
- data/app/concerns/rao/resources_controller/awesome_nested_set_concern.rb +8 -2
- data/app/concerns/rao/resources_controller/batch_actions_concern.rb +2 -2
- data/app/concerns/rao/resources_controller/kaminari_concern.rb +7 -2
- data/app/views/rao/resources_controller/base/edit.html.haml +1 -1
- data/app/views/rao/resources_controller/base/new.html.haml +1 -1
- data/config/locales/de.yml +1 -0
- data/config/locales/en.yml +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a77482ef8736751ebab6c1ea43335f9c83b0df9b12e765956adb94ae366befe
|
4
|
+
data.tar.gz: 475e4173a5e082f3547532b233083b402741c46f1c14fd62ccbd7daeb700d1ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
12
|
-
|
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[:
|
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
|
|
@@ -4,7 +4,7 @@ module Rao
|
|
4
4
|
|
5
5
|
def reposition
|
6
6
|
@resource = load_resource
|
7
|
-
@dropped_resource =
|
7
|
+
@dropped_resource = load_resource_scope.find(params[:dropped_id])
|
8
8
|
@dropped_resource.move_to_right_of(@resource)
|
9
9
|
|
10
10
|
label_methods = [:human, :name, :email, :to_s]
|
@@ -25,7 +25,13 @@ module Rao
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
redirect_to
|
28
|
+
redirect_to after_reposition_location, notice: I18n.t("awesome_nested_set.flash.actions.reposition.notice", target_resource: target_resource_label, inserted_resource: inserted_resource_label)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def after_reposition_location
|
34
|
+
collection_path
|
29
35
|
end
|
30
36
|
end
|
31
37
|
end
|
@@ -12,10 +12,10 @@ module Rao
|
|
12
12
|
count = @collection.count
|
13
13
|
@collection.destroy_all
|
14
14
|
|
15
|
-
default_message = t('.success', inflections.merge(count: count))
|
15
|
+
default_message = t('.success', **inflections.merge(count: count, raise: false))
|
16
16
|
respond_with @collection,
|
17
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))
|
18
|
+
notice: t('rao.resources_controller.batch_actions_concern.destroy_many.success', **inflections.merge(count: count, default: default_message))
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -4,13 +4,18 @@ module Rao
|
|
4
4
|
|
5
5
|
included do
|
6
6
|
helper_method :paginate?
|
7
|
+
helper_method :per_page
|
7
8
|
end
|
9
|
+
|
10
|
+
private
|
8
11
|
|
9
12
|
def paginate?
|
10
13
|
true
|
11
14
|
end
|
12
15
|
|
13
|
-
|
16
|
+
def per_page_default
|
17
|
+
Rao::ResourcesController::Configuration.pagination_per_page_default
|
18
|
+
end
|
14
19
|
|
15
20
|
def load_collection
|
16
21
|
@collection = load_collection_scope.page(params[:page]).per(per_page)
|
@@ -19,7 +24,7 @@ module Rao
|
|
19
24
|
def per_page
|
20
25
|
# Return page size from configuration if per_page is not present in params
|
21
26
|
unless params.has_key?(:per_page)
|
22
|
-
return
|
27
|
+
return per_page_default
|
23
28
|
end
|
24
29
|
|
25
30
|
# Return count of all records or nil if no records present if
|
data/config/locales/de.yml
CHANGED
@@ -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:
|
data/config/locales/en.yml
CHANGED
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.
|
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:
|
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.
|
213
|
+
rubygems_version: 3.4.20
|
214
214
|
signing_key:
|
215
215
|
specification_version: 4
|
216
216
|
summary: Resources Controllers for Ruby on Rails.
|