Compare commits
1 Commits
master
...
feature-2c
| Author | SHA1 | Date |
|---|---|---|
|
|
afa08fa90c | 4 years ago |
158 changed files with 923 additions and 3815 deletions
@ -1,7 +1,24 @@ |
|||||||
# Development |
# README |
||||||
|
|
||||||
``` |
This README would normally document whatever steps are necessary to get the |
||||||
docker-compose up -d |
application up and running. |
||||||
bin/setup |
|
||||||
foreman start |
Things you may want to cover: |
||||||
``` |
|
||||||
|
* Ruby version |
||||||
|
|
||||||
|
* System dependencies |
||||||
|
|
||||||
|
* Configuration |
||||||
|
|
||||||
|
* Database creation |
||||||
|
|
||||||
|
* Database initialization |
||||||
|
|
||||||
|
* How to run the test suite |
||||||
|
|
||||||
|
* Services (job queues, cache servers, search engines, etc.) |
||||||
|
|
||||||
|
* Deployment instructions |
||||||
|
|
||||||
|
* ... |
||||||
|
|||||||
@ -1,51 +0,0 @@ |
|||||||
class AnnotationFormComponent < BaseComponent |
|
||||||
attr_reader :annotation, :opts |
|
||||||
|
|
||||||
def initialize(current_user:, annotation:, opts: {}) |
|
||||||
@annotation = annotation |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
def document |
|
||||||
return annotation.document if annotation.persisted? |
|
||||||
|
|
||||||
Cdao::Document.find(opts[:document_id].to_i) |
|
||||||
end |
|
||||||
|
|
||||||
def clean_phil_rep(annotation) |
|
||||||
return if annotation.phil_rep.blank? |
|
||||||
|
|
||||||
annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") |
|
||||||
end |
|
||||||
|
|
||||||
def display_text |
|
||||||
return annotation.content if annotation.persisted? && annotation.content.present? && annotation.content.include?("Phil") |
|
||||||
|
|
||||||
display_text = nil |
|
||||||
title = document.short_title || document.title |
|
||||||
year_or_date = document.doc_date.present? ? document.doc_date.strftime("%B %d, %Y") : document.year |
|
||||||
|
|
||||||
if annotation.new_record? |
|
||||||
display_text = [title, document.clean_reference_number, year_or_date].join(", ") |
|
||||||
else |
|
||||||
contents = [[title, document.clean_reference_number, year_or_date].reject(&:blank?).join(", ")] |
|
||||||
|
|
||||||
annotation.documents.each do |citing_doc| |
|
||||||
citing_doc_title = citing_doc.short_title || citing_doc.title |
|
||||||
citing_doc_year_or_date = citing_doc.doc_date.present? ? citing_doc.doc_date.strftime("%B %d, %Y") : citing_doc.year |
|
||||||
contents << [citing_doc_title, citing_doc.clean_reference_number, citing_doc_year_or_date].join(", ") |
|
||||||
end |
|
||||||
|
|
||||||
display_text = contents.reject(&:blank?).join(" citing ") |
|
||||||
end |
|
||||||
|
|
||||||
display_text |
|
||||||
end |
|
||||||
|
|
||||||
def phil_rep |
|
||||||
return annotation.phil_rep if annotation.persisted? |
|
||||||
|
|
||||||
document.phil_rep |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
@ -1,51 +0,0 @@ |
|||||||
<div class="row"> |
|
||||||
<div class="col-sm-12 p-2"> |
|
||||||
<strong> Annotation Marks </strong> |
|
||||||
<%= hidden_field_tag :document_ids, annotation.citing_document_ids, data: { target: "annotations.document_ids" } %> |
|
||||||
<%= select_tag "annomark_ids[]", options_from_collection_for_select(Annomark.all.order(name: :asc), :id, :name, annotation.annomark_ids), |
|
||||||
class: "form-control default-selectize ps-0", multiple: true, prompt: "Please select" %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="row"> |
|
||||||
<div class="col-sm-12 p-2"> |
|
||||||
<strong> <%= label_tag :document_title %> </strong> |
|
||||||
<%= rich_text_area_tag :content, display_text, placeholder: "Document Title" %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div id="annotatedDocumentsSearchResults"> |
|
||||||
<div class="row"> |
|
||||||
<div class="col-sm-10 p-2"> |
|
||||||
<%= text_field_tag :q, nil, class: "form-control", placeholder: "Search GR Number, Title or Short Title", data: { target: "annotations.q" } %> |
|
||||||
</div> |
|
||||||
<div class="col-sm-1 p-2"> |
|
||||||
<button type="button" class="btn btn-success" data-action="click->annotations#searchDocuments"> Search </button> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="row tab"> |
|
||||||
<table class="table table-striped table-hover mb-0" style="width: 98%; margin: 0 auto;"> |
|
||||||
<thead> |
|
||||||
<th class="bg-light"> Reference No. </th> |
|
||||||
<th class="bg-light"> Title </th> |
|
||||||
<th class="bg-light"> Date </th> |
|
||||||
<th class="bg-light"> </th> |
|
||||||
</thead> |
|
||||||
</table> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="row"> |
|
||||||
<div class="col-sm-12 p-2"> |
|
||||||
<strong> <%= label_tag :phil_rep %> </strong> |
|
||||||
<%= text_field_tag :phil_rep, phil_rep, class: "form-control", data: { target: "annotations.phil_rep" } %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="row"> |
|
||||||
<div class="col-sm-12 p-2"> |
|
||||||
<strong> <%= label_tag "Editor's Note" %> </strong> |
|
||||||
<%= rich_text_area_tag :editor_notes, annotation.editor_notes, placeholder: "Editor's Note", data: { target: "annotations.editor_notes" } %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
@ -1,6 +1,4 @@ |
|||||||
class AnnotationMarksModalFormComponent < BaseComponent |
class AnnotationMarksModalFormComponent < BaseComponent |
||||||
attr_reader :opts |
|
||||||
def initialize(current_user:, opts: {}) |
def initialize(current_user:); end |
||||||
@opts = opts |
end |
||||||
end |
|
||||||
end |
|
||||||
@ -1,7 +0,0 @@ |
|||||||
<tr class="clickable-tr" data-controller="application" |
|
||||||
data-href="<%= citator_path %>" |
|
||||||
data-action="click->application#openLinkToNewTab"> |
|
||||||
<td> <%= clean_reference_number %> </td> |
|
||||||
<td> <%= short_title || title %> </td> |
|
||||||
<td> <%= date_or_year %> </td> |
|
||||||
</tr> |
|
||||||
@ -1,10 +0,0 @@ |
|||||||
class DoctrineFormComponent < BaseComponent |
|
||||||
attr_reader :doctrine, :jurisprudence_id, :opts |
|
||||||
|
|
||||||
def initialize(current_user:, doctrine:, jurisprudence_id:, opts: {}) |
|
||||||
@doctrine = doctrine |
|
||||||
@jurisprudence_id = jurisprudence_id |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
@ -1,38 +0,0 @@ |
|||||||
<div class="row"> |
|
||||||
<div class="col-sm-12"> |
|
||||||
<label for="subject-name" class="col-form-label"> Subjects </label> |
|
||||||
<%= hidden_field_tag :document_id, jurisprudence_id, data: { target: "doctrines.document_id" } %> |
|
||||||
<%= hidden_field_tag :doctrine_id, doctrine.id, data: { target: "doctrines.doctrine_id" } %> |
|
||||||
<select class="form-control subject-ids-selectize ps-0" name="subject_ids[]" id="subject_ids_" multiple="true" required> |
|
||||||
<% doctrine.subjects.each do |subject| %> |
|
||||||
<option value="<%= subject.id %>" selected> <%= subject.lineage_name %> </option> |
|
||||||
<% end if doctrine.persisted? %> |
|
||||||
</select> |
|
||||||
<div class="invalid-feedback" id="subjects-blank-message"> Subject/s cannot be blank. </div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<% if doctrine.new_record? %> |
|
||||||
<div class="row" id="doctine_content_suggestions_div"> |
|
||||||
<div class="col-sm-12"> |
|
||||||
<label for="subject-name" class="col-form-label">Doctine content suggestions</label> |
|
||||||
<select id="doctine_content_suggestions" class="form-control ps-0"> </select> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
|
|
||||||
<div class="row"> |
|
||||||
<div class="col-sm-12"> |
|
||||||
<label for="subject-name" class="col-form-label">Head Note</label> |
|
||||||
<%= text_field_tag :headnote, doctrine.headnote, class: "form-control", placeholder: "Head note", required: true, data: { target: "doctrines.headnote" } %> |
|
||||||
<div class="invalid-feedback" id="headnote-blank-message"> Headnote cannot be blank. </div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="row"> |
|
||||||
<div class="col-sm-12"> |
|
||||||
<label for="subject-name" class="col-form-label">Content</label> |
|
||||||
<%= rich_text_area_tag :content, doctrine.content, placeholder: "Doctrine Content", required: true, data: { target: "doctrines.content" } %> |
|
||||||
<div class="invalid-feedback" id="content-blank-message"> Content cannot be blank. </div> |
|
||||||
<div> |
|
||||||
</div> |
|
||||||
@ -1,65 +0,0 @@ |
|||||||
class DoctrineIndexComponent < BaseComponent |
|
||||||
attr_reader :search_results, :opts |
|
||||||
|
|
||||||
include AnnotationSearch |
|
||||||
include DoctrineSearch |
|
||||||
|
|
||||||
def initialize(search_results:, current_user:, opts: {}) |
|
||||||
@search_results = search_results |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
def annotation_form_url |
|
||||||
doctrine_annotations_path(doctrine_id: id) |
|
||||||
end |
|
||||||
|
|
||||||
def subject_names |
|
||||||
"(No Subjects Provided)" |
|
||||||
end |
|
||||||
|
|
||||||
def document_title(annotation) |
|
||||||
return annotation.document.short_title if annotation.document.short_title.present? |
|
||||||
|
|
||||||
annotation.document.title |
|
||||||
end |
|
||||||
|
|
||||||
def date_or_year(annotation) |
|
||||||
return annotation.document.docdate.to_date.strftime("%B %d, %Y") if annotation.document.docdate.present? |
|
||||||
|
|
||||||
annotation.document.year |
|
||||||
end |
|
||||||
|
|
||||||
def doctrine_show_url |
|
||||||
return document_doctrine_path(jurisprudence.id, id, is_index_table: false, subject_ids: opts[:subject_ids].reject(&:blank?)) if jurisprudence.present? |
|
||||||
|
|
||||||
doctrine_path(id, is_index_table: false, subject_ids: opts[:subject_ids].reject(&:blank?)) |
|
||||||
end |
|
||||||
|
|
||||||
def clean_phil_rep(annotation) |
|
||||||
return if annotation.phil_rep.blank? |
|
||||||
|
|
||||||
annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") |
|
||||||
end |
|
||||||
|
|
||||||
def search_annotations(search_params) |
|
||||||
search = annotation_search(search_params) |
|
||||||
search.results |
|
||||||
end |
|
||||||
|
|
||||||
def content_diplay_text(annotation) |
|
||||||
return annotation.content.gsub("<div>", "").gsub("</div>", "") if annotation.content.include?("Phil") |
|
||||||
|
|
||||||
contents = annotation.content.gsub("<div>", "").gsub("</div>", "").split(" citing ") |
|
||||||
contents[0] = [contents[0], clean_phil_rep(annotation)].reject(&:blank?).join(", ") |
|
||||||
contents.join(" citing ") |
|
||||||
end |
|
||||||
|
|
||||||
def search_doctrines(search_params) |
|
||||||
search = doctrine_search(search_params) |
|
||||||
search |
|
||||||
end |
|
||||||
|
|
||||||
def render? |
|
||||||
search_results.present? |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,58 +0,0 @@ |
|||||||
<div class="row-flex m-3 mt-0 doctrine-content-body"> |
|
||||||
<div class="container-sm <%= params[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> |
|
||||||
<% search_results.uniq(&:headnote).each do |uniq_by_headnote| %> |
|
||||||
<h5> <%= uniq_by_headnote.headnote %> </h5> |
|
||||||
|
|
||||||
<% grouped_by_content_search_params = { subject_ids: opts[:subject_ids], headnote: uniq_by_headnote.headnote, is_grouped_by_content: true } %> |
|
||||||
<% search_doctrines(grouped_by_content_search_params).group(:content).groups.each do |group_by_content| %> |
|
||||||
<% group_by_content.results.each do |content_result| %> |
|
||||||
<div class="mb-0 fs-5"> <%= raw content_result.content.html_safe %> </div> |
|
||||||
|
|
||||||
<% 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| %> |
|
||||||
<h5 class="clickable-link" style="color: darkred;" data-controller="application" |
|
||||||
data-href="<%= document_path(juris_result.jurisprudence.document.id, is_index_table: false, subject_ids: params[:subject_ids]) %>" |
|
||||||
data-action="click->application#openLink"> |
|
||||||
<% 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> |
|
||||||
|
|
||||||
<% search_params = { subject_ids: opts[:subject_ids], headnote: uniq_by_headnote.headnote, content: content_result.content, jurisprudence_id: juris_result.jurisprudence.id } %> |
|
||||||
<% search_doctrines(search_params).results.each do |doctrine| %> |
|
||||||
<% search_annotations({ doctrine_id: doctrine.id }).each do |annotation| %> |
|
||||||
<% annotated_documents_title = [] %> |
|
||||||
<% annotation.documents.each do |annotated_document| %> |
|
||||||
<% ad_title = annotated_document.short_title || annotated_document.title %> |
|
||||||
<% ad_date_or_year = annotated_document.doc_date.present? ? annotated_document.doc_date.strftime("%B %d, %Y") : annotated_document.year %> |
|
||||||
<% annotated_documents_title << [" citing #{ad_title}", annotated_document.clean_reference_number, ad_date_or_year].join(", ") %> |
|
||||||
<% 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 %> |
|
||||||
|
|
||||||
<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-9 p-0 ms-1"> <%= raw annotation.content.present? ? content_diplay_text(annotation) : citing_document_title %> </div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<% if annotation.editor_notes.present? %> |
|
||||||
<div class="row ms-5 mb-2"> |
|
||||||
<div class="col-sm-2 p-0" style="width: 105px;"> |
|
||||||
<span> Editor's Note: </span> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="col-sm-10 ps-0"> |
|
||||||
<%= raw annotation.editor_notes %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
<hr/> |
|
||||||
</div> |
|
||||||
@ -1,39 +0,0 @@ |
|||||||
class DoctrinesOffcanvasAccordionComponent < BaseComponent |
|
||||||
with_collection_parameter :search_result |
|
||||||
attr_reader :search_result, :opts |
|
||||||
|
|
||||||
def initialize(search_result:, current_user:, opts: {}) |
|
||||||
@search_result = search_result |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_name |
|
||||||
"doctrinesOffCanvasAccordion" |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_body_name |
|
||||||
"doctrinesOffCanvasAccordionBody" |
|
||||||
end |
|
||||||
|
|
||||||
def parent_accordion_id |
|
||||||
return accordion_body_name if search_result["parent_id"].blank? |
|
||||||
|
|
||||||
[accordion_name, search_result["parent_id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def children_accordion_id |
|
||||||
[accordion_name, search_result["heirarchy_level"], search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_id |
|
||||||
[accordion_name, search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_body_id |
|
||||||
[accordion_body_name, search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def index_url |
|
||||||
search_doctrines_path(subject_ids: [search_result["id"]], is_index_table: false) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,27 +0,0 @@ |
|||||||
<div class="accordion accordion-flush offcanvas-item" id="<%= accordion_id %>"> |
|
||||||
<div class="accordion-item"> |
|
||||||
<div class="accordion-header d-flex justify-content-between"> |
|
||||||
<% if search_result["has_children?"].present? %> |
|
||||||
<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-action="click->subjects#loadDoctrinesOffcanvasAccordion"> |
|
||||||
<%= 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> |
|
||||||
<% else %> |
|
||||||
<%= 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 %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= children_accordion_id %>" data-bs-parent="#<%= accordion_id %>"> |
|
||||||
<div class="accordion-body pt-1 sub-body<%= search_result["heirarchy_level"] + 1 %> pb-1" id="<%= accordion_body_id %>"> |
|
||||||
<div class="text-center"> |
|
||||||
<div class="spinner-border text-danger" role="status"> |
|
||||||
<span class="visually-hidden">Loading...</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
class DoctrinesOffcanvasComponent < BaseComponent |
|
||||||
attr_reader :opts |
|
||||||
|
|
||||||
def initialize(current_user:, opts: {}) |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
def render? |
|
||||||
opts[:is_render].present? |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,40 +0,0 @@ |
|||||||
<div class="offcanvas offcanvas-start offcanvas-contents" data-bs-scroll="true" tabindex="-1" data-bs-backdrop="false" id="doctrinesOffCanvas" data-controller="subjects"> |
|
||||||
<div class="offcanvas-header"> |
|
||||||
<h5 class="offcanvas-title"> Doctrines </h5> |
|
||||||
<hr class="m-0"> |
|
||||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="offcanvas-body"> |
|
||||||
<div class="accordion accordion-flush subject-index-body" id="doctrinesOffCanvasMainAccordion" > |
|
||||||
<% Cdao::Subject.roots.order(name: :asc).each do |root| %> |
|
||||||
<div class="accordion-item"> |
|
||||||
<div class="accordion-header d-flex justify-content-between"> |
|
||||||
<% if root.children.present? %> |
|
||||||
<div class="accordion-button collapsed m-0 p-0" data-bs-toggle="collapse" data-bs-target="#<%= ["doctrinesOffCanvasAccordion", root.id].join %>" |
|
||||||
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, "#", 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> |
|
||||||
<% else %> |
|
||||||
<%= 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 %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= ["doctrinesOffCanvasAccordion", root.id].join %>" data-bs-parent="#doctrinesOffCanvasMainAccordion"> |
|
||||||
<div class="accordion-body pt-1 pb-1 sub-body1" id="<%= ["doctrinesOffCanvasAccordionBody", root.id].join %>"> |
|
||||||
<div class="text-center"> |
|
||||||
<div class="spinner-border text-danger" role="status"> |
|
||||||
<span class="visually-hidden">Loading...</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
@ -1,36 +1,25 @@ |
|||||||
<%= form_tag(documents_path, method: :get) do %> |
<%= form_tag(documents_path, method: :get) do %> |
||||||
<div class="mb-2"> |
<div class="mb-3"> |
||||||
<%= text_field_tag :q, params[:q], placeholder: 'Full text search', class: "form-control mb-0" %> |
<%= text_field_tag :q, params[:q], placeholder: 'Full text search', class: "form-control" %> |
||||||
</div> |
</div> |
||||||
<hr class="simple mb-0"> |
<hr class="simple"> |
||||||
<div class="mb-2"> |
<div class="mb-3"> |
||||||
<label for="exampleFormControlInput1" class="form-label text-white">G.R. Number</label> |
<label for="exampleFormControlInput1" class="form-label text-white">G.R. Number</label> |
||||||
<%= text_field_tag :reference_number, params[:reference_number], class: "form-control mb-0" %> |
<%= text_field_tag :reference_number, params[:reference_number], class: "form-control" %> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<div class="mb-2"> |
<div class="mb-3"> |
||||||
<label for="exampleFormControlInput1" class="form-label text-white">Title</label> |
<label for="exampleFormControlInput1" class="form-label text-white">Short title</label> |
||||||
<%= text_field_tag :title, params[:title], class: "form-control mb-0" %> |
<%= text_field_tag :title, params[:short_title], class: "form-control" %> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<div class="d-flex align-items-end"> |
<div class="mb-3"> |
||||||
<div class="mb-2 w-100 pe-2"> |
|
||||||
<label for="exampleFormControlInput1" class="form-label text-white">Year</label> |
|
||||||
<%= select_tag :year_start, options_for_select(years, params[:year_start]), class: "form-select", include_blank: true %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="mb-2 w-100 ps-2"> |
|
||||||
<%= select_tag :year_end, options_for_select(years, params[:year_end]), class: "form-select", include_blank: true %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<hr class="simple mb-0"> |
|
||||||
<div class="mb-2"> |
|
||||||
<label for="exampleFormControlInput1" class="form-label text-white">Citation Finder</label> |
<label for="exampleFormControlInput1" class="form-label text-white">Citation Finder</label> |
||||||
<%= text_field_tag :citation_finder, params[:citation_finder], class: "form-control mb-0" %> |
<%= text_field_tag :citation_finder, params[:citation_finder], class: "form-control" %> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<div class="d-flex justify-content-end mt-3"> |
<div class="d-flex justify-content-end mt-5"> |
||||||
<button class="btn btn-success reset-document-advanced-search me-2 mb-2"><i class="fas fa-sync"></i> Refresh</button> |
<button type="button" class="btn btn-success me-2 mb-3">Refresh</button> |
||||||
<button type="submit" class="btn btn-danger mb-2">Search</button> |
<button type="submit" class="btn btn-danger mb-3">Search</button> |
||||||
</div> |
</div> |
||||||
<% end %> |
<% end %> |
||||||
@ -1,45 +1,53 @@ |
|||||||
<div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" data-controller="application" |
<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)%>"> |
||||||
data-href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>" |
<% if opts[:is_subjects_index].blank? %> |
||||||
data-action="click->application#openLink"> |
<% if opts[:is_doctrines_index].present? && opts[:subject_ids].reject(&:blank?).present? %> |
||||||
<div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> |
<h5 style="color: darkred;"> <%= subjects.where(id: opts[:subject_ids].map(&:to_i)).map(&:lineage_name).join(" ") %> </h5> |
||||||
<span> <b> <i> <%= headnote %> </i> </b> </span> |
<% elsif subjects.present? %> |
||||||
<p class="mb-0"> <%= raw content.html_safe %> </p> |
<% subjects.each do |subject| %> |
||||||
|
<h5 style="color: darkred;"> <%= subject.lineage_name %> </h5> |
||||||
<div class="container-fluid p-0"> |
<% end %> |
||||||
<% if opts[:is_doctrines_index].present? %> |
<% else %> |
||||||
<% document_title = jurisprudence.short_title || jurisprudence.title %> |
<h5> (No Subjects Provided) </h5> |
||||||
<% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.to_date.strftime("%B %d, %Y") : jurisprudence.year %> |
<% end %> |
||||||
<h5 style="color: darkred;"> <%= [document_title, jurisprudence.clean_reference_number, date_or_year].join(", ") %> </h5> |
<% end %> |
||||||
<% end %> |
|
||||||
|
<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-sm ms-3"> |
||||||
|
<% annotations.each do |annotation| %> |
||||||
|
<% if opts[:is_doctrines_index].present? %> |
||||||
|
<% document_title = annotation.doctrine.document.short_title || annotation.doctrine.document.title %> |
||||||
|
<% date_or_year = annotation.doctrine.document.docdate.present? ? annotation.doctrine.document.docdate.to_date.strftime("%B %d, %Y") : annotation.document.year %> |
||||||
|
<span> <%= [document_title, annotation.document.reference_number, date_or_year].join(", ") %> </span> |
||||||
|
<% end %> |
||||||
|
|
||||||
<% annotations.each do |annotation| %> |
<p class="mb-0 ms-3"> |
||||||
<% 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.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 %> |
|
||||||
|
|
||||||
<div class="row mb-2 pb-0 ms-3"> |
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> |
||||||
<div class="col-sm-1 p-0 me-1" style="width: auto;"> <strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> </div> |
<%= raw [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %> |
||||||
<div class="col-sm-9 p-0 ms-1"> <%= raw annotation.content.present? ? content_diplay_text(annotation) : citing_document_title %> </div> |
</p> |
||||||
</div> |
|
||||||
|
|
||||||
<% if annotation.editor_notes.present? %> |
<% if annotation.editor_notes.present? %> |
||||||
<div class="row ms-5 mb-2"> |
<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> Editors 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> |
||||||
</div> |
<% end %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
<hr/> |
<hr/> |
||||||
</div> |
</div> |
||||||
|
|||||||
@ -0,0 +1,5 @@ |
|||||||
|
<tr href="<%= document_path(search_result.id) %>" class="<%= opts.reject{ |k, v| v.blank? }.blank? ? 'clickable-tr' : ''%>" target="_blank"> |
||||||
|
<td> <%= clean_reference_number %> </td> |
||||||
|
<td> <%= short_title || title %> </td> |
||||||
|
<td> <%= date_or_year %> </td> |
||||||
|
</tr> |
||||||
@ -1,25 +0,0 @@ |
|||||||
class JurisprudencesIndexTableComponent < BaseComponent |
|
||||||
with_collection_parameter :jurisprudence |
|
||||||
attr_reader :jurisprudence, :opts |
|
||||||
|
|
||||||
def initialize(jurisprudence:, current_user:, opts: {}) |
|
||||||
@jurisprudence = jurisprudence |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
delegate :id, to: :jurisprudence |
|
||||||
delegate :clean_reference_number, to: :jurisprudence |
|
||||||
delegate :title, to: :jurisprudence |
|
||||||
delegate :short_title, to: :jurisprudence |
|
||||||
delegate :document, to: :jurisprudence |
|
||||||
|
|
||||||
def date_or_year |
|
||||||
return jurisprudence.docdate.strftime("%B %d, %Y") if jurisprudence.docdate.present? |
|
||||||
|
|
||||||
jurisprudence.year |
|
||||||
end |
|
||||||
|
|
||||||
def doctrine_annotations_path(doctrine_id) |
|
||||||
doctrine_annotations_path(doctrine_id: doctrine_id) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,6 +0,0 @@ |
|||||||
<tr class="clickable-link" data-controller="application" data-href="<%= document_path(document.id) %>" |
|
||||||
data-action="click->application#openLink"> |
|
||||||
<td> <%= clean_reference_number %> </td> |
|
||||||
<td> <%= short_title || title %> </td> |
|
||||||
<td> <%= date_or_year %> </td> |
|
||||||
</tr> |
|
||||||
@ -1,30 +1,33 @@ |
|||||||
<header class="header bg-white b-b clearfix"> |
<div class="col col-md-12"> |
||||||
<div class="row m-t-sm align-items-end pagination-body"> |
<header class="header bg-white b-b clearfix"> |
||||||
<div class="<%=data.present? ? "col-md-8 mb-0 " : "col-md-12 mb-0"%> <%= opts[:is_cited_in_doc].present? ? 'd-none': ""%> "> |
<div class="row m-t-sm align-items-end pagination-body"> |
||||||
<% if opts[:is_subject_breadcrums].present? && subjects.present? %> |
<div class="col-md-6 mb-0<%=opts[:is_subject_breadcrums].present? && subjects.present? ? '' : ' ps-0' %> "> |
||||||
<ol class="breadcrumb mb-0"> |
<% if opts[:is_subject_breadcrums].present? && subjects.present? %> |
||||||
<% subjects.each do |subject| %> |
<ol class="breadcrumb mb-0"> |
||||||
<% subject.ancestors.each do |ancestor| %> |
<% subjects.each do |subject| %> |
||||||
<li class="breadcrumb-item d-inline-flex"> |
<% subject.ancestors.each do |ancestor| %> |
||||||
<h4 class="label-breadcrumb"> <%= link_to ancestor.name, custom_url(ancestor.id), class: "text-decoration-none" %> </h4> |
<li class="breadcrumb-item d-inline-flex"> |
||||||
</li> |
<h4> <%= link_to ancestor.name, subject_index_path(ancestor), class: "text-decoration-none" %> </h4> |
||||||
<% end %> |
</li> |
||||||
<li class="breadcrumb-item d-inline-flex active"> |
<% end %> |
||||||
<h4> <%= subject.name %> </h4> |
|
||||||
</li> |
<li class="breadcrumb-item d-inline-flex active"> |
||||||
<% end %> |
<h4> <%= subject.name %> </h4> |
||||||
</ol> |
</li> |
||||||
<% else %> |
<% end %> |
||||||
<h4 style="color: darkred" class="m-0">Search Results</h4> |
</ol> |
||||||
<small style="color: darkred"> |
<% else %> |
||||||
<%= page_entries_info data, entry_name: 'records' if data.present? %> |
<h4 style="color: darkred" class="m-0">Search Results</h4> |
||||||
</small> |
<small style="color: darkred"> |
||||||
<% end %> |
<%= page_entries_info data, entry_name: 'records' if data.present? %> |
||||||
</div> |
</small> |
||||||
<div class="<%=data.present? ? "col-md-4 position-relative" : "d-none"%>"> |
<% end %> |
||||||
<div class="text-center pagination justify-content-end me-3"> |
</div> |
||||||
<%= (paginate data) if data.present? %> |
<div class="col-md-6 position-relative"> |
||||||
|
<div class="text-center pagination justify-content-end"> |
||||||
|
<%= (paginate data) if data.present? %> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
</div> |
</header> |
||||||
</header> |
</div> |
||||||
|
|||||||
@ -1,47 +0,0 @@ |
|||||||
class ReportsSearchResultsComponent < BaseComponent |
|
||||||
with_collection_parameter :search_result |
|
||||||
attr_reader :search_result, :opts |
|
||||||
|
|
||||||
def initialize(search_result:, current_user:, opts: {}) |
|
||||||
@search_result = search_result |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
delegate :id, to: :search_result |
|
||||||
delegate :headnote, to: :search_result |
|
||||||
delegate :subject_ids, to: :search_result |
|
||||||
delegate :content, to: :search_result |
|
||||||
delegate :annotations, to: :search_result |
|
||||||
delegate :subjects, to: :search_result |
|
||||||
delegate :doctrine_jurisprudences, to: :search_result |
|
||||||
|
|
||||||
def annotation_form_url |
|
||||||
doctrine_annotations_path(doctrine_id: id) |
|
||||||
end |
|
||||||
|
|
||||||
def subject_names |
|
||||||
"(No Subjects Provided)" |
|
||||||
end |
|
||||||
|
|
||||||
def jurisprudence |
|
||||||
return nil if doctrine_jurisprudences.blank? |
|
||||||
|
|
||||||
doctrine_jurisprudences.first.jurisprudence |
|
||||||
end |
|
||||||
|
|
||||||
def document_title(annotation) |
|
||||||
return annotation.document.short_title if annotation.document.short_title.present? |
|
||||||
|
|
||||||
annotation.document.title |
|
||||||
end |
|
||||||
|
|
||||||
def date_or_year(annotation) |
|
||||||
return annotation.document.docdate.to_date.strftime("%B %d, %Y") if annotation.document.docdate.present? |
|
||||||
|
|
||||||
annotation.document.year |
|
||||||
end |
|
||||||
|
|
||||||
def render? |
|
||||||
opts[:is_render].present? |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,42 +0,0 @@ |
|||||||
<div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" data-controller="application" |
|
||||||
data-href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>" |
|
||||||
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"> |
|
||||||
<% document_title = jurisprudence.short_title || jurisprudence.title %> |
|
||||||
<% 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> |
|
||||||
|
|
||||||
<% annotations.each do |annotation| %> |
|
||||||
<p class="mb-0 ms-5"> |
|
||||||
<% annotated_documents_title = [] %> |
|
||||||
<% annotation.documents.each do |annotated_document| %> |
|
||||||
<% 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 %> |
|
||||||
<% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %> |
|
||||||
<% 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(', ') %> |
|
||||||
</p> |
|
||||||
|
|
||||||
<% if annotation.editor_notes.present? %> |
|
||||||
<div class="row ms-5"> |
|
||||||
<div class="col-sm-2 p-0" style="width: 105px;"> |
|
||||||
<span> Editor's Note: </span> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="col-sm-10 ps-0"> |
|
||||||
<%= raw annotation.editor_notes %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<hr/> |
|
||||||
</div> |
|
||||||
@ -0,0 +1,37 @@ |
|||||||
|
class SubjectAccordionComponent < BaseComponent |
||||||
|
with_collection_parameter :search_result |
||||||
|
attr_reader :search_result, :opts |
||||||
|
|
||||||
|
def initialize(search_result:, current_user:, opts: {}) |
||||||
|
@search_result = search_result |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def parent_accordion_id |
||||||
|
return "subjectsAccordion" if search_result["parent_id"].blank? |
||||||
|
|
||||||
|
["subjectsAccordion", search_result["parent_id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def children_accordion_id |
||||||
|
["subjectsAccordion", search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_id |
||||||
|
["subjectsAccordion", search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_body_id |
||||||
|
accordion_body = opts[:accordionFor].present? && opts[:accordionFor].to_s.eql?("subjects") ? "subjectsAccordionBody" : "doctrinesAccordionBody" |
||||||
|
|
||||||
|
[accordion_body, search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def custom_url |
||||||
|
return search_doctrines_path(subject_ids: [search_result["id"]], is_index_table: false) if opts[:accordionFor].present? && opts[:accordionFor].to_s.eql?("subjects") |
||||||
|
return search_doctrines_path(subject_ids: [search_result["id"]], is_index_table: true) if opts[:accordionFor].present? && opts[:accordionFor].to_s.eql?("doctrines") |
||||||
|
|
||||||
|
return subject_index_path(search_result["id"]).blank? |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
@ -0,0 +1,26 @@ |
|||||||
|
<div class="accordion accordion-flash" id="<%= parent_accordion_id %>"> |
||||||
|
<div class="accordion-item"> |
||||||
|
<div class="accordion-header d-flex justify-content-between"> |
||||||
|
<% if search_result["has_children?"].present? %> |
||||||
|
<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-accordion-id="<%= children_accordion_id %>" |
||||||
|
data-accordion-for="<%= opts[:accordionFor] %>" data-subject-parent-id="<%= search_result["id"] %>" |
||||||
|
data-accordion-target="#<%= accordion_body_id %>" 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" %> |
||||||
|
</div> |
||||||
|
<% 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" %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= children_accordion_id %>" data-bs-parent="#<%= parent_accordion_id %>"> |
||||||
|
<div class="accordion-body pt-1 sub-body<%= search_result["heirarchy_level"] + 1 %> pb-1" id="<%= accordion_body_id %>"> |
||||||
|
<div class="text-center"> |
||||||
|
<div class="spinner-border text-danger" role="status"> |
||||||
|
<span class="visually-hidden">Loading...</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -1,38 +0,0 @@ |
|||||||
class SubjectsAccordionComponent < BaseComponent |
|
||||||
with_collection_parameter :search_result |
|
||||||
attr_reader :search_result, :opts |
|
||||||
|
|
||||||
def initialize(search_result:, current_user:, opts: {}) |
|
||||||
@search_result = search_result |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_name |
|
||||||
"subjectsAccordion" |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_body_name |
|
||||||
"subjectsAccordionBody" |
|
||||||
end |
|
||||||
|
|
||||||
def parent_accordion_id |
|
||||||
[accordion_name, search_result["parent_id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def children_accordion_id |
|
||||||
[accordion_name, search_result["heirarchy_level"], search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_id |
|
||||||
[accordion_name, search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_body_id |
|
||||||
[accordion_body_name, search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def custom_url |
|
||||||
subject_index_path(search_result["id"]) |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
@ -1,31 +0,0 @@ |
|||||||
<div class="accordion accordion-flush" id="<%= accordion_id %>"> |
|
||||||
<div class="accordion-item"> |
|
||||||
<div class="accordion-header d-flex justify-content-between"> |
|
||||||
<% if search_result["has_children?"].present? %> |
|
||||||
<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-action="click->subjects#loadSubjectsAccordion"> |
|
||||||
<%= 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: 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> |
|
||||||
<% 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", |
|
||||||
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 %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= children_accordion_id %>" data-bs-parent="#<%= accordion_id %>"> |
|
||||||
<div class="accordion-body pt-1 sub-body<%= search_result["heirarchy_level"] + 1 %> pb-0" id="<%= accordion_body_id %>"> |
|
||||||
<div class="text-center"> |
|
||||||
<div class="spinner-border text-danger" role="status"> |
|
||||||
<span class="visually-hidden">Loading...</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
@ -1,39 +0,0 @@ |
|||||||
class SubjectsOffcanvasAccordionComponent < BaseComponent |
|
||||||
with_collection_parameter :search_result |
|
||||||
attr_reader :search_result, :opts |
|
||||||
|
|
||||||
def initialize(search_result:, current_user:, opts: {}) |
|
||||||
@search_result = search_result |
|
||||||
@opts = opts |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_name |
|
||||||
"subjectsOffCanvasAccordion" |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_body_name |
|
||||||
"subjectsOffCanvasAccordionBody" |
|
||||||
end |
|
||||||
|
|
||||||
def parent_accordion_id |
|
||||||
return accordion_body_name if search_result["parent_id"].blank? |
|
||||||
|
|
||||||
[accordion_name, search_result["parent_id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def children_accordion_id |
|
||||||
[accordion_name, search_result["heirarchy_level"], search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_id |
|
||||||
[accordion_name, search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def accordion_body_id |
|
||||||
[accordion_body_name, search_result["id"]].join |
|
||||||
end |
|
||||||
|
|
||||||
def index_url |
|
||||||
search_documents_path(subject_ids: search_result["id"], is_index_table: true) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,27 +0,0 @@ |
|||||||
<div class="accordion accordion-flush offcanvas-item" id="<%= accordion_id %>"> |
|
||||||
<div class="accordion-item"> |
|
||||||
<div class="accordion-header d-flex justify-content-between"> |
|
||||||
<% if search_result["has_children?"].present? %> |
|
||||||
<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-action="click->subjects#loadSubjectsOffcanvasAccordion"> |
|
||||||
<%= 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> |
|
||||||
<% else %> |
|
||||||
<%= 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 %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= children_accordion_id %>" data-bs-parent="#<%= accordion_id %>"> |
|
||||||
<div class="accordion-body pt-1 sub-body<%= search_result["heirarchy_level"] + 1 %> pb-1" id="<%= accordion_body_id %>"> |
|
||||||
<div class="text-center"> |
|
||||||
<div class="spinner-border text-danger" role="status"> |
|
||||||
<span class="visually-hidden">Loading...</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
@ -1,40 +1,15 @@ |
|||||||
<div class="offcanvas offcanvas-start offcanvas-contents" data-bs-scroll="true" tabindex="-1" data-bs-backdrop="false" id="subjectsOffCanvas" data-controller="subjects"> |
<div class="offcanvas offcanvas-start offcanvas-contents" data-bs-scroll="true" tabindex="-1" data-bs-backdrop="false" id="<%= opts[:element_id] %>" data-controller="subjects"> |
||||||
<div class="offcanvas-header"> |
<div class="offcanvas-header"> |
||||||
<h5 class="offcanvas-title"> Subjects </h5> |
<h5 class="offcanvas-title"> <%=opts[:header_title]%> </h5> |
||||||
<hr class="m-0"> |
<hr class="m-0"> |
||||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button> |
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<div class="offcanvas-body"> |
<div class="offcanvas-body" id="<%= opts[:accordion_body_id] %>"> |
||||||
<div class="accordion accordion-flush subject-index-body" id="subjectsOffCanvasMainAccordion" > |
<div class="text-center"> |
||||||
<% Cdao::Subject.roots.order(name: :asc).each do |root| %> |
<div class="spinner-border text-danger" role="status"> |
||||||
<div class="accordion-item"> |
<span class="visually-hidden">Loading...</span> |
||||||
<div class="accordion-header d-flex justify-content-between"> |
</div> |
||||||
<% if root.children.present? %> |
|
||||||
<div class="accordion-button collapsed m-0 p-0" data-bs-toggle="collapse" data-bs-target="#<%= ["subjectsOffCanvasAccordion", root.id].join %>" |
|
||||||
data-controller="subjects" data-subject-parent-id="<%= root.id %>" |
|
||||||
data-accordion-target="#<%= ['subjectsOffCanvasAccordionBody', root.id].join %>" |
|
||||||
data-action="click->subjects#loadSubjectsOffcanvasAccordion"> |
|
||||||
<%= 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> |
|
||||||
<% 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", |
|
||||||
data: { controller: "application", href: search_documents_path(subject_ids: root.id, is_index_table: true), action: "click->application#openLink" } %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= ["subjectsOffCanvasAccordion", root.id].join %>" data-bs-parent="#subjectsOffCanvasMainAccordion"> |
|
||||||
<div class="accordion-body pt-1 pb-1 sub-body1" id="<%= ["subjectsOffCanvasAccordionBody", root.id].join %>"> |
|
||||||
<div class="text-center"> |
|
||||||
<div class="spinner-border text-danger" role="status"> |
|
||||||
<span class="visually-hidden">Loading...</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
|
|||||||
@ -0,0 +1,93 @@ |
|||||||
|
<div class="accordion-collapse collapse" id="<%= opts[:main_sub_menu] %>" data-bs-parent="#sidenav"> |
||||||
|
<div class="accordion-body pb-0 pe-0 pt-0"> |
||||||
|
<% Cdao::Subject.roots.order(name: :asc).each do |root| %> |
||||||
|
<div class="accordion accordion-flush ps-20" id="firstLevelSubMenu"> |
||||||
|
<div class="accordion-item bg-transparent"> |
||||||
|
<div class="accordion-header bg-transparent"> |
||||||
|
<% if root.children.present? %> |
||||||
|
<button class="<%= root.children.present? ? 'accordion-button' : '' %> collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:second_sub_menu], root.id].join %>"> |
||||||
|
<%= link_to root.name, index_url(root.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub1 clickable-link" %> |
||||||
|
</button> |
||||||
|
<% else %> |
||||||
|
<%= link_to root.name, index_url(root.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub1 clickable-link" %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<% if root.children.present? %> |
||||||
|
<div class="accordion-collapse collapse" id="<%= [opts[:second_sub_menu], root.id].join %>" data-bs-parent="#firstLevelSubMenu"> |
||||||
|
<div class="accordion-body pb-0 pe-0 pt-0"> |
||||||
|
<% root.children.order(name: :asc).each do |sub1| %> |
||||||
|
<div class="accordion accordion-flush ps-20" id="secondLevelSubMenu"> |
||||||
|
<div class="accordion-item bg-transparent"> |
||||||
|
<div class="accordion-header bg-transparent"> |
||||||
|
<% if sub1.children.present? %> |
||||||
|
<button class="<%= sub1.children.present? ? 'accordion-button' : '' %> collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:third_sub_menu], sub1.id].join %>"> |
||||||
|
<%= link_to sub1.name, index_url(sub1.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub2 clickable-link" %> |
||||||
|
</button> |
||||||
|
<% else %> |
||||||
|
<%= link_to sub1.name, index_url(sub1.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub2 clickable-link" %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= [opts[:third_sub_menu], sub1.id].join %>" data-bs-parent="#secondLevelSubMenu"> |
||||||
|
<div class="accordion-body pb-0 pe-0 pt-0"> |
||||||
|
<% sub1.children.order(name: :asc).each do |sub2| %> |
||||||
|
<div class="accordion accordion-flush" id="thirdLevelSubMenu"> |
||||||
|
<div class="accordion-item bg-transparent"> |
||||||
|
<div class="accordion-header bg-transparent"> |
||||||
|
<% if sub2.children.present? %> |
||||||
|
<button class="<%= sub2.children.present? ? 'accordion-button' : '' %> collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:fourth_sub_menu], sub2.id].join %>"> |
||||||
|
<%= link_to sub2.name, index_url(sub2.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub3 clickable-link" %> |
||||||
|
</button> |
||||||
|
<% else %> |
||||||
|
<%= link_to sub2.name, index_url(sub2.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub3 clickable-link" %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= [opts[:fourth_sub_menu], sub2.id].join %>" data-bs-parent="#thirdLevelSubMenu"> |
||||||
|
<div class="accordion-body pb-0 pe-0 pt-0"> |
||||||
|
<% sub2.children.order(name: :asc).each do |sub3| %> |
||||||
|
<div class="accordion accordion-flush ps-20" id="fourthLevelSubMenu"> |
||||||
|
<div class="accordion-item bg-transparent"> |
||||||
|
<div class="accordion-header"> |
||||||
|
<% if sub3.children.present? %> |
||||||
|
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:fifth_sub_menu], sub3.id].join %>"> |
||||||
|
<%= link_to sub3.name, index_url(sub3.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub4 clickable-link" %> |
||||||
|
</button> |
||||||
|
<% else%> |
||||||
|
<%= link_to sub3.name, index_url(sub3.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub4 clickable-link" %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= [opts[:fifth_sub_menu], sub3.id].join %>" data-bs-parent="#fourthLevelSubMenu"> |
||||||
|
<div class="accordion-body pb-0 pe-0 pt-0"> |
||||||
|
<% sub3.children.order(name: :asc).each do |sub4| %> |
||||||
|
<div class="accordion-item bg-transparent"> |
||||||
|
<div class="accordion-header"> |
||||||
|
<%= link_to sub4.name, index_url(sub4.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub5 clickable-link" %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end if sub3.children.present? %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end if sub2.children.present? %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end if sub1.children.present? %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end if root.children.present? %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end if Cdao::Subject.roots.present? %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -1,21 +0,0 @@ |
|||||||
module AnnotationSearch |
|
||||||
def annotation_search(search_params) |
|
||||||
fulltext_fields = %i[phil_rep].freeze |
|
||||||
|
|
||||||
search = ::Annotation.search do |
|
||||||
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? |
|
||||||
|
|
||||||
%i[doctrine_id document_id].each do |field| |
|
||||||
with field, search_params[field] if search_params[field].present? |
|
||||||
end |
|
||||||
|
|
||||||
order_by :library_rank, :asc |
|
||||||
order_by :search_year, :desc |
|
||||||
order_by :search_doc_date, :desc |
|
||||||
|
|
||||||
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20 |
|
||||||
end |
|
||||||
|
|
||||||
search |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,78 +1,30 @@ |
|||||||
module JurisprudenceSearch |
module JurisprudenceSearch |
||||||
def jurisprudence_search(search_params) |
def jurisprudence_search(search_params) |
||||||
search_params.each { |k, v| params[k] = v.gsub(/“|”/, '"') if v.is_a?(String) } |
|
||||||
fulltext_fields = %i[reference_number title short_title].freeze |
fulltext_fields = %i[reference_number title short_title].freeze |
||||||
|
|
||||||
search = Cdao::Jurisprudence.search do |
search = Cdao::Jurisprudence.search do |
||||||
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? |
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? |
||||||
|
|
||||||
%i[reference_number title short_title].each do |field| |
fulltext_fields.each do |field| |
||||||
fulltext search_params[field], fields: [field], query_phrase_slop: 1 if search_params[field].present? |
fulltext search_params[field], fields: [field] if search_params[field].present? |
||||||
end |
end |
||||||
|
|
||||||
if search_params[:year_start].present? && search_params[:year_end].present? |
with(:year, search_params[:year].to_i) if search_params[:year].present? |
||||||
with(:year).between(search_params[:year_start].to_i..search_params[:year_start].to_i) |
|
||||||
end |
|
||||||
|
|
||||||
if search_params[:year_start].present? && search_params[:year_end].blank? |
|
||||||
with(:year, search_params[:year_start].to_i) |
|
||||||
end |
|
||||||
|
|
||||||
with(:subject_ids).any_of(search_params[:subject_ids].split(",").map(&:strip).map(&:to_i)) if search_params[:subject_ids].present? |
with(:subject_ids).any_of(search_params[:subject_ids].split(",").map(&:strip).map(&:to_i)) if search_params[:subject_ids].present? |
||||||
|
|
||||||
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(search_params[:citation_finder]) if search_params[:citation_finder].present? |
||||||
|
|
||||||
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? |
||||||
|
|
||||||
if search_params[:sort_by].blank? |
|
||||||
order_by :search_year, :desc |
|
||||||
order_by :search_doc_date, :desc |
|
||||||
order_by :reference_number, :desc |
|
||||||
end |
|
||||||
|
|
||||||
|
with(:is_only_in_premium_libraries, false) |
||||||
|
|
||||||
|
order_by :doc_date, :desc |
||||||
|
order_by :year, :desc |
||||||
|
|
||||||
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20 |
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20 |
||||||
end |
end |
||||||
|
|
||||||
search |
search |
||||||
end |
end |
||||||
|
|
||||||
def sanitize_citer_finder_param(citation_finder_param) |
|
||||||
citation_finder = [] |
|
||||||
params_vol = [] |
|
||||||
params_type = [] |
|
||||||
params_page = [] |
|
||||||
params[:citation_finder].scan(/\b((\d+\-?\w?)\s(SCRA|PhilRep|Phil|\S+)\.?,?\s?([-,\d\s]+)?)\b/i).map do |cit_fin| |
|
||||||
params_vol << cit_fin[1].gsub(/\s+/, "").gsub(/\A0*/, "") |
|
||||||
params_type.concat(case cit_fin[2] |
|
||||||
when /SCRA/i |
|
||||||
["SCRA"] |
|
||||||
when /(PhilRep|Phil)\.?,?/i |
|
||||||
["Phil"] |
|
||||||
else |
|
||||||
[] |
|
||||||
end |
|
||||||
) |
|
||||||
cit_fin[3].scan(/\d+-?\d*/).each do |page| |
|
||||||
if page.match?(/-/) |
|
||||||
page_range = [] |
|
||||||
page.scan(/\d+?\d*/).each do |each_page| |
|
||||||
page_range << each_page.to_i |
|
||||||
end |
|
||||||
params_page.concat((page_range[0]..page_range[1]).to_a) |
|
||||||
else |
|
||||||
params_page << page.to_i if params_page.index(page.to_i).blank? |
|
||||||
end |
|
||||||
end if cit_fin[3].present? |
|
||||||
end |
|
||||||
|
|
||||||
params_type.compact.each do |type| |
|
||||||
citation_finder << "#{params_vol[0] if params_vol.present?} #{type}" if params_page.blank? |
|
||||||
params_page.compact.uniq.each do |page| |
|
||||||
citation_finder << "#{params_vol[0] if params_vol.present?} #{type} #{page}" |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
return [] if citation_finder.blank? |
|
||||||
citation_finder |
|
||||||
end |
|
||||||
end |
end |
||||||
|
|||||||
@ -1,12 +1,7 @@ |
|||||||
class Document::DoctrinesController < ApplicationController |
class Document::DoctrinesController < ApplicationController |
||||||
include AnnotationSearch |
|
||||||
|
|
||||||
load_and_authorize_resource :document, class: "Cdao::Jurisprudence" |
load_and_authorize_resource :document, class: "Cdao::Jurisprudence" |
||||||
load_and_authorize_resource :doctrine, class: "Doctrine", through: :document |
load_and_authorize_resource :doctrine, class: "Doctrine", through: :document |
||||||
|
|
||||||
|
|
||||||
def show |
def show; end |
||||||
search = annotation_search({ doctrine_id: @doctrine.id }) |
|
||||||
@annotations = search.results |
|
||||||
end |
|
||||||
end |
end |
||||||
|
|||||||
@ -1,17 +0,0 @@ |
|||||||
class ReportsController < ApplicationController |
|
||||||
include DoctrineSearch |
|
||||||
|
|
||||||
def index |
|
||||||
authorize! :display, Doctrine |
|
||||||
|
|
||||||
search = doctrine_search(search_params) |
|
||||||
@results = search.results |
|
||||||
@users = User.all |
|
||||||
end |
|
||||||
|
|
||||||
private |
|
||||||
|
|
||||||
def search_params |
|
||||||
params.permit(:created_at, :created_at_start, :created_at_end, :q, :page, :per_page, exclude_ids: [], subject_ids: [], user_ids: []) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
import ApplicationController from './application_controller' |
|
||||||
export default class extends ApplicationController { |
|
||||||
static targets = ["q", "headnote", "date_created"] |
|
||||||
|
|
||||||
connect () { |
|
||||||
super.connect() |
|
||||||
} |
|
||||||
|
|
||||||
search () { |
|
||||||
var $search_box = $('.advanced-search-box'),
|
|
||||||
search_params = { q: this.qTarget.value, headnote: this.headnoteTarget.value,
|
|
||||||
subject_ids: $search_box.find("select[name='subject_ids[]']").val(), |
|
||||||
user_ids: $search_box.find("select[name='user_ids[]']").val() } |
|
||||||
|
|
||||||
this.stimulate("ReportsReflex#render_search_results", search_params) |
|
||||||
} |
|
||||||
} |
|
||||||
|
Before Width: | Height: | Size: 508 KiB |
@ -1,144 +0,0 @@ |
|||||||
(function ($) { |
|
||||||
'use strict'; |
|
||||||
$.fn.footnotes = function () { |
|
||||||
var a, b, c; |
|
||||||
a = $(this), b = a.find('a[href^="#footnote"]') |
|
||||||
c = a.find('p>span, p>a[href^="#fn"]>span').filter(function() { |
|
||||||
return ($(this).css('color') == 'rgb(255, 0, 0)') |
|
||||||
}) |
|
||||||
|
|
||||||
b.each(function(){ |
|
||||||
var $this = $(this); |
|
||||||
if($this.anchor_check()){ |
|
||||||
if(!$this.parent('span.footnote-x').length){ |
|
||||||
// Wrap the anchor with 'footnote-x'
|
|
||||||
$this.wrap('<span class="footnote-x"></span>') |
|
||||||
} |
|
||||||
} |
|
||||||
}) |
|
||||||
// Append index to every anchor
|
|
||||||
b = a.find('span.footnote-x a[href^="#footnote"]') |
|
||||||
b.each(function(){ |
|
||||||
var $this = $(this); |
|
||||||
var $matches = $($this.prop("tagName") + '#' + $this.attr("id") + ':not([data-index])') |
|
||||||
var index = 0; |
|
||||||
$matches.each(function(){ |
|
||||||
$(this).attr('id', $(this).attr('id') + '_' + index) |
|
||||||
$(this).attr('name', $(this).attr('name') + '_' + index) |
|
||||||
$(this).attr('href', $(this).attr('href') + '_' + index) |
|
||||||
$(this).attr('data-index', index) |
|
||||||
index = index + 1; |
|
||||||
}) |
|
||||||
}) |
|
||||||
c.each(function(){ |
|
||||||
var $this = $(this) |
|
||||||
$this.footnote_check() |
|
||||||
}) |
|
||||||
c = a.find('a[href^="#fn"]') |
|
||||||
c.each(function(){ |
|
||||||
var $this = $(this); |
|
||||||
var $matches = $($this.prop("tagName") + '#' + $this.attr("id") + ':not([data-index])') |
|
||||||
var index = 0; |
|
||||||
$matches.each(function(){ |
|
||||||
var self, parent |
|
||||||
self = $(this), parent = self.parent() |
|
||||||
self.closest('p').find('#cdasiatab').detach() |
|
||||||
self.attr('id', self.attr('id') + '_' + index) |
|
||||||
self.attr('name', self.attr('name') + '_' + index) |
|
||||||
self.attr('href', self.attr('href') + '_' + index) |
|
||||||
self.attr('data-index', index) |
|
||||||
parent.is('a') ? parent.replaceWith(self) : parent.closest('a').replaceWith(parent) // Remove parent its parent 'a' tag
|
|
||||||
index = index + 1; |
|
||||||
}) |
|
||||||
}) |
|
||||||
} |
|
||||||
$.fn.anchor_check = function () { |
|
||||||
var a, b, c, d; |
|
||||||
a = $(this), b = a.attr('href'), c = $.trim(a.text()) |
|
||||||
if(!$.isNumeric($.trim(c)) && c != '*' && c != 'n'){return false} |
|
||||||
if($.trim(b) && a.is('[href^="#footnote"]')){ |
|
||||||
// Check whether href, name and text is valid
|
|
||||||
var a_href_id = a.attr('href').substring(9) // Get only the value after '#footnote'
|
|
||||||
var a_name_id = a.attr('name') ? a.attr('name').substring(2) : a_href_id // Get only the value after 'fn' if name attr is present if not return a_href_id
|
|
||||||
var a_id = a.attr('id') ? a.attr('id').substring(2) : '' |
|
||||||
if(a_href_id != a_name_id || a_href_id != c || a_id != c || a_name_id != c){ |
|
||||||
a.attr('href', '#footnote' + c), a.attr('id', 'fn' + c), a.attr('name', 'fn' + c) |
|
||||||
} |
|
||||||
}else{ |
|
||||||
// If anchor to footnote is invalid by href=#footnote*** or no href
|
|
||||||
// the text inside the 'a' tag will use as a reference
|
|
||||||
a.attr('href', '#footnote' + c), a.attr('id', 'fn' + c), a.attr('name', 'fn' + c) |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
$.fn.footnote_check = function () { |
|
||||||
var a, b, c, d; |
|
||||||
a = $(this), d = null |
|
||||||
if(a.find('a:not([href^="#footnote"])').length){ |
|
||||||
a.find('a').each(function(){ |
|
||||||
b = $.trim($(this).text()), c = b.match(/([\*]{1,3}|[\d]{1,3})/) |
|
||||||
if(c!= null){ |
|
||||||
c = c[0] |
|
||||||
d = $(document.createElement('a')) |
|
||||||
d.text(b), d.attr('href', '#fn' + c), d.attr('id', 'footnote' + c), d.attr('name', 'footnote' + c), d.addClass('m-r-lg'), d.css('color', 'red') |
|
||||||
a.html(''), a.append(d) |
|
||||||
return true; |
|
||||||
} |
|
||||||
}) |
|
||||||
if(d=null){ |
|
||||||
return false |
|
||||||
} |
|
||||||
}else if(!a.find('a').length){ |
|
||||||
b = $.trim(a.text()), c = b.match(/([\*]{1,3}|[\d]{1,3})/) |
|
||||||
if(c!= null){ |
|
||||||
c = c[0] |
|
||||||
d = $(document.createElement('a')) |
|
||||||
d.text(b), d.attr('href', '#fn' + c), d.attr('id', 'footnote' + c), d.attr('name', 'footnote' + c), d.addClass('m-r-lg'), d.css('color', 'red') |
|
||||||
a.html(''), a.append(d) |
|
||||||
}else{ |
|
||||||
return false |
|
||||||
} |
|
||||||
} |
|
||||||
return true |
|
||||||
} |
|
||||||
$.fn.footnote = function () { |
|
||||||
var a = $(this) |
|
||||||
// Validation of footnote
|
|
||||||
var b, c, d; |
|
||||||
b = $(a.attr('href')) |
|
||||||
if(b.length<=0 && a.data('index')>0){ |
|
||||||
var a_id = a.attr('id').substring(0, a.attr('id').indexOf('_')) |
|
||||||
var a_like = $('a[href^="#footnote"][id^="' + a_id + '"]') |
|
||||||
var a_found = false; |
|
||||||
a_like.each(function(){ |
|
||||||
if(!a_found){b = $($(this).attr('href'))} |
|
||||||
a_found = b.length>0 |
|
||||||
}) |
|
||||||
} |
|
||||||
if(b.length>0){ |
|
||||||
c = b.closest('p') |
|
||||||
d = c.footnote_text(b.parent('span') || b), d = d.substring(0,499) + (d.length > 500 ? '...' : '') |
|
||||||
a.attr('data-original-title', d), a.attr('data-toggle', 'tooltip') |
|
||||||
a.tooltip({title: d}), a.tooltip('show') |
|
||||||
}else{ |
|
||||||
// typeof a._errorReport === "function" && a._errorReport({
|
|
||||||
// type: 'footnote',
|
|
||||||
// details: 'Footnote not found @ ' + a.attr('href')
|
|
||||||
// })
|
|
||||||
} |
|
||||||
return a |
|
||||||
} |
|
||||||
$.fn.footnote_text = function (except) { |
|
||||||
var a = ''; |
|
||||||
$(this).children().not(except).each(function(){ |
|
||||||
// Check first if the current select element not equal to except
|
|
||||||
var self = $(this) |
|
||||||
a += self.text() |
|
||||||
}) |
|
||||||
return a; |
|
||||||
} |
|
||||||
$(document).on('mouseover mouseenter focus', 'a[href^="#footnote"]', function(event){ |
|
||||||
event.preventDefault() |
|
||||||
$(this).footnote() |
|
||||||
}) |
|
||||||
}(jQuery)) |
|
||||||
@ -1,38 +0,0 @@ |
|||||||
.subject-body-index .accordion-item{ |
|
||||||
border-bottom: 1px solid #e5e5e5 !important; |
|
||||||
} |
|
||||||
|
|
||||||
.subject-body-index .accordion-button:not(.collapsed) { |
|
||||||
background-color: #fff; |
|
||||||
a { |
|
||||||
color: darkred !important; |
|
||||||
font-weight: 600; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.subject-body-index .sub-body1 { |
|
||||||
max-width: 100% !important; |
|
||||||
padding-bottom: 0 !important; |
|
||||||
padding-left: 26px !important; |
|
||||||
padding-right: 0 !important; |
|
||||||
} |
|
||||||
|
|
||||||
.subject-body-index .sub-body2, .sub-body3, .sub-body4, .sub-body5, .sub-body6, .sub-body7 { |
|
||||||
max-width: 100% !important; |
|
||||||
padding-bottom: 0 !important; |
|
||||||
padding-right: 0 !important; |
|
||||||
} |
|
||||||
|
|
||||||
.non-toggle { |
|
||||||
margin-right: 65px !important; |
|
||||||
} |
|
||||||
|
|
||||||
.sub-icon-add a { |
|
||||||
font-size: large; |
|
||||||
color: #4caf50; |
|
||||||
} |
|
||||||
|
|
||||||
.sub-icon-add a:hover { |
|
||||||
color: darkred; |
|
||||||
} |
|
||||||
|
|
||||||
@ -1,66 +0,0 @@ |
|||||||
class ParseLinkableContentJob < ActiveJob::Base |
|
||||||
queue_as :default |
|
||||||
|
|
||||||
def perform(annotation) |
|
||||||
content = "" |
|
||||||
document = annotation.document |
|
||||||
citing_docs = annotation.documents |
|
||||||
|
|
||||||
if annotation.content.present? |
|
||||||
content = annotation.content.gsub("<div>", "").gsub("</div>", "") |
|
||||||
|
|
||||||
contents = content.split(" citing ") |
|
||||||
contents.each_with_index do |content, i| |
|
||||||
linkable_content = nil |
|
||||||
if i.eql?(0) |
|
||||||
linkable_content = add_linkable_content(document.id, [content[i], clean_phil_rep(annotation)].reject(&:blank?).join(", ")) |
|
||||||
else |
|
||||||
citing_docs.each do |citing_doc| |
|
||||||
old_content = contents[i] |
|
||||||
next if !old_content.include?(citing_doc.clean_reference_number) |
|
||||||
|
|
||||||
linkable_content = add_linkable_content(citing_doc.id, old_content) |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
contents[i] = linkable_content |
|
||||||
end |
|
||||||
|
|
||||||
content = contents.join(" citing ") |
|
||||||
else |
|
||||||
contents = [] |
|
||||||
doc_title = document.short_title || document.title |
|
||||||
doc_date_or_year = document.doc_date.present? ? document.doc_date.strftime("%B %d, %Y") : document.year |
|
||||||
doc_ref_num = document.clean_reference_number |
|
||||||
contents << add_linkable_content(document.id, [doc_title, doc_ref_num, doc_date_or_year, clean_phil_rep(annotation)].reject(&:blank?).join(", ")) |
|
||||||
|
|
||||||
if citing_docs.present? |
|
||||||
citing_docs.each do |citing_doc| |
|
||||||
citing_doc_title = citing_doc.short_title || citing_doc.title |
|
||||||
citing_doc_date_or_year = citing_doc.doc_date.present? ? citing_doc.doc_date.strftime("%B %d, %Y") : citing_doc.year |
|
||||||
citing_doc_ref_num = citing_doc.clean_reference_number |
|
||||||
|
|
||||||
citing_content = [citing_doc_title, citing_doc_date_or_year, citing_doc_ref_num].join(", ") |
|
||||||
contents << ["citing", add_linkable_content(citing_doc, citing_content)].join(" ") |
|
||||||
end |
|
||||||
end |
|
||||||
content = contents.join(", ") |
|
||||||
end |
|
||||||
|
|
||||||
annotation.update_column(:content, content) if content.present? |
|
||||||
annotation.index! |
|
||||||
end |
|
||||||
|
|
||||||
private |
|
||||||
def add_linkable_content(document_id, content) |
|
||||||
document_route = Rails.application.routes.url_helpers.document_path(document_id) |
|
||||||
|
|
||||||
"<a href='#{document_route}'> #{content} </a>" |
|
||||||
end |
|
||||||
|
|
||||||
def clean_phil_rep(annotation) |
|
||||||
return if annotation.phil_rep.blank? |
|
||||||
|
|
||||||
annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,42 +0,0 @@ |
|||||||
# frozen_string_literal: true |
|
||||||
|
|
||||||
class DoctrinesReflex < ApplicationReflex |
|
||||||
include DoctrineSearch |
|
||||||
include DocumentSearch |
|
||||||
|
|
||||||
def render_document_doctrines_index(search_params) |
|
||||||
search = doctrine_search(search_params) |
|
||||||
morph "#doctrinesIndexView", render(partial: "/shared/document_doctrines_index", locals: { doctrines: search.results, current_user: current_user, opts: { document_id: search_params[:jurisprudence_id], current_page: search_params[:page] } }) |
|
||||||
end |
|
||||||
|
|
||||||
def render_annotation_modal_form(document_id, doctrine_id) |
|
||||||
jurisprudence = Cdao::Jurisprudence.find(document_id) |
|
||||||
document = Cdao::Document.where(reference_number: jurisprudence.reference_number).first |
|
||||||
morph "#doctrineModal", render(partial: "/shared/annotation_modal_form", locals: { document: document, doctrine_id: doctrine_id, jurisprudence: jurisprudence }) |
|
||||||
end |
|
||||||
|
|
||||||
def render_annotation_form(document_id, doctrine_id) |
|
||||||
jurisprudence = Cdao::Jurisprudence.find(document_id) |
|
||||||
document = Cdao::Document.where(reference_number: jurisprudence.reference_number).first |
|
||||||
morph "#doctrineForm", render(partial: "/shared/annotation_form", locals: { annotation: Annotation.new, document: document, doctrine_id: doctrine_id, jurisprudence: jurisprudence }) |
|
||||||
end |
|
||||||
|
|
||||||
def render_doctrine_form_annotations_view(annotations) |
|
||||||
morph "#doctrineAnnotationsView", render(partial: "/shared/doctrine_form_annotations_view", locals: { annotations: annotations }) |
|
||||||
end |
|
||||||
|
|
||||||
def render_citing_documents_search_results(search_params) |
|
||||||
search = document_search(search_params.merge(sort_by: %w[reference_number_texts title_texts short_title_texts])) |
|
||||||
@documents = search.results |
|
||||||
opts = { current_page: search_params[:page], q: search_params[:q] } |
|
||||||
morph "#citingDocumentsSearchResults", render(partial: "/shared/doctrine_form_citing_documents_search_results", locals: { documents: @documents, opts: opts }) |
|
||||||
end |
|
||||||
|
|
||||||
def render_default_citing_documents |
|
||||||
morph "#citingDocumentsSearchResults", render(partial: "/shared/doctrine_form_citing_documents_search_results", locals: { documents: [], opts: {} }) |
|
||||||
end |
|
||||||
|
|
||||||
def render_default_case_lists |
|
||||||
morph "#caseListsCollapse", render(partial: "/shared/doctrine_form_default_case_lists", locals: { documents: @documents, opts: {} }) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,10 +0,0 @@ |
|||||||
# frozen_string_literal: true |
|
||||||
|
|
||||||
class ReportsReflex < ApplicationReflex |
|
||||||
include DoctrineSearch |
|
||||||
|
|
||||||
def render_search_results(search_params) |
|
||||||
search = doctrine_search(search_params.reject { |k, v| v.blank? }) |
|
||||||
morph "div#searchResultsTable", render(partial: "search_results_table", locals: { search: search, current_user: current_user }) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,2 +0,0 @@ |
|||||||
json.(@annotation, *%i[id doctrine_id document_id phil_rep editor_notes annomark_ids citing_document_ids]) |
|
||||||
json.doctrine_jurisprudence @annotation.doctrine.doctrine_jurisprudences.first.jurisprudence |
|
||||||
@ -1,2 +0,0 @@ |
|||||||
json.(@annotation, *%i[id doctrine_id document_id phil_rep editor_notes annomark_ids citing_document_ids]) |
|
||||||
json.doctrine_jurisprudence @annotation.doctrine.doctrine_jurisprudences.first.jurisprudence |
|
||||||
@ -1,2 +0,0 @@ |
|||||||
json.(@annotation, *%i[id doctrine_id document_id phil_rep editor_notes annomark_ids citing_document_ids]) |
|
||||||
json.doctrine_jurisprudence @annotation.doctrine.doctrine_jurisprudences.first.jurisprudence |
|
||||||
@ -1,3 +0,0 @@ |
|||||||
json.array!(@annotations) do |annotation| |
|
||||||
json.extract! annotation, *%i[id doctrine_id document_id phil_rep editor_notes annomark_ids created_at updated_at] |
|
||||||
end |
|
||||||
@ -1,3 +0,0 @@ |
|||||||
json.array!(@annotations) do |annotation| |
|
||||||
json.extract! annotation, *%i[id doctrine_id document_id phil_rep editor_notes annomark_ids created_at updated_at] |
|
||||||
end |
|
||||||
@ -1,3 +0,0 @@ |
|||||||
json.array!(@doctrines) do |doctrine| |
|
||||||
json.extract! doctrine, *%i[id subject_ids headnote content plain_content created_at updated_at] |
|
||||||
end |
|
||||||
@ -1,15 +1,6 @@ |
|||||||
<div class="container-fluid row p-0 m-0"> |
<div class="card container-sm mt-1 p-0"> |
||||||
<div class="container col-xs-12 col-sm-12 col-md-3 col-lg-3 col-xl-3" > |
<h4 class="card-header"> Select Year </h4> |
||||||
<div class="advanced-search-box"> |
<div class="card-body table-responsive p-0"> |
||||||
<%= render(DocumentAdvancedSearchComponent.new(current_user: current_user, opts: { is_decisions_index: true })) %> |
<%= render(DocumentsYearsComponent.new(current_user: current_user, years: @years)) %> |
||||||
</div> |
|
||||||
</div> |
</div> |
||||||
<div class="container col-xs-12 col-sm-12 col-md-9 col-lg-9 col-xl-9"> |
<div> |
||||||
<div class="card container-sm mt-1 p-0"> |
|
||||||
<h4 class="card-header"> Select Year </h4> |
|
||||||
<div class="card-body table-responsive p-0"> |
|
||||||
<%= render(DocumentsYearsComponent.new(current_user: current_user, years: @years)) %> |
|
||||||
</div> |
|
||||||
<div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|||||||
@ -1,15 +0,0 @@ |
|||||||
<div class="container-fluid mt-2 p-0" id="annotationForm" |
|
||||||
data-controller="annotations" data-annotation-id="<%= @annotation.id %>" data-doctrine-id="<%= @annotation.doctrine_id %>" |
|
||||||
data-document-id="<%= @annotation.document_id %>" data-jurisprudence-id="<%= params[:jurisprudence_id] %>"> |
|
||||||
<div class="col-sm-12"> |
|
||||||
<div class="card-header" style="border-bottom: 1px solid darkred;"> <h4 class="mb-0"> Edit Annotation </h4> </div> |
|
||||||
<div class="card-body"> |
|
||||||
<%= render(AnnotationFormComponent.new(current_user: current_user, annotation: @annotation)) %> |
|
||||||
</div> |
|
||||||
<div class="card-footer d-flex justify-content-end mt-2"> |
|
||||||
<button type="button" class="btn btn-success me-2" data-action="click->annotations#save">Save</button> |
|
||||||
<a class="btn btn-danger ms-2" href="<%= document_doctrine_path(params[:jurisprudence_id], @doctrine.id) %>">Back</a> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue