rao-resources_controller 0.0.45.pre → 0.0.46.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 +2 -1
  18. data/config/locales/en.yml +6 -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 +19 -19
  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: b93048ab064f7bb3d4553fa12d7f8564d686da125a1f16d03395a95d46720973
4
- data.tar.gz: 9aaffc9871640c4546f830134be0d1745038f2b481930a79ff959eebac07fcb9
3
+ metadata.gz: 744f4aa8b0e61a7dd6f7b37ef153f3e72c2f7b9c72597a3b1f19de98640a3e4a
4
+ data.tar.gz: b0df95591066223fe6b1197b5559792575fa1989f13f5115cb6ffe0733d7ba86
5
5
  SHA512:
6
- metadata.gz: 9b2815a70f6de89e0539c40b00d0b0d7de45288b16cf1a53056f55c4e5502e42a56fd9dde92f6fbb6ece542be073d41e351ef516bdc7a7ce454046d523a3ad4a
7
- data.tar.gz: 6ecca432d871e488dd00564ab1aaf47688457774a6e37cd4391c60dab412fb6df5849b87356bede0cf137dc534d01bedb671df2939a7629c3dcd93b5fd338497
6
+ metadata.gz: a229dbe1a6b24769674fc01263020fd67f68a0d4e616cd90e96378f689caa8468ab8de05d4dbe2141196bdcc3420adee5048b842057c46717b389d9cc9624172
7
+ data.tar.gz: 966e0aaa556c440e9f31a3951efb6c3fa638259dcaea807b6f59d2fa10c8365ed8ae8b1306de68506af5e06e100e2a6c3120dbec9eb9507cb582ac468af7ad61
@@ -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
 
@@ -43,7 +43,8 @@ de:
43
43
  title: "%{resource_name} erstellen"
44
44
  show_actions:
45
45
  back: "Zurück"
46
- delete: "Löschen"
46
+ destroy: "Löschen"
47
+ destroy_confirmation: "Sind Sie sicher?"
47
48
  edit: "Bearbeiten"
48
49
  batch_actions_concern:
49
50
  destroy_many:
@@ -43,5 +43,9 @@ en:
43
43
  title: "New %{resource_name}"
44
44
  show_actions:
45
45
  back: "Back"
46
- delete: "Delete"
47
- edit: "Edit"
46
+ destroy: "Delete"
47
+ destroy_confirmation: "Are you sure?"
48
+ edit: "Edit"
49
+ batch_actions_concern:
50
+ destroy_many:
51
+ 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.45.pre
4
+ version: 0.0.46.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-07-28 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -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
@@ -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')