rao-resources_controller 0.0.48.pre → 0.0.49.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: a4ce8af3cd312aa3406286e3d4a28344a89d612ba4e567dc6189f0b0cc15f57e
4
- data.tar.gz: dbb59f4181f6b243dad00c5b26265ad88de50f8b97397ac111fcf467c3f39b23
3
+ metadata.gz: 49403d74f7f8f424205b8f94e50b24c5eeded006ddad1656d35b5bdb4a0edfc8
4
+ data.tar.gz: 860e42fee2505e0f0b62063a78003e90e6522af30aa59bae78396677ff6863d4
5
5
  SHA512:
6
- metadata.gz: 6d6d31f19420c6a04f0ac4f8f22171552701d050396085409c69836e3386ab9b64cd78e8dd217cc2c235e6d045b740d42d078cac60f1acb761f04492ce4ca5a8
7
- data.tar.gz: ac5fa0ff35c92566a97275e55e6133f5c6ca3263fd4f7e1bc9f4611f0e8912ebddd1fc9b04780fa7d79277d305cddc11b500cf99aa9e49dc69cf18620362aa62
6
+ metadata.gz: 67449b0e3579bb1b00fd22a4c53f8655c1f05f1fb91e20dff37bd2320f67decbfa549aa1ce8346d21b0445433ae52fea577a0ba8c10e093c5aa34ccb58dd464e
7
+ data.tar.gz: '059aace6a67a1d8f82e8db32055223c7f088f3d83f28e8bcd42328b1c3db0ee9220caf988da6aeea30fd067988d6a688cc69564de3a797be44d765782552c477'
@@ -4,7 +4,7 @@ module Rao
4
4
 
5
5
  def reposition
6
6
  @resource = load_resource
7
- @dropped_resource = resource_class.find(params[:dropped_id])
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 collection_path, notice: I18n.t("awesome_nested_set.flash.actions.reposition.notice", target_resource: target_resource_label, inserted_resource: inserted_resource_label)
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
- private
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 Rao::ResourcesController::Configuration.pagination_per_page_default
27
+ return per_page_default
23
28
  end
24
29
 
25
30
  # Return count of all records or nil if no records present if
@@ -1,4 +1,4 @@
1
- %h1= t('.title', inflections)
1
+ %h1= t('.title', **inflections)
2
2
 
3
3
  = simple_form_for(@resource, url: resource_path(@resource)) do |f|
4
4
  = render 'form_errors', resource: f.object
@@ -1,4 +1,4 @@
1
- %h1= t('.title', inflections)
1
+ %h1= t('.title', **inflections)
2
2
 
3
3
  = simple_form_for(@resource, url: collection_path) do |f|
4
4
  = render 'form_errors', resource: f.object
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.48.pre
4
+ version: 0.0.49.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: 2021-07-21 00:00:00.000000000 Z
11
+ date: 2023-04-11 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.2.24
213
+ rubygems_version: 3.4.11
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Resources Controllers for Ruby on Rails.