Browse Source

Merge pull request #136 from lexintegritastech/fix-ux-for-clickable-links

Fix UX for clickable links
pull/137/head
Alexander D. Bondoc 4 years ago committed by GitHub
parent
commit
63755e8268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/components/citation_index_table_component/citation_index_table_component.html.erb
  2. 10
      app/components/doctrine_index_component/doctrine_index_component.html.erb
  3. 10
      app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb
  4. 6
      app/components/doctrines_offcanvas_accordion_component/doctrines_offcanvas_accordion_component.html.erb
  5. 6
      app/components/doctrines_offcanvas_component/doctrines_offcanvas_component.html.erb
  6. 72
      app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb
  7. 3
      app/components/jurisprudences_index_table_component/jurisprudences_index_table_component.html.erb
  8. 64
      app/components/reports_search_results_component/reports_search_results_component.html.erb
  9. 12
      app/components/subjects_accordion_component/subjects_accordion_component.html.erb
  10. 6
      app/components/subjects_offcanvas_accordion_component/subjects_offcanvas_accordion_component.html.erb
  11. 6
      app/components/subjects_offcanvas_component/subjects_offcanvas_component.html.erb
  12. 2
      app/controllers/concerns/document_search.rb
  13. 2
      app/controllers/concerns/jurisprudence_search.rb
  14. 26
      app/javascript/controllers/application_controller.js
  15. 1
      app/javascript/controllers/doctrines_controller.js
  16. 3
      app/javascript/controllers/subjects_controller.js
  17. 9
      app/models/cdao/subject.rb
  18. 4
      app/views/documents/show.html.erb
  19. 6
      app/views/subject_indexes/index.html.erb
  20. 6
      app/views/subject_indexes/show.html.erb

2
app/components/citation_index_table_component/citation_index_table_component.html.erb

@ -1,4 +1,4 @@
<tr href="<%= document_path(search_result.id, is_citator_tab: true) %>" class="clickable-tr" target="_blank"> <tr class="clickable-tr" data-controller="application" data-href="<%= document_path(search_result.id, is_citator_tab: true) %>" data-action="click->application#openLinkToNewTab">
<td> <%= clean_reference_number %> </td> <td> <%= clean_reference_number %> </td>
<td> <%= short_title || title %> </td> <td> <%= short_title || title %> </td>
<td> <%= date_or_year %> </td> <td> <%= date_or_year %> </td>

10
app/components/doctrine_index_component/doctrine_index_component.html.erb

@ -11,10 +11,12 @@
<% grouped_by_juris_search_params = { subject_ids: opts[:subject_ids], content: content_result.content, is_grouped_by_juris_id: true } %> <% grouped_by_juris_search_params = { subject_ids: opts[:subject_ids], content: content_result.content, is_grouped_by_juris_id: true } %>
<% search_doctrines(grouped_by_juris_search_params).group(:jurisprudence_id).groups.each do |grouped_by_juris| %> <% search_doctrines(grouped_by_juris_search_params).group(:jurisprudence_id).groups.each do |grouped_by_juris| %>
<% grouped_by_juris.results.each do |juris_result| %> <% grouped_by_juris.results.each do |juris_result| %>
<h5 class="clickable-link" style="color: darkred;" href="<%= document_path(juris_result.jurisprudence.document.id, is_index_table: false, subject_ids: params[:subject_ids]) %>"> <h5 class="clickable-link" style="color: darkred;" data-controller="application"
<% document_title = juris_result.jurisprudence.short_title || juris_result.jurisprudence.title %> data-href="<%= document_path(juris_result.jurisprudence.document.id, is_index_table: false, subject_ids: params[:subject_ids]) %>"
<% date_or_year = juris_result.jurisprudence.doc_date.present? ? juris_result.jurisprudence.doc_date.strftime("%B, %d, %Y") : doctrine.jurisprudence.year %> data-action="click->application#openLink">
<%= [document_title, juris_result.jurisprudence.clean_reference_number, date_or_year].join(", ") %> <% document_title = juris_result.jurisprudence.short_title || juris_result.jurisprudence.title %>
<% date_or_year = juris_result.jurisprudence.doc_date.present? ? juris_result.jurisprudence.doc_date.strftime("%B, %d, %Y") : doctrine.jurisprudence.year %>
<%= [document_title, juris_result.jurisprudence.clean_reference_number, date_or_year].join(", ") %>
</h5> </h5>
<% search_params = { subject_ids: opts[:subject_ids], headnote: uniq_by_headnote.headnote, content: content_result.content, jurisprudence_id: juris_result.jurisprudence.id } %> <% search_params = { subject_ids: opts[:subject_ids], headnote: uniq_by_headnote.headnote, content: content_result.content, jurisprudence_id: juris_result.jurisprudence.id } %>

