administrador 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +73 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/config/administrador_manifest.js +2 -0
  6. data/app/assets/javascripts/administrador/application.js +16 -0
  7. data/app/assets/stylesheets/administrador/application/bootstrap-btn-responsive.css +7 -0
  8. data/app/assets/stylesheets/administrador/application/bootstrap-btn-xs.css +6 -0
  9. data/app/assets/stylesheets/administrador/application/bootstrap-circular-buttons.css +30 -0
  10. data/app/assets/stylesheets/administrador/application/bootstrap-table-xs.css +7 -0
  11. data/app/assets/stylesheets/administrador/application/colors.css +7 -0
  12. data/app/assets/stylesheets/administrador/application/engine-sidebar.css +7 -0
  13. data/app/assets/stylesheets/administrador/application/layout.css +43 -0
  14. data/app/assets/stylesheets/administrador/application/page-actions.css +3 -0
  15. data/app/assets/stylesheets/administrador/application/query_form.css +8 -0
  16. data/app/assets/stylesheets/administrador/application.css +15 -0
  17. data/app/concerns/administrador/controller/application_concern.rb +15 -0
  18. data/app/concerns/administrador/controller/engine_concern.rb +21 -0
  19. data/app/concerns/administrador/controller/resource_concern.rb +50 -0
  20. data/app/concerns/administrador/controller/resources_concern.rb +70 -0
  21. data/app/concerns/administrador/controller/service_concern.rb +17 -0
  22. data/app/concerns/administrador/engine_routable/localized_concern.rb +21 -0
  23. data/app/controllers/administrador/application_controller.rb +5 -0
  24. data/app/controllers/administrador/home_controller/base.rb +7 -0
  25. data/app/controllers/administrador/home_controller.rb +6 -0
  26. data/app/controllers/administrador/resource_controller/base.rb +7 -0
  27. data/app/controllers/administrador/resources_controller/base.rb +7 -0
  28. data/app/controllers/administrador/service_controller/base.rb +7 -0
  29. data/app/controllers/administrador/sidebar_controller/base.rb +17 -0
  30. data/app/jobs/administrador/application_job.rb +4 -0
  31. data/app/mailers/administrador/application_mailer.rb +6 -0
  32. data/app/models/administrador/application_record.rb +5 -0
  33. data/app/view_helpers/administrador/application_view_helper.rb +44 -0
  34. data/app/view_helpers/administrador/breadcrumbs_view_helper.rb +59 -0
  35. data/app/view_helpers/administrador/offcanvas_view_helper.rb +8 -0
  36. data/app/views/administrador/application/_main_sidebar_right.html.haml +1 -0
  37. data/app/views/administrador/application/_navbar.html.haml +14 -0
  38. data/app/views/administrador/application/sidebars/_engine.html.haml +32 -0
  39. data/app/views/administrador/application/sidebars/_i18n.html.haml +8 -0
  40. data/app/views/administrador/application/sidebars/_messages.html.haml +5 -0
  41. data/app/views/administrador/application/sidebars/_notifications.html.haml +5 -0
  42. data/app/views/administrador/application/sidebars/_search.html.haml +5 -0
  43. data/app/views/administrador/application/sidebars/_settings.html.haml +5 -0
  44. data/app/views/administrador/application/sidebars/_user.html.haml +5 -0
  45. data/app/views/administrador/application_view_helper/_flash_messages.html.haml +3 -0
  46. data/app/views/administrador/application_view_helper/_render_engine_sidebars.html.haml +4 -0
  47. data/app/views/administrador/home/_html_head_extras.html.haml +0 -0
  48. data/app/views/administrador/home/index.de.html.haml +6 -0
  49. data/app/views/administrador/home/index.en.html.haml +6 -0
  50. data/app/views/administrador/home_controller/base/_html_head_extras.html.haml +0 -0
  51. data/app/views/administrador/home_controller/base/index.html.haml +3 -0
  52. data/app/views/administrador/resource_controller/base/_after_show_table.html.haml +0 -0
  53. data/app/views/administrador/resource_controller/base/_before_show_table.html.haml +0 -0
  54. data/app/views/administrador/resource_controller/base/_edit_actions.html.haml +7 -0
  55. data/app/views/administrador/resource_controller/base/_form.html.haml +8 -0
  56. data/app/views/administrador/resource_controller/base/_form_buttons.html.haml +1 -0
  57. data/app/views/administrador/resource_controller/base/_form_errors.html.haml +6 -0
  58. data/app/views/administrador/resource_controller/base/_html_head_extras.html.haml +0 -0
  59. data/app/views/administrador/resource_controller/base/_new_actions.html.haml +3 -0
  60. data/app/views/administrador/resource_controller/base/_show_actions.html.haml +6 -0
  61. data/app/views/administrador/resource_controller/base/_show_table.html.haml +2 -0
  62. data/app/views/administrador/resource_controller/base/edit.html.haml +14 -0
  63. data/app/views/administrador/resource_controller/base/new.html.haml +14 -0
  64. data/app/views/administrador/resource_controller/base/show.html.haml +19 -0
  65. data/app/views/administrador/resources_controller/base/_after_index_table.html.haml +0 -0
  66. data/app/views/administrador/resources_controller/base/_after_show_table.html.haml +0 -0
  67. data/app/views/administrador/resources_controller/base/_before_index_table.html.haml +0 -0
  68. data/app/views/administrador/resources_controller/base/_before_show_table.html.haml +0 -0
  69. data/app/views/administrador/resources_controller/base/_edit_actions.html.haml +7 -0
  70. data/app/views/administrador/resources_controller/base/_form.html.haml +10 -0
  71. data/app/views/administrador/resources_controller/base/_form_buttons.html.haml +1 -0
  72. data/app/views/administrador/resources_controller/base/_form_errors.html.haml +6 -0
  73. data/app/views/administrador/resources_controller/base/_html_head_extras.html.haml +0 -0
  74. data/app/views/administrador/resources_controller/base/_index_actions.html.haml +4 -0
  75. data/app/views/administrador/resources_controller/base/_index_table.html.haml +2 -0
  76. data/app/views/administrador/resources_controller/base/_index_table_actions.html.haml +16 -0
  77. data/app/views/administrador/resources_controller/base/_index_table_actions.html.haml~ +16 -0
  78. data/app/views/administrador/resources_controller/base/_new_actions.html.haml +3 -0
  79. data/app/views/administrador/resources_controller/base/_pagination.html.haml +1 -0
  80. data/app/views/administrador/resources_controller/base/_query_form.html.haml +0 -0
  81. data/app/views/administrador/resources_controller/base/_query_form_buttons.html.haml +2 -0
  82. data/app/views/administrador/resources_controller/base/_show_actions.html.haml +10 -0
  83. data/app/views/administrador/resources_controller/base/_show_table.html.haml +5 -0
  84. data/app/views/administrador/resources_controller/base/edit.html.haml +14 -0
  85. data/app/views/administrador/resources_controller/base/index.html.haml +33 -0
  86. data/app/views/administrador/resources_controller/base/new.html.haml +14 -0
  87. data/app/views/administrador/resources_controller/base/show.html.haml +19 -0
  88. data/app/views/administrador/service_controller/base/_create_actions.html.haml +3 -0
  89. data/app/views/administrador/service_controller/base/_create_after_service_output.html.haml +0 -0
  90. data/app/views/administrador/service_controller/base/_create_before_service_output.html.haml +0 -0
  91. data/app/views/administrador/service_controller/base/_form_buttons.haml +1 -0
  92. data/app/views/administrador/service_controller/base/_form_errors.html.haml +6 -0
  93. data/app/views/administrador/service_controller/base/_html_head_extras.html.haml +0 -0
  94. data/app/views/administrador/service_controller/base/_new_actions.html.haml +3 -0
  95. data/app/views/administrador/service_controller/base/create.html.haml +24 -0
  96. data/app/views/administrador/service_controller/base/new.html.haml +14 -0
  97. data/app/views/administrador/sidebar_controller/base/show.html.haml +1 -0
  98. data/app/views/breadcrumbs/_render.html.haml +7 -0
  99. data/app/views/layouts/administrador/application.html.haml +64 -0
  100. data/app/views/offcanvas_view_helper/_offcanvas.html.erb +11 -0
  101. data/config/initializers/localized_engines_fix.rb +3 -0
  102. data/config/locales/de.yml +76 -0
  103. data/config/locales/en.yml +46 -0
  104. data/config/routes.rb +8 -0
  105. data/lib/administrador/configuration.rb +24 -0
  106. data/lib/administrador/engine.rb +5 -0
  107. data/lib/administrador/feature.rb +7 -0
  108. data/lib/administrador/registered_engine.rb +73 -0
  109. data/lib/administrador/version.rb +3 -0
  110. data/lib/administrador.rb +19 -0
  111. data/lib/generators/administrador/install/install_generator.rb +19 -0
  112. data/lib/generators/administrador/install/templates/initializer.rb +11 -0
  113. data/lib/generators/administrador/install/templates/routes.source +4 -0
  114. data/lib/tasks/administrador_tasks.rake +4 -0
  115. metadata +493 -0
