Browse Source

Fix `documents#search`

pull/32/head
alexdbondoc17 4 years ago
parent
commit
805365fc46
  1. 2
      app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb
  2. 2
      app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb
  3. 6
      app/javascript/controllers/document_controller.js
  4. 14
      app/views/document/doctrines/_document_search_results_table.html.erb

2
app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb

@ -37,8 +37,8 @@
<table class="table table-striped table-hover mb-0">
<thead>
<th class="bg-light"> Reference No. </th>
<th class="bg-light"> Date </th>
<th class="bg-light"> Title </th>
<th class="bg-light"> Date </th>
<th class="bg-light"> </th>
</thead>

2
app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb

@ -106,8 +106,8 @@
<table class="table table-striped table-hover mb-0">
<thead>
<th class="bg-light"> Reference No. </th>
<th class="bg-light"> Date </th>
<th class="bg-light"> Title </th>
<th class="bg-light"> Date </th>
<th class="bg-light"> </th>
</thead>

6
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 {

14
app/views/document/doctrines/_document_search_results_table.html.erb

@ -2,15 +2,15 @@
<tr>
<td> <%= search_result["reference_number"] %> </td>
<td> <%= search_result["short_title"] || search_result["title"] %> </td>
<td> <%= search_result["docdate"].present? ? search_result["docdate"].to_date.strftime("%m/%d/%Y") : search_result["year"] %> </td>
<td> <%= search_result["doc_date"].present? ? search_result["doc_date"].to_date.strftime("%m/%d/%Y") : search_result["year"] %> </td>
<% if opts[:is_case_lists].present? && opts[:document_id].present? && opts[:doctrine_id].present? %>
<td>
<% 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"] %>
<a class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#newAnnotationModal" data-controller="document" data-document-title="<%= title %>"
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-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
</a>
@ -20,9 +20,9 @@
<% if opts[:is_citing_document].present? %>
<td>
<a class="btn btn-sm btn-primary" data-action="click->document#addCitingDocument" data-controller="document" data-document-id="<%= search_result["id"] %>"
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
</a>
</td>

Loading…
Cancel
Save