10
app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb

@ -7,10 +7,12 @@
<tbody> <tbody>
<% search_results.each do |search_result| %> <% search_results.each do |search_result| %>
<tr href="<%= document_path(search_result.document.id, is_index_table: true, subject_ids: opts[:subject_ids]) %> " class="clickable-link"> <tr class="clickable-link" data-controller="application"
<td> <%= document_reference_number(search_result) %> </td> data-href="<%= document_path(search_result.document.id, is_index_table: true, subject_ids: opts[:subject_ids]) %>"
<td> <%= document_title(search_result) %> </td> data-action="click->application#openLink">
<td> <%= date_or_year(search_result) %> </td> <td> <%= document_reference_number(search_result) %> </td>
<td> <%= document_title(search_result) %> </td>
<td> <%= date_or_year(search_result) %> </td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

6
app/components/doctrines_offcanvas_accordion_component/doctrines_offcanvas_accordion_component.html.erb

@ -5,10 +5,12 @@
<div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>" <div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>"
data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>" data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>"
data-action="click->subjects#loadDoctrinesOffcanvasAccordion"> data-action="click->subjects#loadDoctrinesOffcanvasAccordion">
<%= link_to search_result["name"], index_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link" %> <%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link",
data: { controller: "application", href: index_url, action: "click->application#openLink" } %>
</div> </div>
<% else %> <% else %>
<%= link_to search_result["name"], index_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link" %> <%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link",
data: { controller: "application", href: index_url, action: "click->application#openLink" } %>
<% end %> <% end %>
</div> </div>

6
app/components/doctrines_offcanvas_component/doctrines_offcanvas_component.html.erb

@ -15,10 +15,12 @@
data-controller="subjects" data-subject-parent-id="<%= root.id %>" data-controller="subjects" data-subject-parent-id="<%= root.id %>"
data-accordion-target="#<%= ['doctrinesOffCanvasAccordionBody', root.id].join %>" data-accordion-target="#<%= ['doctrinesOffCanvasAccordionBody', root.id].join %>"
data-action="click->subjects#loadDoctrinesOffcanvasAccordion"> data-action="click->subjects#loadDoctrinesOffcanvasAccordion">
<%= link_to root.name, search_doctrines_path(subject_ids: [root.id], is_index_table: false), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: search_doctrines_path(subject_ids: [root.id], is_index_table: false), action: "click->application#openLink" } %>
</div> </div>
<% else %> <% else %>
<%= link_to root.name, search_doctrines_path(subject_ids: [root.id], is_index_table: false), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: search_doctrines_path(subject_ids: [root.id], is_index_table: false), action: "click->application#openLink" } %>
<% end %> <% end %>
</div> </div>

72
app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb

