From 805365fc4617574bea09533b74f39c6fbfc702df Mon Sep 17 00:00:00 2001 From: alexdbondoc17 Date: Wed, 9 Feb 2022 10:29:27 +0000 Subject: [PATCH] Fix `documents#search` --- ...nnotation_marks_modal_form_component.html.erb | 2 +- .../document_doctrine_show_component.html.erb | 2 +- .../controllers/document_controller.js | 6 ++---- .../_document_search_results_table.html.erb | 16 ++++++++-------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb b/app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb index 9c99070..bbd0cbc 100644 --- a/app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb +++ b/app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb @@ -37,8 +37,8 @@ - + diff --git a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb index 5e11d8c..6569abf 100644 --- a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb +++ b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb @@ -106,8 +106,8 @@
Reference No. Date Title Date
- + diff --git a/app/javascript/controllers/document_controller.js b/app/javascript/controllers/document_controller.js index 48d58fb..91c7495 100644 --- a/app/javascript/controllers/document_controller.js +++ b/app/javascript/controllers/document_controller.js @@ -10,7 +10,7 @@ export default class extends ApplicationController { search () { var $this = this - $.get("/api/jurisprudences.json", { q: $this.inputTarget.value }, function (data, status) { + $.get("/api/documents.json", { q: $this.inputTarget.value }, function (data, status) { if (status === "success") { $this.stimulate("DocumentReflex#render_index_table", data, $this.element.dataset["documentId"], $this.element.dataset["doctrineId"]) } @@ -50,7 +50,7 @@ export default class extends ApplicationController { } addCitingDocument () { - var document_id = "", document_ref_no = "", $modal = $("#newAnnotationModal"), $doc_title = $modal.find("#document_title") + var document_id = "", document_ref_no = "", document_date = "", document_title = "", $modal = $("#newAnnotationModal"), $doc_title = $modal.find("#document_title") document_id = this.element.dataset["documentId"] document_ref_no = this.element.dataset["documentReferenceNumber"] @@ -59,8 +59,6 @@ export default class extends ApplicationController { var document_ids = [] - console.log($("#document_ids").val() === "") - if ($("#document_ids").val() === "") { document_ids.push(document_id) } else { diff --git a/app/views/document/doctrines/_document_search_results_table.html.erb b/app/views/document/doctrines/_document_search_results_table.html.erb index ee4c564..8928eb5 100644 --- a/app/views/document/doctrines/_document_search_results_table.html.erb +++ b/app/views/document/doctrines/_document_search_results_table.html.erb @@ -2,15 +2,15 @@ - + <% if opts[:is_case_lists].present? && opts[:document_id].present? && opts[:doctrine_id].present? %> <% end %> -<% end %> \ No newline at end of file +<% end %>
Reference No. Date Title Date
<%= search_result["reference_number"] %> <%= search_result["short_title"] || search_result["title"] %> <%= search_result["docdate"].present? ? search_result["docdate"].to_date.strftime("%m/%d/%Y") : search_result["year"] %> <%= search_result["doc_date"].present? ? search_result["doc_date"].to_date.strftime("%m/%d/%Y") : search_result["year"] %> - <% date_or_year = search_result["docdate"].present? ? search_result["docdate"].to_date.strftime("%B %d, %Y") : search_result["year"] %> + <% date_or_year = search_result["doc_date"].present? ? search_result["doc_date"].to_date.strftime("%B %d, %Y") : search_result["year"] %> <% title = search_result["short_title"].present? ? search_result["short_title"] : search_result["title"] %> " data-document-reference-number="<%= search_result["reference_number"] %>" - data-document-date-or-year="<%= date_or_year %>" data-document-phil-rep="<%= search_result["phil_rep"] %>" + data-document-id="<%= search_result['id'] %>" data-document-reference-number="<%= search_result['reference_number'] %>" + data-document-date-or-year="<%= date_or_year %>" data-document-phil-rep="<%= search_result['phil_rep'] %>" data-action="click->document#loadFormDocumentDetais"> Add Annotations @@ -20,12 +20,12 @@ <% if opts[:is_citing_document].present? %> " - data-document-reference-number="<%= search_result["reference_number"] %>" - data-document-date="<%= search_result["docdate"].present? ? search_result["docdate"].to_date.strftime("%B %d, %Y") : search_result["year"] %>" - data-document-title="<%= search_result["short_title"] || search_result["title"] %>"> + data-document-reference-number="<%= search_result['reference_number'] %>" + data-document-date="<%= search_result['doc_date'].present? ? search_result['doc_date'].to_date.strftime('%B %d, %Y') : search_result['year'] %>" + data-document-title="<%= search_result['short_title'] || search_result['title'] %>"> Add