From 5eda462b95c0322ce63da277f947868687ca4f0e Mon Sep 17 00:00:00 2001 From: alexdbondoc17 Date: Tue, 8 Feb 2022 01:45:56 +0000 Subject: [PATCH] Additional Fixes for UIs --- .../doctrine_index_table_component.html.erb | 2 -- app/components/document_doctrine_show_component.rb | 2 +- .../document_doctrine_show_component.html.erb | 2 +- .../subject_accordion_component.html.erb | 8 ++++---- app/components/subject_index_form_component.rb | 2 +- .../subjects_sidenav_sub_menu_component.html.erb | 10 +++++----- app/controllers/doctrine/annotations_controller.rb | 5 ++--- app/views/documents/index.html.erb | 4 ++-- app/views/documents/show.html.erb | 2 +- app/views/subject_indexes/index.html.erb | 2 +- 10 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb b/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb index 81af1cb..cff8648 100644 --- a/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb +++ b/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb @@ -3,7 +3,6 @@ Reference Number Title Date - PhilRep @@ -12,7 +11,6 @@ <%= document_reference_number(search_result.document) %> <%= document_title(search_result.document) %> <%= date_or_year(search_result.document) %> - <%= search_result.annotations.map(&:phil_rep).join(", ") %> <% end %> diff --git a/app/components/document_doctrine_show_component.rb b/app/components/document_doctrine_show_component.rb index 010b971..4967499 100644 --- a/app/components/document_doctrine_show_component.rb +++ b/app/components/document_doctrine_show_component.rb @@ -34,7 +34,7 @@ class DocumentDoctrineShowComponent < BaseComponent end def all_subjects - Cdao::Subject.all + Cdao::Subject.all.order(name: :asc) end def date_or_year(annotation) diff --git a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb index bb7ee09..1831b78 100644 --- a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb +++ b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb @@ -162,7 +162,7 @@ <% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %> <% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %> <% end %> - <%= raw [document_title, annotation.document.reference_number, date_or_year, annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ').html_safe %> + <%= raw [document_title, annotation.document.reference_number, date_or_year, annotation.phil_rep].reject(&:blank?).join(', ').html_safe %>

diff --git a/app/components/subject_accordion_component/subject_accordion_component.html.erb b/app/components/subject_accordion_component/subject_accordion_component.html.erb index e51103b..7a0011c 100644 --- a/app/components/subject_accordion_component/subject_accordion_component.html.erb +++ b/app/components/subject_accordion_component/subject_accordion_component.html.erb @@ -1,4 +1,4 @@ -<% parent.children.each do |sub1| %> +<% parent.children.order(name: :asc).each do |sub1| %>
@@ -15,7 +15,7 @@
" data-bs-parent="#secondLevelPanel<%= sub1.id %>">
- <% sub1.children.each do |sub2| %> + <% sub1.children.order(name: :asc).each do |sub2| %>
@@ -32,7 +32,7 @@
" data-bs-parent="#thirdLevelPanel<%= sub2.id %>">
- <% sub2.children.each do |sub3| %> + <% sub2.children.order(name: :asc).each do |sub3| %>
@@ -49,7 +49,7 @@
" data-bs-parent="#fourthLevelPanel<%= sub3.id %>">
- <% sub3.children.each do |sub4| %> + <% sub3.children.order(name: :asc).each do |sub4| %>
diff --git a/app/components/subject_index_form_component.rb b/app/components/subject_index_form_component.rb index 2270174..1089cbf 100644 --- a/app/components/subject_index_form_component.rb +++ b/app/components/subject_index_form_component.rb @@ -8,7 +8,7 @@ class SubjectIndexFormComponent < BaseComponent end def all_subjects - Cdao::Subject.all + Cdao::Subject.all.order(name: :asc) end def current_library diff --git a/app/components/subjects_sidenav_sub_menu_component/subjects_sidenav_sub_menu_component.html.erb b/app/components/subjects_sidenav_sub_menu_component/subjects_sidenav_sub_menu_component.html.erb index 6846e7b..bdc14a0 100644 --- a/app/components/subjects_sidenav_sub_menu_component/subjects_sidenav_sub_menu_component.html.erb +++ b/app/components/subjects_sidenav_sub_menu_component/subjects_sidenav_sub_menu_component.html.erb @@ -1,6 +1,6 @@
- <% Cdao::Subject.roots.each do |root| %> + <% Cdao::Subject.roots.order(name: :asc).each do |root| %>
@@ -13,7 +13,7 @@ <% end %>
- <% if root.children.present? %> + <% if root.children.order(name: :asc).present? %>
<% root.children.each do |sub1| %> @@ -31,7 +31,7 @@
- <% sub1.children.each do |sub2| %> + <% sub1.children.order(name: :asc).each do |sub2| %>
@@ -46,7 +46,7 @@
- <% sub2.children.each do |sub3| %> + <% sub2.children.order(name: :asc).each do |sub3| %>
@@ -61,7 +61,7 @@
- <% sub3.children.each do |sub4| %> + <% sub3.children.order(name: :asc).each do |sub4| %>
<%= link_to sub4.name, index_url(sub4.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub5 clickable-link" %> diff --git a/app/controllers/doctrine/annotations_controller.rb b/app/controllers/doctrine/annotations_controller.rb index cd1ad5b..f62e0c9 100644 --- a/app/controllers/doctrine/annotations_controller.rb +++ b/app/controllers/doctrine/annotations_controller.rb @@ -19,9 +19,8 @@ class Doctrine::AnnotationsController < ApplicationController respond_to do |format| if @annotation.save - @documents.each do |document| - @annotation.add_document(document) - end + @documents.each { |document| @annotation.add_document(document) } if @documents.present? + format.html { redirect_to document_doctrine_path(@doctrine.document, @doctrine), notice: "Doctrine Annotation was successfully created." } else diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index c655c2b..18ba62a 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -21,8 +21,8 @@ diff --git a/app/views/subject_indexes/index.html.erb b/app/views/subject_indexes/index.html.erb index 238cbd8..ca94fee 100644 --- a/app/views/subject_indexes/index.html.erb +++ b/app/views/subject_indexes/index.html.erb @@ -4,7 +4,7 @@

Subjects

- <% Cdao::Subject.roots.all.each do |root| %> + <% Cdao::Subject.roots.order(name: :asc).each do |root| %>