@ -1,43 +1,45 @@
<div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>"> <div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" data-controller="application"
<div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> data-href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>"
<span> <b> <i> <%= headnote %> </i> </b> </span> data-action="click->application#openLink">
<p class="mb-0"> <%= raw content.html_safe %> </p> <div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>">
<span> <b> <i> <%= headnote %> </i> </b> </span>
<p class="mb-0"> <%= raw content.html_safe %> </p>
<div class="container-fluid p-0"> <div class="container-fluid p-0">
<% if opts[:is_doctrines_index].present? %> <% if opts[:is_doctrines_index].present? %>
<% document_title = jurisprudence.short_title || jurisprudence.title %> <% document_title = jurisprudence.short_title || jurisprudence.title %>
<% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.to_date.strftime("%B %d, %Y") : jurisprudence.year %> <% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.to_date.strftime("%B %d, %Y") : jurisprudence.year %>
<h5 style="color: darkred;"> <%= [document_title, jurisprudence.clean_reference_number, date_or_year].join(", ") %> </h5> <h5 style="color: darkred;"> <%= [document_title, jurisprudence.clean_reference_number, date_or_year].join(", ") %> </h5>
<% end %> <% end %>
<% annotations.each do |annotation| %> <% annotations.each do |annotation| %>
<% annotated_documents_title = [] %> <% annotated_documents_title = [] %>
<% annotation.documents.each do |annotated_document| %> <% annotation.documents.each do |annotated_document| %>
<% ad_title = annotated_document.short_title || annotated_document.title %> <% ad_title = annotated_document.short_title || annotated_document.title %>
<% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %> <% 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.clean_reference_number, ad_date_or_year].join(", ") %> <% annotated_documents_title << [" citing #{ad_title}", annotated_document.clean_reference_number, ad_date_or_year].join(", ") %>
<% end %> <% end %>
<% citing_document_title = [document_title, annotation.document.clean_reference_number, date_or_year, clean_phil_rep(annotation), annotated_documents_title].reject(&:blank?).join(', ').html_safe %> <% citing_document_title = [document_title, annotation.document.clean_reference_number, date_or_year, clean_phil_rep(annotation), annotated_documents_title].reject(&:blank?).join(', ').html_safe %>
<div class="row mb-2 pb-0 ms-3"> <div class="row mb-2 pb-0 ms-3">
<div class="col-sm-1 p-0 me-1" style="width: auto;"> <strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> </div> <div class="col-sm-1 p-0 me-1" style="width: auto;"> <strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> </div>
<div class="col-sm-9 p-0 ms-1"> <%= raw annotation.content.present? ? content_diplay_text(annotation) : citing_document_title %> </div> <div class="col-sm-9 p-0 ms-1"> <%= raw annotation.content.present? ? content_diplay_text(annotation) : citing_document_title %> </div>
</div> </div>
<% if annotation.editor_notes.present? %> <% if annotation.editor_notes.present? %>
<div class="row ms-5 mb-2"> <div class="row ms-5 mb-2">
<div class="col-sm-2 p-0" style="width: 105px;"> <div class="col-sm-2 p-0" style="width: 105px;">
<span> Editor's Note: </span> <span> Editor's Note: </span>
</div> </div>
<div class="col-sm-10 ps-0"> <div class="col-sm-10 ps-0">
<%= raw annotation.editor_notes %> <%= raw annotation.editor_notes %>
</div> </div>
</div>
<% end %>
<% end %>
</div> </div>
<% end %> </div>
<% end %>
</div>
</div>
<hr/> <hr/>
</div> </div>

3
app/components/jurisprudences_index_table_component/jurisprudences_index_table_component.html.erb

@ -1,4 +1,5 @@
<tr href="<%= document_path(document.id) %>" class="clickable-link" target="_blank"> <tr class="clickable-link" data-controller="application" data-href="<%= document_path(document.id) %>"
data-action="click->application#openLink">
<td> <%= clean_reference_number %> </td> <td> <%= clean_reference_number %> </td>
<td> <%= short_title || title %> </td> <td> <%= short_title || title %> </td>
<td> <%= date_or_year %> </td> <td> <%= date_or_year %> </td>

64
app/components/reports_search_results_component/reports_search_results_component.html.erb

@ -1,40 +1,42 @@
<div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>"> <div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" data-controller="application"
<div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> data-href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>"
<p class="mb-0"> <%= raw content.html_safe %> </p> data-action="click->application#openLink">
<div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>">
<p class="mb-0"> <%= raw content.html_safe %> </p>
<div class="container-fluid p-0"> <div class="container-fluid p-0">
<% document_title = jurisprudence.short_title || jurisprudence.title %> <% document_title = jurisprudence.short_title || jurisprudence.title %>
<% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.strftime : jurisprudence.year %> <% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.strftime : jurisprudence.year %>
<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>
<% annotations.each do |annotation| %> <% annotations.each do |annotation| %>
<p class="mb-0 ms-5"> <p class="mb-0 ms-5">
<% annotated_documents_title = [] %> <% annotated_documents_title = [] %>
<% annotation.documents.each do |annotated_document| %> <% annotation.documents.each do |annotated_document| %>
<% ad_title = annotated_document.short_title || annotated_document.title %> <% ad_title = annotated_document.short_title || annotated_document.title %>
<% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %> <% 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(", ") %> <% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %>
<% end %> <% end %>
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> <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 [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %>
</p> </p>
<% if annotation.editor_notes.present? %> <% if annotation.editor_notes.present? %>
<div class="row ms-5"> <div class="row ms-5">
<div class="col-sm-2 p-0" style="width: 105px;"> <div class="col-sm-2 p-0" style="width: 105px;">
<span> Editor's Note: </span> <span> Editor's Note: </span>
</div> </div>
<div class="col-sm-10 ps-0"> <div class="col-sm-10 ps-0">
<%= raw annotation.editor_notes %> <%= raw annotation.editor_notes %>
</div> </div>
</div>
<% end %>
<% end %>
</div> </div>
<% end %> </div>
<% end %>
</div>
</div>
<hr/> <hr/>
</div> </div>

12
app/components/subjects_accordion_component/subjects_accordion_component.html.erb

@ -5,12 +5,16 @@
<div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>" <div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>"
data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>" data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>"
data-action="click->subjects#loadSubjectsAccordion"> data-action="click->subjects#loadSubjectsAccordion">
<%= link_to search_result["name"], custom_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link" %> <%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link",
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: search_result["id"]), class: "text-decoration-none d-block sub#{search_result["heirarchy_level"]} clickable-link position-absolute end-0 me-5" %> data: { controller: "application", href: custom_url, action: "click->application#openLink" } %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: search_result["id"]),
class: "text-decoration-none d-block sub#{search_result["heirarchy_level"]} clickable-link position-absolute end-0 me-5" %>
</div> </div>
<% else %> <% else %>
<%= link_to search_result["name"], custom_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link" %> <%= link_to search_result["name"], custom_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link",
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: search_result["id"]), class: "text-decoration-none d-block sub#{search_result["heirarchy_level"]} clickable-link position-absolute end-0 non-toggle" %> data: { controller: "application", href: custom_url, action: "click->application#openLink" } %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: search_result["id"]),
class: "text-decoration-none d-block sub#{search_result["heirarchy_level"]} clickable-link position-absolute end-0 non-toggle" %>
<% end %> <% end %>
</div> </div>

