dry_crud 2.1.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/README.rdoc +1 -2
- data/VERSION +1 -1
- data/app/controllers/crud_controller.rb +96 -61
- data/app/controllers/dry_crud/generic_model.rb +1 -5
- data/app/controllers/dry_crud/rememberable.rb +1 -1
- data/app/controllers/dry_crud/render_callbacks.rb +2 -4
- data/app/controllers/list_controller.rb +4 -5
- data/app/helpers/dry_crud/form/builder.rb +4 -30
- data/app/helpers/format_helper.rb +2 -0
- data/app/helpers/utility_helper.rb +2 -3
- data/app/views/crud/show.json.jbuilder +1 -0
- data/app/views/layouts/_flash.html.erb +1 -1
- data/app/views/layouts/_flash.html.haml +1 -1
- data/app/views/list/index.json.jbuilder +4 -0
- data/config/locales/crud.de.yml +1 -1
- data/lib/generators/dry_crud/templates/spec/controllers/crud_test_models_controller_spec.rb +141 -139
- data/lib/generators/dry_crud/templates/spec/helpers/dry_crud/form/builder_spec.rb +47 -48
- data/lib/generators/dry_crud/templates/spec/helpers/dry_crud/table/builder_spec.rb +6 -6
- data/lib/generators/dry_crud/templates/spec/helpers/form_helper_spec.rb +66 -66
- data/lib/generators/dry_crud/templates/spec/helpers/format_helper_spec.rb +62 -61
- data/lib/generators/dry_crud/templates/spec/helpers/i18n_helper_spec.rb +13 -13
- data/lib/generators/dry_crud/templates/spec/helpers/table_helper_spec.rb +42 -38
- data/lib/generators/dry_crud/templates/spec/helpers/utility_helper_spec.rb +22 -22
- data/lib/generators/dry_crud/templates/spec/support/crud_controller_examples.rb +72 -72
- data/lib/generators/dry_crud/templates/spec/support/crud_controller_test_helper.rb +54 -45
- data/lib/generators/dry_crud/templates/test/controllers/crud_test_models_controller_test.rb +8 -11
- data/lib/generators/dry_crud/templates/test/helpers/dry_crud/form/builder_test.rb +1 -6
- data/lib/generators/dry_crud/templates/test/helpers/form_helper_test.rb +47 -46
- data/lib/generators/dry_crud/templates/test/helpers/format_helper_test.rb +1 -1
- data/lib/generators/dry_crud/templates/test/helpers/table_helper_test.rb +9 -3
- data/lib/generators/dry_crud/templates/test/support/crud_controller_test_helper.rb +2 -2
- data/lib/generators/dry_crud/templates/test/support/crud_test_helper.rb +1 -1
- data/lib/generators/dry_crud/templates/test/support/crud_test_model.rb +0 -4
- data/lib/generators/dry_crud/templates/test/support/crud_test_models_controller.rb +5 -10
- metadata +15 -18
- data/app/controllers/dry_crud/responder.rb +0 -34
@@ -1,34 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module DryCrud
|
4
|
-
# Custom Responder that handles the controller's +path_args+.
|
5
|
-
# An additional :success option is used to handle action callback
|
6
|
-
# chain halts.
|
7
|
-
class Responder < ActionController::Responder
|
8
|
-
|
9
|
-
def initialize(controller, resources, options = {})
|
10
|
-
super(controller, with_path_args(resources, controller), options)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
# rubocop:disable PredicateName
|
16
|
-
|
17
|
-
# Check whether the resource has errors. Additionally checks the :success
|
18
|
-
# option.
|
19
|
-
def has_errors?
|
20
|
-
options[:success] == false || super
|
21
|
-
end
|
22
|
-
# rubocop:enable PredicateName
|
23
|
-
|
24
|
-
# Wraps the resources with the path_args for correct nesting.
|
25
|
-
def with_path_args(resources, controller)
|
26
|
-
if resources.size == 1
|
27
|
-
Array(controller.send(:path_args, resources.first))
|
28
|
-
else
|
29
|
-
resources
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|