Browse Source

Fix `document#date`

pull/112/head
alexdbondoc17 4 years ago
parent
commit
1c8bd06a3f
  1. 4
      app/views/shared/_annotated_documents_search_results.html.erb
  2. 4
      app/views/shared/_case_lists_search_results.html.erb
  3. 59
      app/views/shared/_doctrines_pagination.html.erb
  4. 4
      app/views/shared/_document_doctrines_index.html.erb

4
app/views/shared/_annotated_documents_search_results.html.erb

@ -81,11 +81,11 @@
<tr>
<td> <%= document.clean_reference_number %> </td>
<td> <%= document.short_title || document.title %> </td>
<td> <%= document.doc_date.present? ? document.doc_date : document.year %> </td>
<td> <%= document.doc_date.present? ? document.doc_date.strftime("%B %d, %Y") : document.year %> </td>
<td>
<a class="btn btn-success" data-controller="annotations" data-document-id="<%= document.id %>"
data-document-reference-number="<%= document.clean_reference_number %>"
data-document-date="<%= document.doc_date || document.year %>"
data-document-date="<%= document.doc_date.present? ? document.doc_date.strftime("%B %d, %Y") || document.year %>"
data-document-title="<%= document.short_title || document.title %>"
data-action="click->annotations#addAnnotatedDocument" >
Add

4
app/views/shared/_case_lists_search_results.html.erb

@ -92,9 +92,9 @@
<tr>
<td style="width: 25%"> <%= document.clean_reference_number %> </td>
<td style="width: 45%"> <%= document.short_title || document.title %> </td>
<td style="width: 15%"> <%= document.doc_date.present? ? document.doc_date : document.year %> </td>
<td style="width: 15%"> <%= document.doc_date.present? ? document.doc_date.strftime("%B %d, %Y") : document.year %> </td>
<td>
<% date_or_year = document.doc_date || document.year %>
<% date_or_year = document.doc_date.strftime("%B %d, %Y") || document.year %>
<% title = document.short_title || document.title %>
<a class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#annotationModal" data-controller="annotations"
data-current-document-id="<%= opts[:current_document_id] %>" data-doctrine-id="<%= opts[:doctrine_id] %>"

59
app/views/shared/_doctrines_pagination.html.erb

@ -0,0 +1,59 @@
<header class="header bg-white b-b clearfix m-2">
<div class="row m-t-sm align-items-end pagination-body">
<div class="<%= doctrines.present? ? "col-md-6 mb-0 " : "col-md-12 mb-0"%> ">
<small style="color: darkred">
<%= page_entries_info doctrines, entry_name: 'records' if doctrines.present? %>
</small>
</div>
<div class="<%= doctrines.present? ? "col-md-6 position-relative" : "d-none"%>">
<div class="text-center pagination justify-content-end me-3">
<nav class="pagination pagination-sm" role="navigation" aria-label="pager">
<% unless doctrines.first_page? %>
<span class="page-item first">
<a class="page-link" data-controller="doctrines" data-document-id="<%= opts[:document_id] %>"
data-page="<%= 1 %>" data-action="click->doctrines#paginate">
<i class="fas fa-angle-double-left"></i>
</a>
</span>
<span class="page-item prev">
<a class="page-link" data-controller="doctrines" data-document-id="<%= opts[:document_id] %>"
data-page="<%= opts[:current_page].to_i - 1 %>" data-action="click->doctrines#paginate">
<i class="fas fa-angle-left"></i>
</a>
</span>
<% end %>
<% doctrines.total_pages.times do |page| -%>
<% if (page + 1) <= (opts[:current_page].to_i + 4) && (page + 1) >= (opts[:current_page].to_i - 4) %>
<% if opts[:current_page].to_i.eql?(page + 1) %>
<span class="page-item page current page-link"> <%= page + 1 %> </span>
<% else %>
<span class="page-item page">
<a class="page-link" data-controller="doctrines" data-document-id="<%= opts[:document_id] %>"
data-page="<%= page + 1 %>" data-action="click->doctrines#paginate"> <%= page + 1 %> </a>
</span>
<% end %>
<% end %>
<% end -%>
<% unless doctrines.last_page? %>
<span class="page-item next">
<a class="page-link" data-controller="doctrines" data-document-id="<%= opts[:document_id] %>"
data-page="<%= opts[:current_page].to_i + 1 %>" data-action="click->doctrines#paginate">
<i class="fas fa-angle-right"></i>
</a>
</span>
<span class="page-item last">
<a class="page-link" data-controller="doctrines" data-document-id="<%= opts[:document_id] %>"
data-page="<%= doctrines.total_pages %>" data-action="click->doctrines#paginate">
<i class="fas fa-angle-double-right"></i>
</a>
</span>
<% end %>
</nav>
</div>
</div>
</div>
</header>

4
app/views/shared/_document_doctrines_index.html.erb

@ -0,0 +1,4 @@
<div class="container-sm row-flex col-sm-12 p-0 doct-body-index" id="documentDoctrinesIndex">
<%= render(partial: "/shared/doctrines_pagination", locals: { doctrines: doctrines, opts: opts }) %>
<%= render(DocumentDoctrineIndexComponent.with_collection(doctrines, current_user: current_user, opts: { document_id: opts[:document_id] })) %>
</div>
Loading…
Cancel
Save