6
app/components/subjects_offcanvas_accordion_component/subjects_offcanvas_accordion_component.html.erb

@ -5,10 +5,12 @@
<div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>" <div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>"
data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>" data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>"
data-action="click->subjects#loadSubjectsOffcanvasAccordion"> data-action="click->subjects#loadSubjectsOffcanvasAccordion">
<%= link_to search_result["name"], index_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link" %> <%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link",
data: { controller: "application", href: index_url, action: "click->application#openLink" } %>
</div> </div>
<% else %> <% else %>
<%= link_to search_result["name"], index_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link" %> <%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link",
data: { controller: "application", href: index_url, action: "click->application#openLink" } %>
<% end %> <% end %>
</div> </div>

6
app/components/subjects_offcanvas_component/subjects_offcanvas_component.html.erb

@ -15,10 +15,12 @@
data-controller="subjects" data-subject-parent-id="<%= root.id %>" data-controller="subjects" data-subject-parent-id="<%= root.id %>"
data-accordion-target="#<%= ['subjectsOffCanvasAccordionBody', root.id].join %>" data-accordion-target="#<%= ['subjectsOffCanvasAccordionBody', root.id].join %>"
data-action="click->subjects#loadSubjectsOffcanvasAccordion"> data-action="click->subjects#loadSubjectsOffcanvasAccordion">
<%= link_to root.name, search_documents_path(subject_ids: root.id, is_index_table: true), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: search_documents_path(subject_ids: root.id, is_index_table: true), action: "click->application#openLink" } %>
</div> </div>
<% else %> <% else %>
<%= link_to root.name, search_documents_path(subject_ids: root.id, is_index_table: true), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, search_documents_path(subject_ids: root.id, is_index_table: true), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: search_documents_path(subject_ids: root.id, is_index_table: true), action: "click->application#openLink" } %>
<% end %> <% end %>
</div> </div>

2
app/controllers/concerns/document_search.rb

@ -16,8 +16,6 @@ module DocumentSearch
with(:citation_finders_names).any_of(sanitize_citer_finder_param(search_params[:citation_finder])) if search_params[:citation_finder].present? with(:citation_finders_names).any_of(sanitize_citer_finder_param(search_params[:citation_finder])) if search_params[:citation_finder].present?
with(:is_only_in_premium_libraries, false)
if search_params[:sort_by].blank? if search_params[:sort_by].blank?
order_by :search_year, :desc order_by :search_year, :desc
order_by :search_doc_date, :desc order_by :search_doc_date, :desc

2
app/controllers/concerns/jurisprudence_search.rb

@ -24,8 +24,6 @@ module JurisprudenceSearch
without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present? without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present?
with(:is_only_in_premium_libraries, false)
if search_params[:sort_by].blank? if search_params[:sort_by].blank?
order_by :search_year, :desc order_by :search_year, :desc
order_by :search_doc_date, :desc order_by :search_doc_date, :desc

26
app/javascript/controllers/application_controller.js

