rao-resources_controller 0.0.44.pre → 0.0.48.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/rao/resources_controller/base/{_after_show_table.haml → _after_show_table.html.haml} +0 -0
  3. data/app/views/rao/resources_controller/base/{_before_index_table.haml → _before_index_table.html.haml} +0 -0
  4. data/app/views/rao/resources_controller/base/{_before_show_table.haml → _before_show_table.html.haml} +0 -0
  5. data/app/views/rao/resources_controller/base/{_form.haml → _form.html.haml} +0 -0
  6. data/app/views/rao/resources_controller/base/_form_buttons.html.haml +5 -0
  7. data/app/views/rao/resources_controller/base/{_form_errors.haml → _form_errors.html.haml} +1 -1
  8. data/app/views/rao/resources_controller/base/{_pagination.haml → _pagination.html.haml} +0 -0
  9. data/app/views/rao/resources_controller/base/{_show.haml → _show.html.haml} +0 -0
  10. data/app/views/rao/resources_controller/base/_show_actions.html.haml +11 -0
  11. data/app/views/rao/resources_controller/base/{_table.haml → _table.html.haml} +0 -0
  12. data/app/views/rao/resources_controller/base/_table_actions.html.haml +12 -0
  13. data/app/views/rao/resources_controller/base/{edit.haml → edit.html.haml} +1 -1
  14. data/app/views/rao/resources_controller/base/{index.haml → index.html.haml} +2 -2
  15. data/app/views/rao/resources_controller/base/{new.haml → new.html.haml} +1 -1
  16. data/app/views/rao/resources_controller/base/{show.haml → show.html.haml} +1 -1
  17. data/config/locales/de.yml +5 -1
  18. data/config/locales/en.yml +9 -2
  19. data/lib/generators/rao/resources_controller/templates/initializer.rb +16 -0
  20. data/lib/rao/resources_controller.rb +3 -0
  21. data/lib/rao/resources_controller/configuration.rb +17 -3
  22. data/{app/concerns → lib}/rao/resources_controller/routing/acts_as_list_concern.rb +0 -0
  23. data/{app/concerns → lib}/rao/resources_controller/routing/acts_as_published_concern.rb +0 -0
  24. metadata +25 -25
  25. data/app/views/rao/resources_controller/base/_form_buttons.haml +0 -5
  26. data/app/views/rao/resources_controller/base/_show_actions.haml +0 -11
  27. data/app/views/rao/resources_controller/base/_table_actions.haml +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcd34fcb1c9fd9106d0fe2534b6d94c5ada97ede7f23b53a0ea4fbc51300f6ac
4
- data.tar.gz: a722dfd5902c76ee2690a4b3107d103def7cb8d423635675fd698aa2c7a13c58
3
+ metadata.gz: a4ce8af3cd312aa3406286e3d4a28344a89d612ba4e567dc6189f0b0cc15f57e
4
+ data.tar.gz: dbb59f4181f6b243dad00c5b26265ad88de50f8b97397ac111fcf467c3f39b23
5
5
  SHA512:
6
- metadata.gz: c93d9671784c6e9a1ac8a3f428bf2db2fb8bdc2aab4fce48b8bbad2d9ca2a0e672f11aac7b2413249042bfd95b88dce71e1bd3198461fca3ee4e4ff92ac92982
7
- data.tar.gz: ddbf8be123007bbb2151f358c1e3715f6140840d03e37e79bcf7e29dd20bdc7797a56fb99a567703cc4f45930de4af7888d9043fe96064c2d3f0dbbd211792e0
6
+ metadata.gz: 6d6d31f19420c6a04f0ac4f8f22171552701d050396085409c69836e3386ab9b64cd78e8dd217cc2c235e6d045b740d42d078cac60f1acb761f04492ce4ca5a8
7
+ data.tar.gz: ac5fa0ff35c92566a97275e55e6133f5c6ca3263fd4f7e1bc9f4611f0e8912ebddd1fc9b04780fa7d79277d305cddc11b500cf99aa9e49dc69cf18620362aa62
@@ -0,0 +1,5 @@
1
+ = form.button :submit, class: 'btn btn-success' do
2
+ = fa_icon :check
3
+ = t('.submit', model_name: form.object.model_name.human)
4
+ = link_to(((action_name == 'new' || form.object.new_record?) ? collection_path : resource_path(form.object)), class: 'btn btn-link') do
5
+ = t('.cancel')
@@ -1,5 +1,5 @@
1
1
  - if resource.errors.any?
