diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index 64fa2f0e9..64535cbbe 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - module Admin class ServicesController < Admin::ApplicationController # Overwrite any of the RESTful controller actions to implement custom behavior @@ -38,11 +36,11 @@ class ServicesController < Admin::ApplicationController # # def resource_params # params.require(resource_class.model_name.param_key). - # permit(dashboard.permitted_attributes). + # permit(dashboard.permitted_attributes(action_name)). # transform_values { |value| value == "" ? nil : value } # end - # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # See https://administrate-demo.herokuapp.com/customizing_controller_actions # for more information end end diff --git a/app/dashboards/service_dashboard.rb b/app/dashboards/service_dashboard.rb index 3dde3cd7b..ef70b6a45 100644 --- a/app/dashboards/service_dashboard.rb +++ b/app/dashboards/service_dashboard.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require "administrate/base_dashboard" class ServiceDashboard < Administrate::BaseDashboard @@ -10,10 +8,10 @@ class ServiceDashboard < Administrate::BaseDashboard # which determines how the attribute is displayed # on pages throughout the dashboard. ATTRIBUTE_TYPES = { + id: Field::Number, cause: Field::BelongsTo, location_services: Field::HasMany, locations: Field::HasMany, - id: Field::Number, name: Field::String, created_at: Field::DateTime, updated_at: Field::DateTime @@ -62,8 +60,4 @@ class ServiceDashboard < Administrate::BaseDashboard # def display_resource(service) # "Service ##{service.id}" # end - - def display_resource(service) - service.name - end end diff --git a/app/views/admin/organizations/_collection.html.erb b/app/views/admin/organizations/_collection.html.erb index 1a3915eff..fafe8b01f 100644 --- a/app/views/admin/organizations/_collection.html.erb +++ b/app/views/admin/organizations/_collection.html.erb @@ -24,17 +24,17 @@ to display a collection of resources in an HTML table. <% collection_presenter.attribute_types.each do |attr_name, attr_type| %> + cell-label--<%= "#{collection_presenter.resource_name}_#{attr_name}" %>" scope="col" - role="columnheader" aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"> <%= link_to(sanitized_order_params(page, collection_field_name).merge( collection_presenter.order_params_for(attr_name, key: collection_field_name) )) do %> <%= t( "helpers.label.#{collection_presenter.resource_name}.#{attr_name}", - default: resource_class.human_attribute_name(attr_name), - ).titleize %> + default: resource_class.human_attribute_name(attr_name).titleize, + ) %> <% if collection_presenter.ordered_by?(attr_name) %>
- <%= render_field attribute, f: f %> -
+ <% page.attributes(controller.action_name).each do |title, attributes| -%> +
"> + <% if title.present? %> + <%= t "helpers.label.#{f.object_name}.#{title}", default: title %> + <% end %> + + <% attributes.each do |attribute| %> +
+ <%= render_field attribute, f: f %> + + <% hint_key = "administrate.field_hints.#{page.resource_name}.#{attribute.name}" %> + <% if I18n.exists?(hint_key) -%> +
+ <%= I18n.t(hint_key) %> +
+ <% end -%> +
+ <% end %> +
<% end -%>
diff --git a/app/views/admin/organizations/edit.html.erb b/app/views/admin/organizations/edit.html.erb index abacffce4..6c7484551 100644 --- a/app/views/admin/organizations/edit.html.erb +++ b/app/views/admin/organizations/edit.html.erb @@ -17,7 +17,7 @@ It displays a header, and renders the `_form` partial to do the heavy lifting. <% content_for(:title) { t("administrate.actions.edit_resource", name: page.page_title) } %> -
diff --git a/app/views/admin/organizations/index.html.erb b/app/views/admin/organizations/index.html.erb index 89d8dcf31..21a8e013d 100644 --- a/app/views/admin/organizations/index.html.erb +++ b/app/views/admin/organizations/index.html.erb @@ -58,5 +58,6 @@ It renders the `_table` partial to display details about the resources. resources: resources, table_title: "page-title" ) %> - <%= paginate resources, param_name: '_page' %> + + <%= render("pagination", resources: resources) %> diff --git a/app/views/admin/organizations/new.html.erb b/app/views/admin/organizations/new.html.erb index d90cc6800..adacff316 100644 --- a/app/views/admin/organizations/new.html.erb +++ b/app/views/admin/organizations/new.html.erb @@ -22,7 +22,7 @@ to do the heavy lifting. ) %> <% end %> -