@@ -0,0 +1,59 @@
1
+ module Administrador
2
+ class BreadcrumbsViewHelper < Rao::ViewHelper::Base
3
+ def render
4
+ c.render partial: 'breadcrumbs/render', locals: { breadcrumbs: generate_breadcrumbs! }
5
+ end
6
+
7
+ private
8
+
9
+ def t(identifier, options = {})
10
+ if identifier.start_with?('.')
11
+ prefix = self.class.name.underscore
12
+ caller_method = caller[0].split(' ').last.gsub("'", '')
13
+ I18n.t("#{prefix}.#{caller_method}.#{identifier}", options)
14
+ else
15
+ I18n.t(identifier, options)
16
+ end
17
+ end
18
+
19
+ def generate_breadcrumbs!
20
+ [].tap do |breadcrumbs|
21
+ breadcrumbs << { label: t('.home'), url: c.administrador.root_path, link_html_options: {}, li_html_options: {}}
22
+
23
+ if c.respond_to?(:current_engine, true) && c.current_engine.present?
24
+ breadcrumbs << { label: t("classes.#{c.current_engine.name.underscore}"), url: send(c.current_engine.engine_name).root_path, link_html_options: {}, li_html_options: {} }
25
+ end
26
+
27
+ # if c.respond_to?(:resource_class, true)
28
+ # breadcrumbs << { label: c.resource_class.model_name.human(count: :other), url: c.url_for(action: :index), link_html_options: {}, li_html_options: {} }
29
+ # end
30
+
31
+ if r = c.instance_variable_get(:@resource).presence
32
+ if r.persisted?
33
+ breadcrumbs << { label: c.administrador_helper(c).label_for(r), url: c.url_for(action: :show, id: r.to_param), link_html_options: {}, li_html_options: {} }
34
+ end
35
+ end
36
+
37
+ # if respond_to?(:service_class, true)
38
+ # breadcrumbs << service_class.model_name.human
39
+ # end
40
+
41
+ action_namespace = c.respond_to?(:service_class, true) ? :service : :default
42
+
43
+ if %w(new edit).include?(c.action_name)
44
+ breadcrumbs << { label: t("controller.breadcrumbs_concern.actions.#{action_namespace}.#{c.action_name}"), url: { action: c.action_name }, link_html_options: {}, li_html_options: {} }
45
+ end
46
+
47
+ if %w(create update).include?(c.action_name)
48
+ breadcrumbs << { label: t("controller.breadcrumbs_concern.actions.#{action_namespace}.#{c.action_name}"), url: '#', link_html_options: {}, li_html_options: {} }
49
+ end
50
+
51
+ if c.params[:page].present?
52
+ breadcrumbs << { label: t('controller.breadcrumbs_concern.page', page_number: c.params[:page]), url: '#', link_html_options: {}, li_html_options: {} }
53
+ end
54
+
55
+ breadcrumbs.last[:li_html_options][:class] = 'active'
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,8 @@
1
+ module Administrador
2
+ class OffcanvasViewHelper < Rao::ViewHelper::Base
3
+ def offcanvas(id, options = {})
4
+ on_open_url = options.delete(:load)
5
+ c.render partial: 'offcanvas_view_helper/offcanvas', locals: { id: id, options: options, on_open_url: on_open_url }
6
+ end
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ %aside#offcanvas-right.py-2
@@ -0,0 +1,14 @@
1
+ %nav.navbar.navbar-light.fixed-top
2
+ #main-navbar-content
3
+ %ul.navbar-nav
4
+ %li.nav-item
5
+ %button.btn.btn-circle.btn-lg.btn-light#engine-sidebar-trigger
6
+ %i.fas.fa-bars
7
+ #main-navbar-tools
8
+ %ul.navbar-nav
9
+ - administrador_helper(self).engines.each do |_, engine|
10
+ - engine.sidebar_controllers.each do |sc|
11
+ %li.nav-item
12
+ %button.btn.btn-circle.btn-lg.btn-light{ id: "#{sc.name.underscore.gsub('/', '-')}-trigger" }
13
+ %i.fas{ class: "fa-#{sc.icon_name}"}
14
+
@@ -0,0 +1,32 @@
1
+ %aside#engine-sidebar.py-2
2
+ .container-fluid
3
+ .row
4
+ .col-12
5
+ - administrador_helper(self).engines.each do |_, engine|
6
+ .administrador-engine-in-sidebar.mb-4{ id: dom_id(engine), class: dom_class(engine) }
7
+ %h5.administrador-engine-name= engine.translated_name
8
+ .list-group
9
+ %a.list-group-item.administrador-link-to-engine-home{ href: send(engine.router_name).root_path }
10
+ %i.fas.fa-home
11
+ %span.hidden-sm-down.small= t('.home')
12
+ - engine.resources_controllers.each do |rc|
13
+ .list-group-item
14
+ %a.administrador-link-to-resources{ href: send(engine.router_name).url_for(controller: "/#{rc.name.underscore.gsub('_controller', '')}", action: :index) }
15
+ %i.fas.fa-folder
16
+ %span.hidden-sm-down.small= rc.resource_class.model_name.human(count: :other)
17
+ - if rc.available_rest_actions.include?(:new)
18
+ %a.float-right.btn.btn-xs.btn-primary.administrador-link-to-new-resources{ href: send(engine.router_name).url_for(controller: "/#{rc.name.underscore.gsub('_controller', '')}", action: :new) }
19
+ %i.fas.fa-plus
20
+ %span.administrador-object-count.float-right.badge.badge-pill.badge-light= rc.resource_count
21
+ - engine.resource_controllers.each do |rc|
22
+ .list-group-item
23
+ %a.administrador-link-to-resources{ href: send(engine.router_name).url_for(controller: "/#{rc.name.underscore.gsub('_controller', '')}", action: :show) }
24
+ %i.fas.fa-file
25
+ %span.hidden-sm-down.small= rc.resource_class.model_name.human
26
+ - if rc.available_rest_actions.include?(:new)
27
+ %a.float-right.btn.btn-xs.btn-primary.administrador-link-to-new-resources{ href: send(engine.router_name).url_for(controller: "/#{rc.name.underscore.gsub('_controller', '')}", action: :new) }
28
+ %i.fas.fa-plus
29
+ - engine.service_controllers.each do |sc|
30
+ %a.list-group-item{ href: send(engine.router_name).url_for(controller: "/#{sc.name.underscore.gsub('_controller', '')}", action: :new) }
31
+ %i.fas.fa-running
32
+ %span.hidden-sm-down.small= sc.service_class.model_name.human(count: :other)
@@ -0,0 +1,8 @@
1
+ %aside#i18n-sidebar.py-2
2
+ .container-fluid
3
+ .row
4
+ .col-12
5
+ %h5= t('.title')
6
+ .col-12
7
+ - I18n.available_locales.each do |locale|
8
+ = link_to(locale, url_for({ locale: locale }))
@@ -0,0 +1,5 @@
1
+ %aside#messages-sidebar.py-2
2
+ .container-fluid
3
+ .row
4
+ .col-12
5
+ %h5= t('.title')
@@ -0,0 +1,5 @@
1
+ %aside#notifications-sidebar.py-2
2
+ .container-fluid
3
+ .row
4
+ .col-12
5
+ %h5= t('.title')
@@ -0,0 +1,5 @@
1
+ %aside#search-sidebar.py-2
2
+ .container-fluid
3
+ .row
4
+ .col-12
5
+ %h5= t('.title')
@@ -0,0 +1,5 @@
1
+ %aside#settings-sidebar.py-2
2
+ .container-fluid
3
+ .row
4
+ .col-12
5
+ %h5= t('.title')
@@ -0,0 +1,5 @@
1
+ %aside#user-sidebar.py-2
2
+ .container-fluid
3
+ .row
4
+ .col-12
5
+ %h5= t('.title')
@@ -0,0 +1,3 @@
1
+ - flash.each do |message_context, message|
2
+ .alert.alert-dismissible.fade.show{ class: "alert-#{message_context}" }
3
+ = message
@@ -0,0 +1,4 @@
1
+ - engine.sidebar_controllers.each do |sc|
2
+ - id = sc.name.underscore.gsub('/', '-')
3
+ %aside.py-2{ id: "#{id}-sidebar" }
4
+ = offcanvas(self).offcanvas("#{id}-sidebar", modifiers: 'right,overlay', triggerButton: "##{id}-trigger", load: send(engine.router_name).url_for(controller: "/#{sc.name.underscore.gsub('_controller', '')}", action: :show, format: :html, only_path: true) )
@@ -0,0 +1,6 @@
1
+ .jumbotron.jumbotron-fluid
2
+ .container
3
+ %h1.display-4 Hallo,
4
+ %p.lead willkommen auf Deiner Administrationsoberfläche!
5
+ %hr.my-4/
6
+ %p Die in dieser Oberfläche verwalteten Inhalte findest Du mit einem Klick auf das Menü oben links. Zusätzliche Features sind über die Icons oben rechts zu finden.
@@ -0,0 +1,6 @@
1
+ .jumbotron.jumbotron-fluid
2
+ .container
3
+ %h1.display-4 Hello,
4
+ %p.lead welcome to your administration interface!
5
+ %hr.my-4/
6
+ %p Start by clicking on the menu on the left, where you can find the content that is managed throught this admin interface. Additional features are available from the top right menu icons.
@@ -0,0 +1,3 @@
1
+ .row
2
+ .col-12
3
+ %h3= t('.title', engine_name: t("classes.#{engine_class.name.underscore}"))
@@ -0,0 +1,7 @@
1
+ = link_to({ action: :show }, class: 'btn btn-light btn-responsive') do
2
+ %i.fas.fa-arrow-left
3
+ %span.btn-text= t('.back')
4
+
5
+ .ml-auto
6
+ = link_to({ action: :show }, class: 'btn btn-success btn-circle btn-lg') do
7
+ %i.fas.fa-eye
@@ -0,0 +1,8 @@
1
+ - administrador_helper(self).filter_attributes_for_form(resource_class.attribute_names).each do |name|
2
+ - if form.object.class.columns_hash[name].try(:type) == :hstore
3
+ = simple_fields_for name do |hstore_form|
4
+ - if form.object.send(name).respond_to?(:each)
5
+ - form.object.send(name).each do |key, value|
6
+ = hstore_form.input key, input_html: { value: value }
7
+ - else
8
+ = form.input name
@@ -0,0 +1 @@
1
+ = form.button :submit, class: 'btn btn-success'
@@ -0,0 +1,6 @@
1
+ - if resource.errors.any?
2
+ .error-explanation.alert.alert-danger
3
+ .error-heading= t('errors.template.header', count: resource.errors.count, model: resource.model_name.human)
4
+ %ul
5
+ - resource.errors.full_messages.each do |msg|
6
+ %li= msg
@@ -0,0 +1,3 @@
1
+ = link_to({ action: :show }, class: 'btn btn-light btn-responsive') do
2
+ %i.fas.fa-arrow-left
3
+ %span.btn-text= t('.back')
@@ -0,0 +1,6 @@
1
+ .ml-auto
2
+ = link_to(url_for([resource]), class: 'destroy btn btn-danger btn-circle btn-lg', method: :delete, 'data-confirm': I18n.t('administrador.controller.confirmations.destroy')) do
3
+ %i.fas.fa-fire
4
+
5
+ = link_to([:edit, resource], class: 'btn btn-success btn-circle btn-lg') do
6
+ %i.fas.fa-edit
@@ -0,0 +1,2 @@
1
+ - administrador_helper(self).filter_attributes_for_show(resource_class.attribute_names).each do |name|
2
+ = table.row name
@@ -0,0 +1,14 @@
1
+ .row
2
+ .col-12
3
+ %h1= t('.title', inflections)
4
+
5
+ .row
6
+ .col-12
7
+ = simple_form_for(@resource) do |form|
8
+ = render partial: 'form_errors', locals: { resource: form.object }
9
+ = render 'form', form: form
10
+ = render 'form_buttons', form: form
11
+
12
+ .row
13
+ .edit-actions.col-12.d-flex
14
+ = render partial: 'edit_actions', locals: { resource: @resource }
@@ -0,0 +1,14 @@
1
+ .row
2
+ .col-12
3
+ %h1= t('.title', inflections)
4
+
5
+ .row
6
+ .col-12
7
+ = simple_form_for(@resource, url: collection_path) do |form|
8
+ = render partial: 'form_errors', locals: { resource: form.object }
9
+ = render 'form', form: form
10
+ = render 'form_buttons', form: form
11
+
12
+ .row
13
+ .new-actions.col-12.d-flex
14
+ = render partial: 'new_actions'
@@ -0,0 +1,19 @@
1
+ .row
2
+ .col-12
3
+ %h1= administrador_helper(self).label_for(@resource)
4
+
5
+ .row
6
+ .col-12
7
+ .before-show-table= render 'before_show_table', locals: { resource: @resource }
8
+ .row
9
+ .col-12
10
+ = resource_table(resource: @resource) do |table|
11
+ = render 'show_table', table: table
12
+
13
+ .row
14
+ .col-12
15
+ .after-show-table= render 'after_show_table', locals: { resource: @resource }
16
+
17
+ .row
18
+ .show-actions.col-12.d-flex
19
+ = render partial: 'show_actions', locals: { resource: @resource }
@@ -0,0 +1,7 @@
1
+ = link_to({ action: :index }, class: 'btn btn-light btn-responsive') do
2
+ %i.fas.fa-arrow-left
3
+ %span.btn-text= t('.back')
4
+
5
+ .ml-auto
6
+ = link_to(resource, class: 'btn btn-success btn-circle btn-lg') do
7
+ %i.fas.fa-eye
@@ -0,0 +1,10 @@
1
+ - administrador_helper(self).filter_attributes_for_form(resource_class.attribute_names).each do |name|
2
+ - if form.object.class.columns_hash[name].try(:type) == :hstore
3
+ = simple_fields_for name do |hstore_form|
4
+ - if form.object.send(name).respond_to?(:each)
5
+ - form.object.send(name).each do |key, value|
6
+ = hstore_form.input key, input_html: { value: value }
7
+ - elsif name.end_with?('_id') && !resource_class.reflect_on_association(name.chomp('_id')).options[:polymorphic]
8
+ = form.association name.chomp("_id")
9
+ - else
10
+ = form.input name
@@ -0,0 +1 @@
1
+ = form.button :submit, class: 'btn btn-success'
@@ -0,0 +1,6 @@
1
+ - if resource.errors.any?
2
+ .error-explanation.alert.alert-danger
3
+ .error-heading= t('errors.template.header', count: resource.errors.count, model: resource.model_name.human)
4
+ %ul
5
+ - resource.errors.full_messages.each do |msg|
6
+ %li= msg
@@ -0,0 +1,4 @@
1
+ .ml-auto
2
+ - if available_rest_actions.include?(:new)
3
+ = link_to({ action: :new }, class: 'btn btn-success btn-circle btn-lg') do
4
+ %i.fas.fa-plus
@@ -0,0 +1,2 @@
1
+ - resource_class.attribute_names.each do |name|
2
+ = table.column name
@@ -0,0 +1,16 @@
1
+ = table.column(:actions, title: false) do |resource|
2
+ - capture_haml do
3
+ .w-100.d-flex
4
+ .btn-group.ml-auto
5
+ - if available_rest_actions.include?(:show)
6
+ = link_to(url_for([resource]), class: 'show btn btn-xs btn-responsive btn-primary') do
7
+ %i.fas.fa-eye
8
+ %span.btn-text= t('.show')
9
+ - if available_rest_actions.include?(:edit)
10
+ = link_to(url_for([:edit, resource]), class: 'edit btn btn-xs btn-responsive btn-secondary') do
11
+ %i.fas.fa-edit
12
+ %span.btn-text= t('.edit')
13
+ - if available_rest_actions.include?(:destroy)
14
+ = link_to(url_for([resource]), class: 'destroy btn btn-xs btn-responsive btn-danger', method: :delete, 'data-confirm': I18n.t('administrador.controller.confirmations.destroy')) do
15
+ %i.fas.fa-fire
16
+ %span.btn-text= t('.destroy')
@@ -0,0 +1,16 @@
1
+ = table.column(:actions, title: false) do |resource|
2
+ - capture_haml do
3
+ .w-100.d-flex
4
+ .btn-group.ml-auto
5
+ - if available_rest_actions.include?(:show)
6
+ = link_to({ action: :show, id: resource.to_param }, class: 'show btn btn-xs btn-responsive btn-primary') do
7
+ %i.fas.fa-eye
8
+ %span.btn-text= t('.show')
9
+ - if available_rest_actions.include?(:edit)
10
+ = link_to({ action: :edit, id: resource.to_param }, class: 'edit btn btn-xs btn-responsive btn-secondary') do
11
+ %i.fas.fa-edit
12
+ %span.btn-text= t('.edit')
13
+ - if available_rest_actions.include?(:destroy)
14
+ = link_to({ action: :show, id: resource.to_param }, class: 'destroy btn btn-xs btn-responsive btn-danger', method: :delete, 'data-confirm': I18n.t('administrador.controller.confirmations.destroy')) do
15
+ %i.fas.fa-fire
16
+ %span.btn-text= t('.destroy')
@@ -0,0 +1,3 @@
1
+ = link_to({ action: :index }, class: 'btn btn-light btn-responsive') do
2
+ %i.fas.fa-arrow-left
3
+ %span.btn-text= t('.back')
@@ -0,0 +1 @@
1
+ = paginate(collection, theme: 'twitter-bootstrap-4')
@@ -0,0 +1,2 @@
1
+ = form.button :submit, class: 'btn btn-success'
2
+ = link_to t('.reset'), {}, class: 'btn btn-secondary'
@@ -0,0 +1,10 @@
1
+ = link_to({ action: :index }, class: 'btn btn-light btn-responsive') do
2
+ %i.fas.fa-arrow-left
3
+ %span.btn-text= t('.back')
4
+
5
+ .ml-auto
6
+ = link_to(url_for([resource]), class: 'destroy btn btn-danger btn-circle btn-lg', method: :delete, 'data-confirm': I18n.t('administrador.controller.confirmations.destroy')) do
7
+ %i.fas.fa-fire
8
+
9
+ = link_to([:edit, resource], class: 'btn btn-success btn-circle btn-lg') do
10
+ %i.fas.fa-edit
@@ -0,0 +1,5 @@
1
+ - administrador_helper(self).filter_attributes_for_show(resource_class.attribute_names).each do |name|
2
+ - if name.end_with?('_id') && table.resource.respond_to?(name.chomp("_id"))
3
+ = table.association name.chomp("_id"), label_method: ->(r) { administrador_helper(self).label_for(r) }
4
+ - else
5
+ = table.row name
@@ -0,0 +1,14 @@
1
+ .row
2
+ .col-12
3
+ %h1= t('.title', inflections)
4
+
5
+ .row
6
+ .col-12
7
+ = simple_form_for(@resource) do |form|
8
+ = render partial: 'form_errors', locals: { resource: form.object }
9
+ = render 'form', form: form
10
+ = render 'form_buttons', form: form
11
+
12
+ .row
13
+ .edit-actions.col-12.d-flex
14
+ = render partial: 'edit_actions', locals: { resource: @resource }
@@ -0,0 +1,33 @@
1
+ .row
2
+ .col-12
3
+ %h1= t('.title', inflections)
4
+
5
+ - if Administrador.features?(:rao_query)
6
+ .row
7
+ .col-12
8
+ = query_helper(self).form_for(@collection, url: {}, html: { class: 'administrador-query-form form-inline' }, method: :get) do |f|
9
+ = render partial: 'query_form', locals: { form: f }
10
+ = render partial: 'query_form_buttons', locals: { form: f }
11
+ .row
12
+ .col-12
13
+ .before-index-table= render partial: 'before_index_table', locals: { collection: @collection }
14
+
15
+ .row
16
+ .col-12
17
+ = collection_table(collection: @collection, resource_class: resource_class, table_html: "table table-responsive #{resource_class.name.underscore.pluralize.gsub('/', '-')} table-xs") do |table|
18
+ = render partial: 'index_table', locals: { table: table }
19
+ = render partial: 'index_table_actions', locals: { table: table }
20
+
21
+ - if Administrador.features?(:kaminari) && @collection.respond_to?(:total_pages)
22
+ .row
23
+ .col-12.d-flex
24
+ .mx-auto
25
+ = render partial: 'pagination', locals: { collection: @collection }
26
+
27
+ .row
28
+ .col-12
29
+ .after-index-table= render 'after_index_table', locals: { collection: @collection }
30
+
31
+ .row
32
+ .index-actions.col-12.d-flex
33
+ = render partial: 'index_actions'
@@ -0,0 +1,14 @@
1
+ .row
2
+ .col-12
3
+ %h1= t('.title', inflections)
4
+
5
+ .row
6
+ .col-12
7
+ = simple_form_for(@resource, url: collection_path) do |form|
8
+ = render partial: 'form_errors', locals: { resource: form.object }
9
+ = render 'form', form: form
10
+ = render 'form_buttons', form: form
11
+
12
+ .row
13
+ .new-actions.col-12.d-flex
14
+ = render partial: 'new_actions'
@@ -0,0 +1,19 @@
1
+ .row
2
+ .col-12
3
+ %h1= administrador_helper(self).label_for(@resource)
4
+
5
+ .row
6
+ .col-12
7
+ .before-show-table= render partial: 'before_show_table', locals: { resource: @resource }
8
+ .row
9
+ .col-12
10
+ = resource_table(resource: @resource) do |table|
11
+ = render 'show_table', table: table
12
+
13
+ .row
14
+ .col-12
15
+ .after-show-table= render partial: 'after_show_table', locals: { resource: @resource }
16
+
17
+ .row
18
+ .show-actions.col-12.d-flex
19
+ = render partial: 'show_actions', locals: { resource: @resource }
@@ -0,0 +1,3 @@
1
+ = link_to({ action: :new }, class: 'btn btn-light btn-responsive') do
2
+ %i.fas.fa-arrow-left
3
+ %span.btn-text= t('.back')
@@ -0,0 +1 @@
1
+ = form.button :submit, class: 'btn btn-success', value: t('helpers.submit.administrador.service.create')
@@ -0,0 +1,6 @@
1
+ - if resource.errors.any?
2
+ .error-explanation.alert.alert-danger
3
+ .error-heading= t('errors.template.header', count: resource.errors.count, model: resource.model_name.human)
4
+ %ul
5
+ - resource.errors.full_messages.each do |msg|
6
+ %li= msg
@@ -0,0 +1,3 @@
1
+ = link_to(root_path, class: 'btn btn-light btn-responsive') do
2
+ %i.fas.fa-arrow-left
3
+ %span.btn-text= t('.back')
@@ -0,0 +1,24 @@
1
+ .row
2
+ .col-12
3
+ %h1= t('.title', inflections)
4
+
5
+ .row
6
+ .col-12
7
+ .create-before-service-output= render 'create_before_service_output', result: @result
8
+
9
+ .row
10
+ .col-12
11
+ %table.table.table-sm.table-striped.table-monospaced
12
+ %tbody
13
+ - @result.messages.each_with_index do |message, index|
14
+ %tr
15
+ %td= index + 1
16
+ %td= message
17
+
18
+ .row
19
+ .col-12
20
+ .create-after-service-output= render 'create_after_service_output', result: @result
21
+
22
+ .row
23
+ .create-actions.col-12.d-flex
24
+ = render partial: 'create_actions'
@@ -0,0 +1,14 @@
1
+ .row
2
+ .col-12
3
+ %h1= t('.title', inflections)
4
+
5
+ .row
6
+ .col-12
7
+ = simple_form_for(@service, url: create_service_path) do |form|
8
+ = render partial: 'form_errors', locals: { resource: form.object }
9
+ = render 'form', form: form
10
+ = render 'form_buttons', form: form
11
+
12
+ .row
13
+ .new-actions.col-12.d-flex
14
+ = render partial: 'new_actions'
@@ -0,0 +1 @@
1
+ <h3>administrador/sidebars_controller/base/show.html.haml</h3>
@@ -0,0 +1,7 @@
1
+ %nav{"aria-label" => "breadcrumb"}
2
+ %ol.breadcrumb
3
+ - breadcrumbs.each do |b|
4
+ - if b.is_a?(String)
5
+ %li.breadcrumb-item = b
6
+ - else
7
+ %li.breadcrumb-item{ b[:li_html_options] }= link_to(b[:label], b[:url], b[:link_html_options])