2
- = bootstrap_alert(context: :danger, class: 'error-explanation') do
2
+ .alert.alert-danger.error-explanation
3
3
  .error-heading= t('errors.template.header', count: resource.errors.count, model: resource.class.model_name.human)
4
4
  %ul
5
5
  - resource.errors.full_messages.each do |msg|
@@ -0,0 +1,11 @@
1
+ .btn-group
2
+ = link_to(edit_resource_path(resource), class: 'btn btn-secondary') do
3
+ %i.fas.fa-edit
4
+ = t('.edit')
5
+
6
+ = link_to(resource_path(resource), class: 'btn btn-danger', method: :delete, data: { confirm: t('.destroy_confirmation') }) do
7
+ %i.fas.fa-trash
8
+ = t('.destroy')
9
+
10
+ = link_to(collection_path, class: 'btn btn-link') do
11
+ = t('.back')
@@ -0,0 +1,12 @@
1
+ = table.column :actions, title: '' do |resource|
2
+ - capture_haml do
3
+ .btn-group
4
+ = link_to(resource_path(resource), class: 'btn btn-sm btn-primary') do
5
+ %i.fas.fa-eye
6
+ = t('.show')
7
+ = link_to(edit_resource_path(resource), class: 'btn btn-sm btn-secondary') do
8
+ %i.fas.fa-edit
9
+ = t('.edit')
10
+ = link_to(resource_path(resource), class: 'btn btn-sm btn-danger', method: :delete, data: { confirm: t('.destroy_confirmation') }) do
11
+ %i.fas.fa-trash
12
+ = t('.destroy')
@@ -1,6 +1,6 @@
1
1
  %h1= t('.title', inflections)
2
2
 
3
- = bootstrap_form_for(@resource, url: resource_path(@resource)) do |f|
3
+ = simple_form_for(@resource, url: resource_path(@resource)) do |f|
4
4
  = render 'form_errors', resource: f.object
5
5
  = render 'form', form: f
6
6
  = render 'form_buttons', form: f
@@ -2,8 +2,8 @@
2
2
  %span
3
3
  = resource_class.model_name.human(count: :other)
4
4
  .pull-right
5
- = bootstrap_button(to: new_resource_path, context: :success) do
6
- = fa_icon(:plus)
5
+ = link_to(new_resource_path, class: 'btn btn-success') do
6
+ %i.fas.fa-plus
7
7
  = t('.new')
8
8
 
9
9
  = render 'before_index_table', collection: @collection
@@ -1,6 +1,6 @@
1
1
  %h1= t('.title', inflections)
2
2
 
3
- = bootstrap_form_for(@resource, url: collection_path) do |f|
3
+ = simple_form_for(@resource, url: collection_path) do |f|
4
4
  = render 'form_errors', resource: f.object
5
5
  = render 'form', form: f
6
6
  = render 'form_buttons', form: f
@@ -1,4 +1,4 @@
1
- %h1= @resource.try_all(:human, :title, :name, :to_s)
1
+ %h1= Rao::ResourcesController::Configuration.label_for_resource_proc.call(@resource)
2
2
 
3
3
  = render 'before_show_table', resource: @resource
4
4
 
@@ -32,6 +32,9 @@ de:
32
32
  alert: "%{resource_name} konnte nicht ausgeführt werden. Es traten folgende Fehler auf: %{errors}"
33
33
  rao:
34
34
  resources_controller:
35
+ aasm_concern:
36
+ trigger_event:
37
+ success: "Der Vorgang %{event} war erfolgreich. Der neue Status ist %{state}."
35
38
  base:
36
39
  form_buttons:
37
40
  cancel: "Abbrechen"
@@ -43,7 +46,8 @@ de:
43
46
  title: "%{resource_name} erstellen"
44
47
  show_actions:
45
48
  back: "Zurück"
46
- delete: "Löschen"
49
+ destroy: "Löschen"
50
+ destroy_confirmation: "Sind Sie sicher?"
47
51
  edit: "Bearbeiten"
48
52
  batch_actions_concern:
49
53
  destroy_many:
@@ -32,6 +32,9 @@ en:
32
32
  alert: "%{resource_name} could not be executed. Errors: %{errors}"
