Browse Source

Fix `sorting` of `annotation`

pull/96/head
alexdbondoc17 4 years ago
parent
commit
bf755666ef
  1. 2
      app/components/doctrine_index_component/doctrine_index_component.html.erb
  2. 2
      app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb
  3. 2
      app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb
  4. 3
      app/models/annotation.rb

2
app/components/doctrine_index_component/doctrine_index_component.html.erb

@ -9,7 +9,7 @@
<p class="fw-bold fst-normal"> <%= headnote %> </p> <p class="fw-bold fst-normal"> <%= headnote %> </p>
<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> <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.each do |annotation| %> <% annotations.order(created_at: :desc).each do |annotation| %>
<p class="mb-2 ms-3 clickable-link" href="<%= show_url %>"> <p class="mb-2 ms-3 clickable-link" href="<%= show_url %>">
<% annotated_documents_title = [] %> <% annotated_documents_title = [] %>
<% annotation.documents.each do |annotated_document| %> <% annotation.documents.each do |annotated_document| %>

2
app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb

@ -26,7 +26,7 @@
<h5 style="color: darkred;"> <%= [document_title, jurisprudence.reference_number, date_or_year].join(", ") %> </h5> <h5 style="color: darkred;"> <%= [document_title, jurisprudence.reference_number, date_or_year].join(", ") %> </h5>
<% end %> <% end %>
<% annotations.each do |annotation| %> <% annotations.order(created_at: :desc).each do |annotation| %>
<p class="mb-2 ms-3"> <p class="mb-2 ms-3">
<% annotated_documents_title = [] %> <% annotated_documents_title = [] %>
<% annotation.documents.each do |annotated_document| %> <% annotation.documents.each do |annotated_document| %>

2
app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb

@ -89,7 +89,7 @@
<div class="annot-header"> <h5> Annotations </h5> </div> <div class="annot-header"> <h5> Annotations </h5> </div>
<div class="" id="annotationsIndexView"> <div class="" id="annotationsIndexView">
<%= render(partial: "/shared/annotations_pagination", locals: { annotations: annotations, opts: { current_page: 1 } }) %> <%= render(partial: "/shared/annotations_pagination", locals: { annotations: annotations, opts: { current_page: 1 } }) %>
<% annotations.each do |annotation| %> <% annotations.order(created_at: :desc).each do |annotation| %>
<% document_title = annotation.document.short_title || annotation.document.title %> <% 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 %> <% date_or_year = annotation.document.docdate.present? ? annotation.document.docdate.strftime("%B %d, %Y") : annotation.document.year %>
<% annotated_documents_title = [] %> <% annotated_documents_title = [] %>

3
app/models/annotation.rb

@ -33,6 +33,9 @@ class Annotation < ApplicationRecord
integer :document_id integer :document_id
integer :doctrine_id integer :doctrine_id
date :created_at
date :updated_at
text :phil_rep text :phil_rep
string :phil_rep string :phil_rep

Loading…
Cancel
Save