Skip to content

Commit

Permalink
Show Published at in Order Exhibits table
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrlc committed Aug 9, 2023
1 parent a769645 commit d6e4624
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/helpers/spotlight_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
module SpotlightHelper
include ::BlacklightHelper
include Spotlight::MainAppHelpers

def display_exhibit_published_date(exhibit)
return unless exhibit.published?

exhibit.published_at? ? l(exhibit.published_at, format: :long) : 'Unknown'
end
end
19 changes: 19 additions & 0 deletions app/views/spotlight/sites/_exhibit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<% exhibit = f.object %>
<tr class="dd-item dd3-item" data-id="<%= exhibit.id %>">
<td>
<div class="handle-wrap">
<div class="dd-handle dd3-handle"><%= t :drag %></div>

<%= f.hidden_field :id %>
<%= f.hidden_field :weight, data: { property: "weight" } %>

<%= link_to exhibit.title, exhibit %>
</div>

</td>
<td class="text-right"><%= exhibit.published? ? t(:'.published') : t(:'.unpublished') %></td>
<td class="text-right"><%= display_exhibit_published_date(exhibit) %></td>
<td class="text-right"><%= exhibit.requested_by %></td>
<td class="text-right"><%= l exhibit.created_at, format: :long %></td>
<td class="text-right"><%= l exhibit.updated_at, format: :long %></td>
</tr>
32 changes: 32 additions & 0 deletions app/views/spotlight/sites/edit_exhibits.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<%= page_title(t('.page_title')) %>
<%= bootstrap_form_for @site, url: spotlight.site_path, layout: :horizontal, label_col: 'col-md-2', control_col: 'col-md-10' do |f| %>
<p class="instructions"><%= t :'.instructions' %></p>
<table class="table table-striped dd-table">
<thead>
<tr>
<th><%= Spotlight::Exhibit.human_attribute_name(:title) %></th>
<th class="text-right"><%= Spotlight::Exhibit.human_attribute_name(:published) %></th>
<th class="text-right"><%= Spotlight::Exhibit.human_attribute_name(:published_at) %></th>
<th class="text-right"><%= Spotlight::Exhibit.human_attribute_name(:requested_by) %></th>
<th class="text-right"><%= Spotlight::Exhibit.human_attribute_name(:created_at) %></th>
<th class="text-right"><%= Spotlight::Exhibit.human_attribute_name(:updated_at) %></th>
</tr>
</thead>
<tbody class="table metadata_fields dd dd-list" data-behavior="nestable" data-max-depth="1" data-list-node-name="tbody" data-item-node-name="tr" data-expand-btn-HTML=" " data-collapse-btn-HTML=" ">
<%= f.fields_for :exhibits do |exhibit_form| %>
<%= render partial: 'exhibit', locals: { f: exhibit_form } %>
<% end %>
</tbody>
</table>

<div class="form-actions">
<div class="primary-actions">
<%= f.submit nil, class: 'btn btn-primary' %>
</div>
</div>
<% end %>

<% content_for(:sidebar_position) { 'order-last' } %>
<% content_for(:sidebar) do %>
<%= render 'shared/site_sidebar' %>
<% end %>

0 comments on commit d6e4624

Please sign in to comment.