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.
Files changed (37) hide show
  1. checksums.yaml +5 -13
  2. data/README.rdoc +1 -2
  3. data/VERSION +1 -1
  4. data/app/controllers/crud_controller.rb +96 -61
  5. data/app/controllers/dry_crud/generic_model.rb +1 -5
  6. data/app/controllers/dry_crud/rememberable.rb +1 -1
  7. data/app/controllers/dry_crud/render_callbacks.rb +2 -4
  8. data/app/controllers/list_controller.rb +4 -5
  9. data/app/helpers/dry_crud/form/builder.rb +4 -30
  10. data/app/helpers/format_helper.rb +2 -0
  11. data/app/helpers/utility_helper.rb +2 -3
  12. data/app/views/crud/show.json.jbuilder +1 -0
  13. data/app/views/layouts/_flash.html.erb +1 -1
  14. data/app/views/layouts/_flash.html.haml +1 -1
  15. data/app/views/list/index.json.jbuilder +4 -0
  16. data/config/locales/crud.de.yml +1 -1
  17. data/lib/generators/dry_crud/templates/spec/controllers/crud_test_models_controller_spec.rb +141 -139
  18. data/lib/generators/dry_crud/templates/spec/helpers/dry_crud/form/builder_spec.rb +47 -48
  19. data/lib/generators/dry_crud/templates/spec/helpers/dry_crud/table/builder_spec.rb +6 -6
  20. data/lib/generators/dry_crud/templates/spec/helpers/form_helper_spec.rb +66 -66
  21. data/lib/generators/dry_crud/templates/spec/helpers/format_helper_spec.rb +62 -61
  22. data/lib/generators/dry_crud/templates/spec/helpers/i18n_helper_spec.rb +13 -13
  23. data/lib/generators/dry_crud/templates/spec/helpers/table_helper_spec.rb +42 -38
  24. data/lib/generators/dry_crud/templates/spec/helpers/utility_helper_spec.rb +22 -22
  25. data/lib/generators/dry_crud/templates/spec/support/crud_controller_examples.rb +72 -72
  26. data/lib/generators/dry_crud/templates/spec/support/crud_controller_test_helper.rb +54 -45
  27. data/lib/generators/dry_crud/templates/test/controllers/crud_test_models_controller_test.rb +8 -11
  28. data/lib/generators/dry_crud/templates/test/helpers/dry_crud/form/builder_test.rb +1 -6
  29. data/lib/generators/dry_crud/templates/test/helpers/form_helper_test.rb +47 -46
  30. data/lib/generators/dry_crud/templates/test/helpers/format_helper_test.rb +1 -1
  31. data/lib/generators/dry_crud/templates/test/helpers/table_helper_test.rb +9 -3
  32. data/lib/generators/dry_crud/templates/test/support/crud_controller_test_helper.rb +2 -2
  33. data/lib/generators/dry_crud/templates/test/support/crud_test_helper.rb +1 -1
  34. data/lib/generators/dry_crud/templates/test/support/crud_test_model.rb +0 -4
  35. data/lib/generators/dry_crud/templates/test/support/crud_test_models_controller.rb +5 -10
  36. metadata +15 -18
  37. 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