diff --git a/app/components/citation_index_table_component/citation_index_table_component.html.erb b/app/components/citation_index_table_component/citation_index_table_component.html.erb index 6323a95..41cfee9 100644 --- a/app/components/citation_index_table_component/citation_index_table_component.html.erb +++ b/app/components/citation_index_table_component/citation_index_table_component.html.erb @@ -1,4 +1,4 @@ - + <%= clean_reference_number %> <%= short_title || title %> <%= date_or_year %> diff --git a/app/components/doctrine_index_component/doctrine_index_component.html.erb b/app/components/doctrine_index_component/doctrine_index_component.html.erb index 772a6bf..6ea3d59 100644 --- a/app/components/doctrine_index_component/doctrine_index_component.html.erb +++ b/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 } %> <% search_doctrines(grouped_by_juris_search_params).group(:jurisprudence_id).groups.each do |grouped_by_juris| %> <% grouped_by_juris.results.each do |juris_result| %> - <% search_params = { subject_ids: opts[:subject_ids], headnote: uniq_by_headnote.headnote, content: content_result.content, jurisprudence_id: juris_result.jurisprudence.id } %> 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 ff7acaa..f71793a 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 @@ -7,10 +7,12 @@ <% search_results.each do |search_result| %> - - <%= document_reference_number(search_result) %> - <%= document_title(search_result) %> - <%= date_or_year(search_result) %> + + <%= document_reference_number(search_result) %> + <%= document_title(search_result) %> + <%= date_or_year(search_result) %> <% end %> diff --git a/app/components/doctrines_offcanvas_accordion_component/doctrines_offcanvas_accordion_component.html.erb b/app/components/doctrines_offcanvas_accordion_component/doctrines_offcanvas_accordion_component.html.erb index 4c3d978..f64f93b 100644 --- a/app/components/doctrines_offcanvas_accordion_component/doctrines_offcanvas_accordion_component.html.erb +++ b/app/components/doctrines_offcanvas_accordion_component/doctrines_offcanvas_accordion_component.html.erb @@ -5,10 +5,12 @@ <% 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 %> diff --git a/app/components/doctrines_offcanvas_component/doctrines_offcanvas_component.html.erb b/app/components/doctrines_offcanvas_component/doctrines_offcanvas_component.html.erb index 70ceafd..89df496 100644 --- a/app/components/doctrines_offcanvas_component/doctrines_offcanvas_component.html.erb +++ b/app/components/doctrines_offcanvas_component/doctrines_offcanvas_component.html.erb @@ -15,10 +15,12 @@ data-controller="subjects" data-subject-parent-id="<%= root.id %>" data-accordion-target="#<%= ['doctrinesOffCanvasAccordionBody', root.id].join %>" 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" } %> <% 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 %> diff --git a/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb b/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb index 301adea..5194007 100644 --- a/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb +++ b/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb @@ -1,43 +1,45 @@ - diff --git a/app/controllers/concerns/document_search.rb b/app/controllers/concerns/document_search.rb index f490049..bbdc95b 100644 --- a/app/controllers/concerns/document_search.rb +++ b/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(:is_only_in_premium_libraries, false) - if search_params[:sort_by].blank? order_by :search_year, :desc order_by :search_doc_date, :desc diff --git a/app/controllers/concerns/jurisprudence_search.rb b/app/controllers/concerns/jurisprudence_search.rb index 8f5101e..7c880a9 100644 --- a/app/controllers/concerns/jurisprudence_search.rb +++ b/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? - with(:is_only_in_premium_libraries, false) - if search_params[:sort_by].blank? order_by :search_year, :desc order_by :search_doc_date, :desc diff --git a/app/javascript/controllers/application_controller.js b/app/javascript/controllers/application_controller.js index b8c87c0..12bfe9b 100644 --- a/app/javascript/controllers/application_controller.js +++ b/app/javascript/controllers/application_controller.js @@ -21,22 +21,6 @@ import Selectize from "selectize"; */ export default class extends Controller { 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) { ev.preventDefault() @@ -54,6 +38,16 @@ export default class extends Controller { 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 * * Use these methods to handle lifecycle concerns for the entire application. diff --git a/app/javascript/controllers/doctrines_controller.js b/app/javascript/controllers/doctrines_controller.js index dc919c0..6fcdaf6 100644 --- a/app/javascript/controllers/doctrines_controller.js +++ b/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(), 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) { annotations_attributes.splice(annotaitons_attributes_index, 1, params) $( ".toast-body" ).html( "Case List is successfully updated." ); diff --git a/app/javascript/controllers/subjects_controller.js b/app/javascript/controllers/subjects_controller.js index 1370b72..eaa5531 100644 --- a/app/javascript/controllers/subjects_controller.js +++ b/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"], accordionFor: $this.element.dataset["accordionFor"] } - console.log(opts) if (parent_id !== null && parent_id !== undefined && parent_id !== "") { params.parent_id = parent_id } else { @@ -29,7 +28,6 @@ export default class extends ApplicationController { var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"], opts = { accordionTarget: $this.element.dataset["accordionTarget"] } - console.log(opts) if (parent_id !== null && parent_id !== undefined && parent_id !== "") { params.parent_id = parent_id } else { @@ -49,7 +47,6 @@ export default class extends ApplicationController { var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"], opts = { accordionTarget: $this.element.dataset["accordionTarget"] } - console.log(opts) if (parent_id !== null && parent_id !== undefined && parent_id !== "") { params.parent_id = parent_id } else { diff --git a/app/models/cdao/subject.rb b/app/models/cdao/subject.rb index 25da037..dd9b312 100644 --- a/app/models/cdao/subject.rb +++ b/app/models/cdao/subject.rb @@ -67,14 +67,19 @@ class Cdao::Subject < Cdao::Base sub6_name = names[6] 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.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.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.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.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.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? - - root.descendants.each { |a| a.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] } if root.present? + sub6.library_ids = [Cdao::Library.find_by(key: "JurisprudenceEncyclopedia").try(:id)] if sub6.present? && sub6.persisted? end end diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 6cfd0be..fe0b240 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -18,7 +18,7 @@ <% end %>
- Date : + Date :
<%= @document.docdate.present? ? @document.docdate.strftime("%m/%d/%Y") : @document.year %> @@ -42,7 +42,7 @@ Title :
- <%= @document.short_title || @document.title %> + <%= @document.short_title || @document.title %>
diff --git a/app/views/subject_indexes/index.html.erb b/app/views/subject_indexes/index.html.erb index 00deaa1..f403f64 100644 --- a/app/views/subject_indexes/index.html.erb +++ b/app/views/subject_indexes/index.html.erb @@ -11,11 +11,13 @@ data-controller="subjects" data-subject-parent-id="<%= root.id %>" data-accordion-target="#<%= ['subjectsAccordionBody', root.id].join %>" 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 ''.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" %> <% 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 ''.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 %> diff --git a/app/views/subject_indexes/show.html.erb b/app/views/subject_indexes/show.html.erb index 0922422..2dd3e50 100644 --- a/app/views/subject_indexes/show.html.erb +++ b/app/views/subject_indexes/show.html.erb @@ -51,11 +51,13 @@ data-controller="subjects" data-subject-parent-id="<%= root.id %>" data-accordion-target="#<%= ['subjectsAccordionBody', root.id].join %>" 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 ''.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" %> <% 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 ''.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 %>