33
33
  rao:
34
34
  resources_controller:
35
+ aasm_concern:
36
+ trigger_event:
37
+ success: "The event %{event} completed successfully. The new state is %{state}."
35
38
  base:
36
39
  form_buttons:
37
40
  cancel: "Cancel"
@@ -43,5 +46,9 @@ en:
43
46
  title: "New %{resource_name}"
44
47
  show_actions:
45
48
  back: "Back"
46
- delete: "Delete"
47
- edit: "Edit"
49
+ destroy: "Delete"
50
+ destroy_confirmation: "Are you sure?"
51
+ edit: "Edit"
52
+ batch_actions_concern:
53
+ destroy_many:
54
+ success: "Deleted %{count} %{collection_name}."
@@ -12,4 +12,20 @@ Rao::ResourcesController.configure do |config|
12
12
  # default: config.pagination_per_page_default = 25
13
13
  #
14
14
  config.pagination_per_page_default = 25
15
+
16
+ # Configures how a label will be created for resources.
17
+ #
18
+ # default: config.label_for_resource_proc = lambda do |resource|
19
+ # [:human, :title, :name, :to_s].each do |method_name|
20
+ # next unless resource.respond_to?(method_name)
21
+ # return resource.send(method_name)
22
+ # end
23
+ # end
24
+ #
25
+ config.label_for_resource_proc = lambda do |resource|
26
+ [:human, :title, :name, :to_s].each do |method_name|
27
+ next unless resource.respond_to?(method_name)
28
+ return resource.send(method_name)
29
+ end
30
+ end
15
31
  end
@@ -2,6 +2,9 @@ require "rao/resources_controller/configuration"
2
2
  require "rao/resources_controller/version"
3
3
  require "rao/resources_controller/engine"
4
4
 
5
+ require "rao/resources_controller/routing/acts_as_list_concern"
6
+ require "rao/resources_controller/routing/acts_as_published_concern"
7
+
5
8
  module Rao
6
9
  module ResourcesController
7
10
  extend Configuration
@@ -5,8 +5,22 @@ module Rao
5
5
  yield self
6
6
  end
7
7
 
8
- mattr_accessor(:resources_controller_base_class_name) { "::ApplicationController" }
9
- mattr_accessor(:pagination_per_page_default) { 25 }
8
+ mattr_accessor(:resources_controller_base_class_name) do
9
+ "::ApplicationController"
10
+ end
11
+
12
+ mattr_accessor(:pagination_per_page_default) do
13
+ 25
14
+ end
15
+
16
+ mattr_accessor(:label_for_resource_proc) do
17
+ lambda do |resource|
18
+ [:human, :title, :name, :to_s].each do |method_name|
19
+ next unless resource.respond_to?(method_name)
20
+ return resource.send(method_name)
21
+ end
22
+ end
23
+ end
10
24
  end
11
25
  end
12
- end
26
+ end
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.44.pre
4
+ version: 0.0.48.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: 2020-06-28 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.0
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rao
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3.6
61
+ version: '1.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.3.6
68
+ version: '1.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rails-dummy
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -160,26 +160,24 @@ files:
160
160
  - app/concerns/rao/resources_controller/resources_concern.rb
161
161
  - app/concerns/rao/resources_controller/rest_actions_concern.rb
162
162
  - app/concerns/rao/resources_controller/rest_resource_urls_concern.rb
163
- - app/concerns/rao/resources_controller/routing/acts_as_list_concern.rb
164
- - app/concerns/rao/resources_controller/routing/acts_as_published_concern.rb
165
163
  - app/concerns/rao/resources_controller/sorting_concern.rb
166
164
  - app/concerns/rao/resources_controller/will_paginate_concern.rb
167
165
  - app/controllers/rao/resources_controller/base.rb
