diff --git a/app/components/annotation_marks_modal_form_component.rb b/app/components/annotation_marks_modal_form_component.rb index f5d7efe..7f5f541 100644 --- a/app/components/annotation_marks_modal_form_component.rb +++ b/app/components/annotation_marks_modal_form_component.rb @@ -1,36 +1,4 @@ class AnnotationMarksModalFormComponent < BaseComponent - attr_reader :document, :annotation, :opts - def initialize(current_user:, document:, annotation:, opts:) - @document = document - @annotation = annotation - @opts = opts - end - - def document_date_or_year - return document.year if document.docdate.blank? - - document.docdate.strftime("%B %d, %Y") - end - - def document_title - title = document.short_title || document.title - [title, document.reference_number, document_date_or_year].reject(&:blank?).join(", ") - end - - def citing_documents_reference_numbers - return if annotation.documents.blank? - - annotation.documents.map(&:reference_number).join(" citing ") - end - - def citing_document_ids - return if annotation.documents.blank? - - annotation.documents.map(&:id).join(",") - end - - def render? - opts[:form_url].present? && opts[:form_method].present? - end + def initialize(current_user:); end end \ No newline at end of file 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 951b599..d38c43b 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 @@ -1,8 +1,8 @@ -<%= form_tag(opts[:form_url], method: opts[:form_method]) do %> + -<% end %> + diff --git a/app/components/doctrine_modal_form_component.rb b/app/components/doctrine_modal_form_component.rb index d102aae..3d4c769 100644 --- a/app/components/doctrine_modal_form_component.rb +++ b/app/components/doctrine_modal_form_component.rb @@ -1,13 +1,3 @@ class DoctrineModalFormComponent < BaseComponent - attr_reader :doctrine, :subjects, :opts - - def initialize(current_user:, doctrine:, subjects:, opts:) - @doctrine = doctrine - @subjects = subjects - @opts = opts - end - - def render? - opts[:form_url].present? && opts[:form_method].present? - end + def initialize(current_user:); end end diff --git a/app/components/doctrine_modal_form_component/doctrine_modal_form_component.html.erb b/app/components/doctrine_modal_form_component/doctrine_modal_form_component.html.erb index f96aee8..1715641 100644 --- a/app/components/doctrine_modal_form_component/doctrine_modal_form_component.html.erb +++ b/app/components/doctrine_modal_form_component/doctrine_modal_form_component.html.erb @@ -1,35 +1,33 @@ - diff --git a/app/controllers/api/doctrine/annotations_controller.rb b/app/controllers/api/doctrine/annotations_controller.rb index a6e37df..7718622 100644 --- a/app/controllers/api/doctrine/annotations_controller.rb +++ b/app/controllers/api/doctrine/annotations_controller.rb @@ -16,7 +16,7 @@ module Api attrs = resource_params.to_unsafe_h.deep_symbolize_keys subject_ids = attrs.delete(:subject_ids) - @annotation = @jurisprudence.annotations.new(attrs) + @annotation = @doctrine.annotations.new(attrs) if @annotation.save @annotation.subject_ids = subject_ids if subject_ids.present? diff --git a/app/controllers/api/documents_controller.rb b/app/controllers/api/documents_controller.rb index 6baa090..bb30731 100644 --- a/app/controllers/api/documents_controller.rb +++ b/app/controllers/api/documents_controller.rb @@ -21,10 +21,10 @@ module Api fulltext_fields = %i[reference_number title short_title].freeze search = Cdao::Document.search do - fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? + fulltext search_params[:q], fields: fulltext_fields, query_phrase_slop: 0, minimum_match: 1 if search_params[:q].present? fulltext_fields.each do |field| - fulltext search_params[field], fields: [field] if search_params[field].present? + fulltext search_params[field], fields: [field], query_phrase_slop: 0, minimum_match: 1 if search_params[field].present? end with(:year, search_params[:year].to_i) if search_params[:year].present? diff --git a/app/controllers/api/subjects_controller.rb b/app/controllers/api/subjects_controller.rb index 6a12bde..f639175 100644 --- a/app/controllers/api/subjects_controller.rb +++ b/app/controllers/api/subjects_controller.rb @@ -14,8 +14,7 @@ module Api private def search_params - params.permit(:name, :parent_id, :state, doctrine_ids: [], exclude_ids: []) + params.permit(:q, :name, :parent_id, :state, :doctrine_ids, :page, :per_page, exclude_ids: []) end end - -end \ No newline at end of file +end diff --git a/app/controllers/concerns/subject_search.rb b/app/controllers/concerns/subject_search.rb index 947d2ba..750ef99 100644 --- a/app/controllers/concerns/subject_search.rb +++ b/app/controllers/concerns/subject_search.rb @@ -15,6 +15,10 @@ module SubjectSearch without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present? + if search_params[:doctrine_ids].present? + with(:doctrine_ids).any_of(search_params[:doctrine_ids].split(",").reject(&:blank?).map(&:to_i)) + end + order_by :lineage_name, :asc order_by :name, :asc diff --git a/app/javascript/controllers/annotations_controller.js b/app/javascript/controllers/annotations_controller.js new file mode 100644 index 0000000..7b53731 --- /dev/null +++ b/app/javascript/controllers/annotations_controller.js @@ -0,0 +1,87 @@ +import ApplicationController from './application_controller' +export default class extends ApplicationController { + static targets = ["q", "annotation_id", "doctrine_id", "document_id", "document_ids", + "annomark_ids", "phil_rep", "editor_notes"] + + connect () { + super.connect() + } + + searchDocument () { + var $this = this + $.get("/api/documents.json", { q: $this.qTarget.value }, function (data, status) { + if (status === "success") { + $this.stimulate("AnnotationReflex#render_document_search_results", data) + } + }); + } + + renderForm () { + var $this = this, annotation_id = $this.element.dataset["annotationId"], doctrine_id = $this.element.dataset["doctrineId"], + document_title = "", document_ref_no = "", document_date_or_year = "", $modal = $("#annotationModal") + + if(annotation_id !== null && annotation_id !== undefined && annotation_id !== "") { + $modal.find(".modal-title").text("Edit Annotation") + $.get("/api/doctrines/" + doctrine_id + "/annotations/" + annotation_id + ".json", {}, function(result, status) { + $modal.find("#annotation_id").val(annotation_id) + $modal.find("#doctrine_id").val(doctrine_id) + $modal.find("#document_id").val(result.citing_document_ids) + $modal.find("#document_ids").val(result.document_id) + $modal.find("#phil_rep").val(result.phil_rep) + $modal.find("#document_title").val($this.element.dataset["documentTitle"]) + $modal.find("select[name='annomark_ids[]']")[0].selectize.setValue(result.annomark_ids) + $modal.find(".trix-content").val(result.editor_notes) + }); + } else { + $modal.find(".modal-title").text("New Annotation") + document_title = this.element.dataset["documentTitle"] + document_ref_no = this.element.dataset["documentReferenceNumber"] + document_date_or_year = this.element.dataset["documentDateOrYear"] + + $modal.find("#doctrine_id").val(doctrine_id) + $modal.find("#document_title").val([document_title, document_ref_no, document_date_or_year].join(", ")) + $modal.find("#document_id").val(this.element.dataset["documentId"]) + $modal.find("#phil_rep").val(this.element.dataset["documentPhilRep"]) + } + } + + addCitingDocument () { + var document_id = "", document_ref_no = "", document_date = "", document_title = "", + $modal = $("#annotationModal"), $doc_title = $modal.find("#document_title"), + $citing_document_ids = $modal.find("#document_ids") + + document_id = this.element.dataset["documentId"] + document_ref_no = this.element.dataset["documentReferenceNumber"] + document_date = this.element.dataset["documentDate"] + document_title = this.element.dataset["documentTitle"] + + var document_ids = [] + + if ($citing_document_ids.val() !== null && $citing_document_ids.val() !== undefined && $citing_document_ids.val() !== "") { + document_ids = $citing_document_ids.val().split(",") + } + + document_ids.push(document_id) + $citing_document_ids.val(document_ids.join(",")) + + var doc_title = $doc_title.val() + $doc_title.val(doc_title + " citing " + [document_title, document_ref_no, document_date].join(", ")) + } + + save () { + var $this = this, $modal = $("#annotationModal"), annotation_id = $this.annotation_idTarget.value, doctrine_id = $this.doctrine_idTarget.value + const params = { annomark_ids: $modal.find("select[name='annomark_ids[]']").val(), document_id: $this.document_idTarget.value, + document_ids: $this.document_idsTarget.value || "", phil_rep: $this.phil_repTarget.value || "", + editor_notes: $this.editor_notesTarget.value || "" } + + if (annotation_id !== null && annotation_id !== undefined && annotation_id !== "") { + $.ajax({ + url: "/doctrines/" + doctrine_id + "/annotations/" + annotation_id, + type: 'PUT', + data: params + }) + } else { + $.post("/doctrines/" + doctrine_id + "/annotations", params) + } + } +} diff --git a/app/javascript/controllers/application_controller.js b/app/javascript/controllers/application_controller.js index 9a073a7..56ece23 100644 --- a/app/javascript/controllers/application_controller.js +++ b/app/javascript/controllers/application_controller.js @@ -1,14 +1,11 @@ -import { Controller } from 'stimulus' -import StimulusReflex from 'stimulus_reflex' +import { Controller } from 'stimulus'; +import StimulusReflex from 'stimulus_reflex'; import $ from 'jquery'; +import { end } from '@popperjs/core' -require("select2/dist/css/select2") -require("select2-bootstrap-theme/dist/select2-bootstrap") +require("selectize/dist/js/selectize.min"); +require("selectize/dist/css/selectize"); -require("selectize.js/dist/js/selectize.min") -require("selectize.js/dist/css/selectize") - -import Select2 from "select2" import Selectize from "selectize"; /* This is your ApplicationController. diff --git a/app/javascript/controllers/doctrines_controller.js b/app/javascript/controllers/doctrines_controller.js new file mode 100644 index 0000000..6298c19 --- /dev/null +++ b/app/javascript/controllers/doctrines_controller.js @@ -0,0 +1,62 @@ +import ApplicationController from './application_controller' +export default class extends ApplicationController { + static targets = ["input", "document_id", "doctrine_id", "content"] + + connect () { + super.connect() + } + + renderForm () { + var document_id = this.element.dataset["documentId"], doctrine_id = this.element.dataset["doctrineId"], + $modal = $("#doctrineModal"), $subject_ids_el = $modal.find(".subject-ids-selectize"), + $subject_ids_selectize = $subject_ids_el[0].selectize + + console.log(this.element.dataset) + + if (doctrine_id !== null && doctrine_id !== undefined && doctrine_id !== "") { + $modal.find("#doctine_content_suggestions_div").hide() + $.get("/api/doctrines/" + doctrine_id + ".json", {}, function (doctrine, status) { + $modal.find("#document_id").val(doctrine.document_id) + $modal.find("#doctrine_id").val(doctrine.id) + if (status === "success") { + $.get("/api/subjects.json?doctrine_ids=" + doctrine.id, { per_page: 100 }, function (subjects, status) { + if (status === "success") { + $.each(subjects, function(i, subject) { + $subject_ids_selectize.addOption(subject) + }) + + $subject_ids_selectize.refreshOptions() + $subject_ids_selectize.setValue(doctrine.subject_ids) + } + }); + + $modal.find(".trix-content").val(doctrine.content) + } + }) + + $modal.find(".modal-title").text("Update Doctrine") + $(".selectize-dropdown").hide() + } else { + $modal.find("#doctine_content_suggestions_div").show() + $modal.find(".modal-title").text("New Doctrine") + $modal.find(".trix-content").val("") + $subject_ids_selectize.setValue([]) + $modal.find("#document_id").val(document_id) + } + } + + save () { + var $modal = $("#doctrineModal"), document_id = this.document_idTarget.value, doctrine_id = this.doctrine_idTarget.value + const params = { subject_ids: $modal.find("select[name='subject_ids[]']").val(), content: this.contentTarget.value } + + if (doctrine_id !== null && doctrine_id !== undefined && doctrine_id !== "") { + $.ajax({ + url: "/jurisprudences/" + document_id + "/doctrines/" + doctrine_id, + type: 'PUT', + data: params + }) + } else { + $.post("/jurisprudences/" + document_id + "/doctrines", params) + } + } +} diff --git a/app/javascript/controllers/document_controller.js b/app/javascript/controllers/document_controller.js index 91c7495..7bd9658 100644 --- a/app/javascript/controllers/document_controller.js +++ b/app/javascript/controllers/document_controller.js @@ -1,4 +1,3 @@ -import { end } from '@popperjs/core' import ApplicationController from './application_controller' export default class extends ApplicationController { static targets = ["input"] @@ -17,15 +16,6 @@ export default class extends ApplicationController { }); } - modalDocumentSearch () { - var $this = this - $.get("/api/documents.json", { q: $this.inputTarget.value }, function (data, status) { - if (status === "success") { - $this.stimulate("DocumentReflex#render_modal_document_search_table", data) - } - }); - } - loadYears () { var $this = this $.get("/api/jurisprudences/years.json", {}, function (data, status) { @@ -34,42 +24,4 @@ export default class extends ApplicationController { } }); } - - loadFormDocumentDetais () { - var document_id = "", document_title = "", document_ref_no = "", document_date_or_year = "", document_phil_rep = "", $modal = $("#newAnnotationModal") - - document_id = this.element.dataset["documentId"] - document_title = this.element.dataset["documentTitle"] - document_ref_no = this.element.dataset["documentReferenceNumber"] - document_date_or_year = this.element.dataset["documentDateOrYear"] - document_phil_rep = this.element.dataset["documentPhilRep"] - - $modal.find("#document_title").val([document_title, document_ref_no, document_date_or_year].join(", ")) - $modal.find("#document_id").val(document_id) - $modal.find("#phil_rep").val(document_phil_rep) - } - - addCitingDocument () { - 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"] - document_date = this.element.dataset["documentDate"] - document_title = this.element.dataset["documentTitle"] - - var document_ids = [] - - if ($("#document_ids").val() === "") { - document_ids.push(document_id) - } else { - document_ids = $("#document_ids").val().split(",") - document_ids.push(document_id) - } - - $("#document_ids").val(document_ids.join(",")) - - var doc_title = $doc_title.val() - - $doc_title.val(doc_title + " citing " + [document_title, document_ref_no, document_date].join(", ")) - } } diff --git a/app/javascript/controllers/select2_controller.js b/app/javascript/controllers/select2_controller.js deleted file mode 100644 index d8c9325..0000000 --- a/app/javascript/controllers/select2_controller.js +++ /dev/null @@ -1,13 +0,0 @@ -import ApplicationController from './application_controller' - -export default class extends ApplicationController { - connect() { - super.connect() - - $("#cdao_subject_parent_id").select2({ tags: true, width: "100%" }) - $(".subjects-select2").select2({ tags: true, width: "100%" }) - $(".annomark-ids-select2").select2({ width: "100%", dropdownParent: $("#edit-annotation-modal") }) - $(".new-annotation-annomark-ids").select2({ width: "100%", dropdownParent: $("#new-annotation-modal") }) - $(".subject-ids-modal-select2").select2({ width: "100%", dropdownParent: $("#doctrineModal") }) - } -} diff --git a/app/javascript/controllers/selectize_controller.js b/app/javascript/controllers/selectize_controller.js index de9b7b0..d929cea 100644 --- a/app/javascript/controllers/selectize_controller.js +++ b/app/javascript/controllers/selectize_controller.js @@ -3,60 +3,82 @@ import ApplicationController from './application_controller' export default class extends ApplicationController { connect() { super.connect() - var $this = this var default_opts = { plugins: ['restore_on_backspace', 'remove_button'], searchField: ['text', 'optgroup'], valueField: "id", allowEmptyOption: false, + closeAfterSelect: true, showEmptyOptionInDropdown: true, emptyOptionLabel: true, hideSelected: true, placeholder: "Please Select" } - $(".default-selectize").selectize(default_opts) + $(".default-selectize").selectize(default_opts); - var $doctrine_content = $("#doctrineModal").find("input[name='content']") - var $trix_content = $("#doctrineModal").find(".trix-content") + var $doctrine_content = $("#doctrineModal").find("input[name='content']"); + var $trix_content = $("#doctrineModal").find(".trix-content"); var doctrine_content_suggestions_opts = { onChange: function (value) { if(value === null || value === undefined || value === "") { - $doctrine_content.val("") - $trix_content.val("") + $doctrine_content.val(""); + $trix_content.val(""); } else { - $doctrine_content.val(value.text()) - $trix_content.val(value) + $.get("/api/doctrines/" + value + ".json", {}, function (doctrine, status) { + if (status === "success") { + $doctrine_content.val(doctrine.content); + $trix_content.val(doctrine.content); + } + }); } } }; var subject_ids_opts = { + load: function (query, callback) { + $.get("/api/subjects.json", { q: query, per_page: 100 }, function (data, status) { + if (status === 'success') { + callback(data); + } + }) + }, onChange: function (value) { var selectize_options = [] - var $selectize = $("#doctrineModal").find("#doctine_content_suggestions").selectize($.extend({ options: selectize_options }, doctrine_content_suggestions_opts)) + var $selectize = $("#doctrineModal").find("#doctine_content_suggestions").selectize($.extend({ options: selectize_options }, doctrine_content_suggestions_opts)); if (value.length === 0) { - $selectize[0].selectize.clearOptions(); + if ($selectize.length) $selectize[0].selectize.clearOptions(); } else { $.get("/api/doctrines.json", { subject_ids: value }, function(data, status) { if (status === "success") { $.each(data, function (i, doctrine) { - selectize_options.push({ id: doctrine.id, value: doctrine.content, text: doctrine.plain_content }) + selectize_options.push({ id: doctrine.id, value: doctrine.content, text: doctrine.plain_content }); }) - - $selectize[0].selectize.addOption(selectize_options) + + if ($selectize.length) $selectize[0].selectize.addOption(selectize_options); } }); } - $selectize[0].selectize.refreshOptions() + if ($selectize.length) $selectize[0].selectize.refreshOptions(); } }; - $(".subject-ids-selectize").selectize($.extend(subject_ids_opts, default_opts)) - $("#doctine_content_suggestions").selectize($.extend(doctrine_content_suggestions_opts, default_opts)) + var $subject_ids_selectize = $(".subject-ids-selectize").selectize($.extend(subject_ids_opts, default_opts)); + + $.get("/api/subjects.json", { per_page: 100 }, function (results, status) { + if (status === 'success') { + $.each(results, function (i, result) { + $subject_ids_selectize[0].selectize.addOption(result); + }) + + $subject_ids_selectize[0].selectize.refreshOptions(); + } + }); + + $("#doctine_content_suggestions").selectize($.extend(doctrine_content_suggestions_opts, default_opts)); } } diff --git a/app/javascript/controllers/subjects_controller.js b/app/javascript/controllers/subjects_controller.js index a1de657..7c0d38d 100644 --- a/app/javascript/controllers/subjects_controller.js +++ b/app/javascript/controllers/subjects_controller.js @@ -4,7 +4,19 @@ export default class extends ApplicationController { super.connect() } - load_roots() { - this.stimulate("SubjectsReflex#load_roots") + renderSidenavAccordion () { + var parent_id = this.element.dataset["subjectParentId"], $this = this, params = {} + + if (parent_id !== null && parent_id !== undefined && parent_id !== "") { + params.parent_id = parent_id + } else { + params.is_root_only = true + } + + $.get("/api/subjects.json", params, function (results, status) { + if (status === "success") { + $this.stimulate("SubjectsReflex#render_sidenav_accordion", results) + } + }) } } diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 9a92045..66f2702 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -15,7 +15,6 @@ import 'bootstrap/dist/css/bootstrap.min.css'; import "@fortawesome/fontawesome-free/js/all.min"; import "@fortawesome/fontawesome-free/css/all.min"; import "moment"; -import "select2"; import "chosen-js"; import 'trix/dist/trix.css'; import 'trix/dist/trix.js'; diff --git a/app/models/annotation.rb b/app/models/annotation.rb index acbe809..b138e9e 100644 --- a/app/models/annotation.rb +++ b/app/models/annotation.rb @@ -25,6 +25,10 @@ class Annotation < ApplicationRecord annotation_documents.find_by(document_id: document.id).destroy end + def citing_document_ids + documents.map(&:id) + end + searchable do integer :document_id integer :doctrine_id diff --git a/app/reflexes/annotation_reflex.rb b/app/reflexes/annotation_reflex.rb new file mode 100644 index 0000000..32ff2ae --- /dev/null +++ b/app/reflexes/annotation_reflex.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AnnotationReflex < ApplicationReflex + def render_document_search_results(results) + opts = { is_citing_document: true } + morph "tbody#documentSearchResultTable", render(partial: "document_search_results_table", locals: { search_results: results, opts: opts }) + end +end diff --git a/app/reflexes/document_reflex.rb b/app/reflexes/document_reflex.rb index a084725..fe61e68 100644 --- a/app/reflexes/document_reflex.rb +++ b/app/reflexes/document_reflex.rb @@ -4,7 +4,7 @@ class DocumentReflex < ApplicationReflex include JurisprudenceSearch def render_index_table(results, document_id, doctrine_id) - opts = { is_case_lists: true, document_id: document_id, doctrine_id: doctrine_id, form_method: :post } + opts = { is_case_lists: true, doctrine_id: doctrine_id } morph "tbody#documentIndexTable", render(partial: "document_search_results_table", locals: { search_results: results, opts: opts }) end diff --git a/app/reflexes/subjects_reflex.rb b/app/reflexes/subjects_reflex.rb index 58b54d0..b1f942b 100644 --- a/app/reflexes/subjects_reflex.rb +++ b/app/reflexes/subjects_reflex.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class SubjectsReflex < ApplicationReflex - def load_roots - @roots = "Hello!!!" + def load_sidenav_accordion(search_results, opts = {}) + morph "#" end end diff --git a/app/views/api/doctrine/annotations/show.json.jbuilder b/app/views/api/doctrine/annotations/show.json.jbuilder new file mode 100644 index 0000000..e8913bb --- /dev/null +++ b/app/views/api/doctrine/annotations/show.json.jbuilder @@ -0,0 +1 @@ +json.(@annotation, *%i[id doctrine_id document_id phil_rep editor_notes annomark_ids citing_document_ids]) diff --git a/app/views/api/doctrines/show.json.jbuilder b/app/views/api/doctrines/show.json.jbuilder index 3164987..93ed50d 100644 --- a/app/views/api/doctrines/show.json.jbuilder +++ b/app/views/api/doctrines/show.json.jbuilder @@ -1 +1 @@ -json.(@doctrine, *%i[id subject_ids content plain_content created_at updated_at]) +json.(@doctrine, *%i[id document_id subject_ids content plain_content created_at updated_at]) diff --git a/app/views/api/documents/index.json.jbuilder b/app/views/api/documents/index.json.jbuilder index d745307..049d952 100644 --- a/app/views/api/documents/index.json.jbuilder +++ b/app/views/api/documents/index.json.jbuilder @@ -1,3 +1,3 @@ json.array!(@documents) do |document| - json.extract! document, *%i[id reference_number title short_title doc_date year phil_rep scra] + json.extract! document, *%i[id reference_number clean_reference_number title short_title doc_date year phil_rep scra] end diff --git a/app/views/api/subjects/index.json.jbuilder b/app/views/api/subjects/index.json.jbuilder index 053ede2..54d0973 100644 --- a/app/views/api/subjects/index.json.jbuilder +++ b/app/views/api/subjects/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@subjects) do |subject| json.extract! subject, *%i[id name parent_id state doctrine_ids created_at updated_at] - json.text [subject.lineage_name].join(" - ") + json.text subject.lineage_name end 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 8928eb5..f09ff6d 100644 --- a/app/views/document/doctrines/_document_search_results_table.html.erb +++ b/app/views/document/doctrines/_document_search_results_table.html.erb @@ -1,17 +1,17 @@ <% search_results.each do |search_result| %> - <%= search_result["reference_number"] %> + <%= search_result["clean_reference_number"] %> <%= search_result["short_title"] || search_result["title"] %> <%= search_result["doc_date"].present? ? search_result["doc_date"].to_date.strftime("%m/%d/%Y") : search_result["year"] %> - <% if opts[:is_case_lists].present? && opts[:document_id].present? && opts[:doctrine_id].present? %> + <% if opts[:is_case_lists].present? && opts[:doctrine_id].present? %> <% 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"] %> - + Add Annotations @@ -19,10 +19,11 @@ <% if opts[:is_citing_document].present? %> - " - data-document-reference-number="<%= search_result['reference_number'] %>" + " + data-document-reference-number="<%= search_result['clean_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'] %>"> + data-document-title="<%= search_result['short_title'] || search_result['title'] %>" + data-action="click->annotations#addCitingDocument" > Add diff --git a/app/views/document/doctrines/show.html.erb b/app/views/document/doctrines/show.html.erb index 8648caf..6d010a5 100644 --- a/app/views/document/doctrines/show.html.erb +++ b/app/views/document/doctrines/show.html.erb @@ -1,6 +1,6 @@
-
- +
+
@@ -17,14 +17,10 @@
Reference Number:
-
+
- - -
- <%= render(DoctrineModalFormComponent.new(current_user: current_user, doctrine: @document.doctrines.new, subjects: Cdao::Subject.all.order(name: :asc), opts: { form_url: jurisprudence_doctrines_path(jurisprudence_id: @document.id), form_method: :post })) %> +
diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 8a45598..842b847 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -1,5 +1,3 @@ - -
@@ -55,10 +53,10 @@
- <%= render(DoctrineModalFormComponent.new(current_user: current_user, doctrine: @document.doctrines.new, subjects: @subjects.order(name: :asc), opts: { form_url: jurisprudence_doctrines_path(jurisprudence_id: @document.id), form_method: :post })) %> + <%= render(DoctrineModalFormComponent.new(current_user: current_user)) %>
diff --git a/app/views/shared/_subjects_sidenav_accorrdion.html.erb b/app/views/shared/_subjects_sidenav_accorrdion.html.erb new file mode 100644 index 0000000..e69de29