Browse Source

Enhance UI for `doctrines` and `annotations`

pull/110/head
alexdbondoc17 4 years ago
parent
commit
7b4d5481ae
  1. 4
      app/components/doctrine_index_component/doctrine_index_component.html.erb
  2. 4
      app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb
  3. 6
      app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb

4
app/components/doctrine_index_component/doctrine_index_component.html.erb

@ -8,7 +8,7 @@
<% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.to_date.strftime("%B %d, %Y") : jurisprudence.year %>
<h5 class="clickable-link" style="color: darkred;" href="<%= document_path(jurisprudence, is_index_table: false, subject_ids: params[:subject_ids]) %>"> <%= [document_title, jurisprudence.reference_number, date_or_year].join(", ") %> </h5>
<% annotations.order(created_at: :desc).each do |annotation| %>
<% annotations.sort_by { |a| [a.document.library.rank, -a.document.year, -a.document.doc_date.strftime("%Y-%m-%d")] }.each do |annotation| %>
<p class="mb-2 ms-3 clickable-link" href="<%= show_url %>">
<% annotated_documents_title = [] %>
<% annotation.documents.each do |annotated_document| %>
@ -18,7 +18,7 @@
<% end %>
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong>
<%= raw [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %>
<%= raw annotation.content.present? ? annotation.content : [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %>
</p>
<% if annotation.editor_notes.present? %>

4
app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb

@ -25,7 +25,7 @@
<h5 style="color: darkred;"> <%= [document_title, jurisprudence.reference_number, date_or_year].join(", ") %> </h5>
<% end %>
<% annotations.order(created_at: :desc).each do |annotation| %>
<% annotations.sort_by { |a| [a.document.library.rank, -a.document.year, -a.document.doc_date.strftime('%Y-%m-%d')] }.each do |annotation| %>
<p class="mb-2 ms-3">
<% annotated_documents_title = [] %>
<% annotation.documents.each do |annotated_document| %>
@ -35,7 +35,7 @@
<% end %>
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong>
<%= raw [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %>
<%= raw annotation.content.present? ? annotation.content : [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %>
</p>
<% if annotation.editor_notes.present? %>

6
app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb

@ -85,7 +85,7 @@
<div class="row-flex">
<div class="annot-header"> <h5> Annotations </h5> </div>
<div class="" id="annotationsIndexView">
<% doctrine.annotations.order(created_at: :desc).each do |annotation| %>
<% annotations.sort_by { |a| [a.document.library.rank, -a.document.year, -a.document.doc_date.strftime("%Y-%m-%d")] }.each do |annotation| %>
<% document_title = annotation.document.short_title || annotation.document.title %>
<% date_or_year = annotation.document.docdate.present? ? annotation.document.docdate.strftime("%B %d, %Y") : annotation.document.year %>
<% annotated_documents_title = [] %>
@ -100,14 +100,14 @@
<div class="col-sm-10">
<p class="pb-0 ms-3">
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong>
<%= raw citing_document_title %>
<%= raw annotation.content.present? ? annotation.content : citing_document_title %>
</p>
</div>
<div class="col-sm-2 d-flex justify-content-end align-items-baseline">
<a class="btn btn-secondary me-3" data-bs-toggle="modal" data-bs-target="#annotationModal"
data-controller="annotations" data-doctrine-id="<%= id %>" data-annotation-id="<%= annotation.id %>"
data-current-document-id="<%= document_id %>" data-document-title="<%= citing_document_title %>"
data-current-document-id="<%= document_id %>" data-document-title="<%= annotation.content.present? ? annotation.content : citing_document_title %>"
data-action="click->annotations#renderForm"> Edit </a>
<a class="btn btn-danger" data-controller="annotations" data-current-document-id="<%= document_id %>" data-doctrine-id="<%= id %>" data-annotation-id="<%= annotation.id %>" data-action="click->annotations#delete" > Delete </a>
</div>

Loading…
Cancel
Save