168
- - app/views/rao/resources_controller/base/_after_show_table.haml
169
- - app/views/rao/resources_controller/base/_before_index_table.haml
170
- - app/views/rao/resources_controller/base/_before_show_table.haml
171
- - app/views/rao/resources_controller/base/_form.haml
172
- - app/views/rao/resources_controller/base/_form_buttons.haml
173
- - app/views/rao/resources_controller/base/_form_errors.haml
174
- - app/views/rao/resources_controller/base/_pagination.haml
175
- - app/views/rao/resources_controller/base/_show.haml
176
- - app/views/rao/resources_controller/base/_show_actions.haml
177
- - app/views/rao/resources_controller/base/_table.haml
178
- - app/views/rao/resources_controller/base/_table_actions.haml
179
- - app/views/rao/resources_controller/base/edit.haml
180
- - app/views/rao/resources_controller/base/index.haml
181
- - app/views/rao/resources_controller/base/new.haml
182
- - app/views/rao/resources_controller/base/show.haml
166
+ - app/views/rao/resources_controller/base/_after_show_table.html.haml
167
+ - app/views/rao/resources_controller/base/_before_index_table.html.haml
168
+ - app/views/rao/resources_controller/base/_before_show_table.html.haml
169
+ - app/views/rao/resources_controller/base/_form.html.haml
170
+ - app/views/rao/resources_controller/base/_form_buttons.html.haml
171
+ - app/views/rao/resources_controller/base/_form_errors.html.haml
172
+ - app/views/rao/resources_controller/base/_pagination.html.haml
173
+ - app/views/rao/resources_controller/base/_show.html.haml
174
+ - app/views/rao/resources_controller/base/_show_actions.html.haml
175
+ - app/views/rao/resources_controller/base/_table.html.haml
176
+ - app/views/rao/resources_controller/base/_table_actions.html.haml
177
+ - app/views/rao/resources_controller/base/edit.html.haml
178
+ - app/views/rao/resources_controller/base/index.html.haml
179
+ - app/views/rao/resources_controller/base/new.html.haml
180
+ - app/views/rao/resources_controller/base/show.html.haml
183
181
  - config/initializers/include_routing_concerns.rb
184
182
  - config/locales/de.yml
185
183
  - config/locales/en.yml
@@ -189,6 +187,8 @@ files:
189
187
  - lib/rao/resources_controller.rb
190
188
  - lib/rao/resources_controller/configuration.rb
191
189
  - lib/rao/resources_controller/engine.rb
190
+ - lib/rao/resources_controller/routing/acts_as_list_concern.rb
191
+ - lib/rao/resources_controller/routing/acts_as_published_concern.rb
192
192
  - lib/rao/resources_controller/version.rb
193
193
  - lib/tasks/rao-resources_controller_tasks.rake
194
194
  homepage: https://github.com/rails-add_ons
@@ -203,14 +203,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - ">="
205
205
  - !ruby/object:Gem::Version
206
- version: '0'
206
+ version: 2.6.0
207
207
  required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  requirements:
209
209
  - - ">"
210
210
  - !ruby/object:Gem::Version
211
211
  version: 1.3.1
212
212
  requirements: []
213
- rubygems_version: 3.1.4
213
+ rubygems_version: 3.2.24
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Resources Controllers for Ruby on Rails.
@@ -1,5 +0,0 @@
1
- = form.button :submit, class: 'btn btn-success' do
2
- = fa_icon :check
3
- = t('.submit', model_name: form.object.model_name.human)
4
- = bootstrap_button(to: ((action_name == 'new' || form.object.new_record?) ? collection_path : resource_path(form.object)), context: :link) do
5
- = t('.cancel')
@@ -1,11 +0,0 @@
1
- = bootstrap_button_group do
2
- = bootstrap_button(to: edit_resource_path(resource), context: :secondary) do
3
- = fa_icon(:pencil)
4
- = t('.edit')
5
-
6
- = bootstrap_button(to: resource_path(resource), context: :danger, method: :delete, data: { confirm: 'Are you sure?' }) do
7
- = fa_icon :trash
8
- = t('.destroy')
9
-
10
- = bootstrap_button(to: collection_path, context: :link) do
11
- = t('.back')
@@ -1,12 +0,0 @@
1
- = table.column :actions do |resource|
2
- - capture_haml do
3
- = bootstrap_button_group do
4
- = bootstrap_button(to: resource_path(resource), context: :primary, size: :small) do
5
- = fa_icon :eye
6
- = t('.show')
7
- = bootstrap_button(to: edit_resource_path(resource), context: :secondary, size: :small) do
8
- = fa_icon :pencil
9
- = t('.edit')
10
- = bootstrap_button(to: resource_path(resource), context: :danger, size: :small, method: :delete, data: { confirm: 'Are you sure?' }) do
11
- = fa_icon :trash
12
- = t('.destroy')