uklibraries / metadata_editor

Metadata editor satisfying the KDL metadata guidelines
0 stars 0 forks source link

Improve view helpers #14

Closed cokernel closed 11 years ago

cokernel commented 11 years ago

Our views are a little close to the ground right now:

<% [
     :name,
     :email,
     :url,
     :street_address,
     :abstract,
   ].each do |field|
   %>

<p>
  <b><%= field.to_s.humanize %>:</b>
  <%= @repository.send(field) %>
</p>

<% end %>

Compare this to the partial _show.html.erb for documents in Blacklight:

<%# default partial to display solr document fields in catalog show view -%>
<dl class="dl-horizontal  dl-invert">
  <% document_show_fields(document).each do |solr_fname, field| -%>
    <% if should_render_show_field? document, field %>
        <dt class="blacklight-<%= solr_fname.parameterize %>"><%= render_document_show_field_label document, :field => solr_fname %></dt>
        <dd class="blacklight-<%= solr_fname.parameterize %>"><%= render_document_show_field_value document, :field => solr_fname %></dd>
    <% end -%>
  <% end -%>
</dl>

We should add methods to our application that set the fields to display, their order, and their alternative labels, if any (useful for the url field, since :url.to_s.humanize == "Url"). Blacklight does this in (e.g.) the catalog controller, with configuration that looks like this:

    config.add_show_field 'title_display', :label => 'Title:'
    config.add_show_field 'title_vern_display', :label => 'Title:'
    config.add_show_field 'subtitle_display', :label => 'Subtitle:'
cokernel commented 11 years ago

I think the changes in #34 remove most of the need for fully configurable index/show fields for now.