show.html.erb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <%#
  2. # Show
  3. This view is the template for the show page.
  4. It renders the attributes of a resource,
  5. as well as a link to its edit page.
  6. ## Local variables:
  7. - `page`:
  8. An instance of [Administrate::Page::Show][1].
  9. Contains methods for accessing the resource to be displayed on the page,
  10. as well as helpers for describing how each attribute of the resource
  11. should be displayed.
  12. [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
  13. %>
  14. <% content_for(:title) { "#{t("administrate.actions.show")} #{page.page_title}" } %>
  15. <header class="main-content__header" role="banner">
  16. <h1 class="main-content__page-title">
  17. <%= content_for(:title) %>
  18. </h1>
  19. <div>
  20. <%= link_to "Login As User", masquerade_path(page.resource), class: "button" %>
  21. <%= link_to(
  22. "#{t("administrate.actions.edit")} #{page.page_title}",
  23. [:edit, namespace, page.resource],
  24. class: "button",
  25. ) if valid_action? :edit %>
  26. </div>
  27. </header>
  28. <section class="main-content__body">
  29. <dl>
  30. <% page.attributes.each do |attribute| %>
  31. <dt class="attribute-label" id="<%= attribute.name %>">
  32. <%= t(
  33. "helpers.label.#{resource_name}.#{attribute.name}",
  34. default: attribute.name.titleize,
  35. ) %>
  36. </dt>
  37. <dd class="attribute-data attribute-data--<%=attribute.html_class%>"
  38. ><%= render_field attribute %></dd>
  39. <% end %>
  40. </dl>
  41. </section>