@ -21,22 +21,6 @@ import Selectize from "selectize";
*/ */
export default class extends Controller { export default class extends Controller {
connect () { connect () {
$(".clickable-link").on("click", function (e) {
e.preventDefault();
let $href = $(this).attr("href");
if ($href !== undefined) {
window.location.href = $href;
}
});
$(".clickable-tr").on("click", function () {
let $href = $(this).attr("href");
if ($href !== undefined) {
window.open($href);
}
})
$(".reset-document-advanced-search").on("click", function (ev) { $(".reset-document-advanced-search").on("click", function (ev) {
ev.preventDefault() ev.preventDefault()
@ -54,6 +38,16 @@ export default class extends Controller {
StimulusReflex.register(this) StimulusReflex.register(this)
} }
openLink ($event) {
$event.preventDefault()
window.location.href = this.element.dataset['href']
}
openLinkToNewTab ($event) {
$event.preventDefault()
window.open(this.element.dataset['href'])
}
/* Application-wide lifecycle methods /* Application-wide lifecycle methods
* *
* Use these methods to handle lifecycle concerns for the entire application. * Use these methods to handle lifecycle concerns for the entire application.

1
app/javascript/controllers/doctrines_controller.js

@ -196,7 +196,6 @@ export default class extends ApplicationController {
content: $modal.find("input[name='document_title']").val(), phil_rep: $modal.find("#phil_rep").val(), content: $modal.find("input[name='document_title']").val(), phil_rep: $modal.find("#phil_rep").val(),
editor_notes: $modal.find("input[name='editor_notes']").val(), annomark_ids: $modal.find("select[name='annomark_ids[]']").val() } editor_notes: $modal.find("input[name='editor_notes']").val(), annomark_ids: $modal.find("select[name='annomark_ids[]']").val() }
console.log(annotaitons_attributes_index.length)
if (annotaitons_attributes_index.length > 0) { if (annotaitons_attributes_index.length > 0) {
annotations_attributes.splice(annotaitons_attributes_index, 1, params) annotations_attributes.splice(annotaitons_attributes_index, 1, params)
$( ".toast-body" ).html( "<span><b>Case List is successfully updated.</b></span>" ); $( ".toast-body" ).html( "<span><b>Case List is successfully updated.</b></span>" );

3
app/javascript/controllers/subjects_controller.js

@ -9,7 +9,6 @@ export default class extends ApplicationController {
opts = { parent_accordion_id: $this.element.dataset["accordionId"], accordionTarget: $this.element.dataset["accordionTarget"], opts = { parent_accordion_id: $this.element.dataset["accordionId"], accordionTarget: $this.element.dataset["accordionTarget"],
accordionFor: $this.element.dataset["accordionFor"] } accordionFor: $this.element.dataset["accordionFor"] }
console.log(opts)
if (parent_id !== null && parent_id !== undefined && parent_id !== "") { if (parent_id !== null && parent_id !== undefined && parent_id !== "") {
params.parent_id = parent_id params.parent_id = parent_id
} else { } else {
@ -29,7 +28,6 @@ export default class extends ApplicationController {
var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"], var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"],
opts = { accordionTarget: $this.element.dataset["accordionTarget"] } opts = { accordionTarget: $this.element.dataset["accordionTarget"] }
console.log(opts)
if (parent_id !== null && parent_id !== undefined && parent_id !== "") { if (parent_id !== null && parent_id !== undefined && parent_id !== "") {
params.parent_id = parent_id params.parent_id = parent_id
} else { } else {
@ -49,7 +47,6 @@ export default class extends ApplicationController {
var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"], var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"],
opts = { accordionTarget: $this.element.dataset["accordionTarget"] } opts = { accordionTarget: $this.element.dataset["accordionTarget"] }
console.log(opts)
if (parent_id !== null && parent_id !== undefined && parent_id !== "") { if (parent_id !== null && parent_id !== undefined && parent_id !== "") {
params.parent_id = parent_id params.parent_id = parent_id
} else { } else {

9
app/models/cdao/subject.rb

@ -67,14 +67,19 @@ class Cdao::Subject < Cdao::Base
sub6_name = names[6] sub6_name = names[6]
root = Cdao::Subject.find_or_create_by(name: root_name, ancestry: nil) if root_name.present? root = Cdao::Subject.find_or_create_by(name: root_name, ancestry: nil) if root_name.present?
root.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if root.persisted?
sub1 = root.children.find_or_create_by(name: sub1_name) if root.present? && sub1_name.present? sub1 = root.children.find_or_create_by(name: sub1_name) if root.present? && sub1_name.present?
sub1.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if sub1.present? && sub1.persisted?
sub2 = sub1.children.find_or_create_by(name: sub2_name) if sub1.present? && sub2_name.present? sub2 = sub1.children.find_or_create_by(name: sub2_name) if sub1.present? && sub2_name.present?
sub2.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if sub2.present? && sub2.persisted?
sub3 = sub2.children.find_or_create_by(name: sub3_name) if sub2.present? && sub3_name.present? sub3 = sub2.children.find_or_create_by(name: sub3_name) if sub2.present? && sub3_name.present?
sub3.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if sub3.present? && sub3.persisted?
sub4 = sub3.children.find_or_create_by(name: sub4_name) if sub3.present? && sub4_name.present? sub4 = sub3.children.find_or_create_by(name: sub4_name) if sub3.present? && sub4_name.present?
sub4.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if sub4.present? && sub4.persisted?
sub5 = sub4.children.find_or_create_by(name: sub5_name) if sub4.present? && sub5_name.present? sub5 = sub4.children.find_or_create_by(name: sub5_name) if sub4.present? && sub5_name.present?
sub5.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if sub5.present? && sub5.persisted?
sub6 = sub5.children.find_or_create_by(name: sub6_name) if sub5.present? && sub6_name.present? sub6 = sub5.children.find_or_create_by(name: sub6_name) if sub5.present? && sub6_name.present?
sub6.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if sub6.present? && sub6.persisted?
root.descendants.each { |a| a.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] } if root.present?
end end
end end

4
app/views/documents/show.html.erb

@ -18,7 +18,7 @@
<% end %> <% end %>
</div> </div>
<div class="col-lg-3 text-end"> <div class="col-lg-3 text-end">
<b>Date : </b> <b>Date : </b>
</div> </div>
<div class="col-lg-3 text-end"> <div class="col-lg-3 text-end">
<b><%= @document.docdate.present? ? @document.docdate.strftime("%m/%d/%Y") : @document.year %> </b> <b><%= @document.docdate.present? ? @document.docdate.strftime("%m/%d/%Y") : @document.year %> </b>
@ -42,7 +42,7 @@
Title : Title :
</div> </div>
<div class="col-lg-9"> <div class="col-lg-9">
<strong> <%= @document.short_title || @document.title %> </strong> <strong> <%= @document.short_title || @document.title %> </strong>
</div> </div>
</div> </div>
</div> </div>

6
app/views/subject_indexes/index.html.erb

@ -11,11 +11,13 @@
data-controller="subjects" data-subject-parent-id="<%= root.id %>" data-controller="subjects" data-subject-parent-id="<%= root.id %>"
data-accordion-target="#<%= ['subjectsAccordionBody', root.id].join %>" data-accordion-target="#<%= ['subjectsAccordionBody', root.id].join %>"
data-action="click->subjects#loadSubjectsAccordion"> data-action="click->subjects#loadSubjectsAccordion">
<%= link_to root.name, subject_index_path(root.id), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: subject_index_path(root.id), action: "click->application#openLink" } %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %> <%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %>
</div> </div>
<% else %> <% else %>
<%= link_to root.name, subject_index_path(root.id), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: subject_index_path(root.id), action: "click->application#openLink" } %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin non-toggle" %> <%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin non-toggle" %>
<% end %> <% end %>
</div> </div>

6
app/views/subject_indexes/show.html.erb

@ -51,11 +51,13 @@
data-controller="subjects" data-subject-parent-id="<%= root.id %>" data-controller="subjects" data-subject-parent-id="<%= root.id %>"
data-accordion-target="#<%= ['subjectsAccordionBody', root.id].join %>" data-accordion-target="#<%= ['subjectsAccordionBody', root.id].join %>"
data-action="click->subjects#loadSubjectsAccordion"> data-action="click->subjects#loadSubjectsAccordion">
<%= link_to root.name, subject_index_path(root.id), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: subject_index_path(root.id), action: "click->application#openLink" } %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %> <%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %>
</div> </div>
<% else %> <% else %>
<%= link_to root.name, subject_index_path(root.id), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %> <%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link",
data: { controller: "application", href: subject_index_path(root.id), action: "click->application#openLink" } %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin non-toggle" %> <%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin non-toggle" %>
<% end %> <% end %>
</div> </div>

Loading…
Cancel
Save