diff --git a/app/components/annotation_marks_modal_form_component.rb b/app/components/annotation_marks_modal_form_component.rb new file mode 100644 index 0000000..5c613b9 --- /dev/null +++ b/app/components/annotation_marks_modal_form_component.rb @@ -0,0 +1,23 @@ +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 + [document.title, document.reference_number, document_date_or_year].join(", ") + end + + def render? + opts[:form_url].present? && opts[:form_method].present? + 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 new file mode 100644 index 0000000..f5e8c7a --- /dev/null +++ b/app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb @@ -0,0 +1,45 @@ +<%= form_tag(opts[:form_url], method: opts[:form_method]) do %> + +<% end %> diff --git a/app/components/doctrine_index_component/doctrine_index_component.html.erb b/app/components/doctrine_index_component/doctrine_index_component.html.erb deleted file mode 100644 index a46f281..0000000 --- a/app/components/doctrine_index_component/doctrine_index_component.html.erb +++ /dev/null @@ -1,62 +0,0 @@ -
-
-
- <%= form_tag(doctrine_form_url, method: :patch) do %> -
- <%= label_tag :subject_indexes %> - <%= select_tag "subject_ids[]", options_from_collection_for_select(Cdao::Subject.all, :id, :lineage_name, subject_ids), class: "form-select i-chosen", multiple: true, prompt: "Please select" %> -
- -
-
- <%= label_tag :content %> - <%= text_area_tag :content, content, class: "i-ckeditor form-control", placeholder: "Doctrine" %> -
-
- <% end %> - -
-
- -
- -
-
-
- <%= text_field_tag :q, nil, class: "form-control", placeholder: "Search GR Number" %> -
- -
- <%= button_tag "search", class: "btn btn-primary" %> -
-
- -
- - - - - - - - - - <%= render(DocumentIndexTableComponent.with_collection(Cdao::Jurisprudence.first(5), current_user: current_user, opts: { is_case_lists: true, form_url: annotation_form_url, document_id: document_id })) %> - -
Reference No. Date Title
-
-
- - <% doctrine.annotations.each do |annotation| %> -
-
-
-
<%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")} #{[annotation.document.title, annotation.document.reference_number, annotation.document.docdate.strftime("%B %d, %Y"), annotation.phil_rep].join(', ')}" %>
- Editors Note: <%= annotation.editor_notes %> -
-
-
- <% end %> -
-
\ No newline at end of file diff --git a/app/components/doctrine_modal_form_component.rb b/app/components/doctrine_modal_form_component.rb index a5a5c96..86ca73c 100644 --- a/app/components/doctrine_modal_form_component.rb +++ b/app/components/doctrine_modal_form_component.rb @@ -1,7 +1,8 @@ class DoctrineModalFormComponent < BaseComponent - attr_reader :opts + attr_reader :doctrine, :opts - def initialize(current_user:, opts:) + def initialize(current_user:, doctrine:, opts:) + @doctrine = doctrine @opts = opts 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 09a6d3f..3280e47 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,21 +1,23 @@