From dc33043f124bc4111658ab3c00ef9dcfc3bf971e Mon Sep 17 00:00:00 2001 From: alexdbondoc17 Date: Sun, 30 Jan 2022 15:51:21 +0000 Subject: [PATCH] Improve main UI --- .../annotation_marks_modal_form_component.rb | 23 ++++ ...tation_marks_modal_form_component.html.erb | 45 +++++++ .../doctrine_index_component.html.erb | 62 --------- .../doctrine_modal_form_component.rb | 5 +- .../doctrine_modal_form_component.html.erb | 18 +-- app/components/doctrine_show_component.rb | 9 -- .../doctrine_show_component.html.erb | 64 ---------- ...b => document_doctrine_index_component.rb} | 10 +- ...document_doctrine_index_component.html.erb | 23 ++++ .../document_doctrine_show_component.rb | 28 +++++ .../document_doctrine_show_component.html.erb | 90 +++++++++++++ .../document_index_table_component.rb | 2 +- .../document_index_table_component.html.erb | 22 ++-- .../pagination_component.html.erb | 2 +- .../sidenav_component.html.erb | 20 +-- .../subject_accordion_component.html.erb | 8 +- ...bjects_sidenav_sub_menu_component.html.erb | 118 ++++++++++-------- .../document/doctrines_controller.rb | 7 ++ app/javascript/packs/application.js | 2 +- app/javascript/src/application/sidenav.scss | 4 + app/views/document/doctrines/show.html.erb | 23 ++++ app/views/documents/index.html.erb | 1 + app/views/documents/show.html.erb | 22 ++-- app/views/kaminari/_first_page.html.erb | 4 +- app/views/kaminari/_last_page.html.erb | 4 +- app/views/kaminari/_next_page.html.erb | 4 +- app/views/kaminari/_page.html.erb | 4 +- app/views/kaminari/_prev_page.html.erb | 4 +- app/views/subject_indexes/index.html.erb | 2 +- config/routes.rb | 4 + 30 files changed, 386 insertions(+), 248 deletions(-) create mode 100644 app/components/annotation_marks_modal_form_component.rb create mode 100644 app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb delete mode 100644 app/components/doctrine_index_component/doctrine_index_component.html.erb delete mode 100644 app/components/doctrine_show_component.rb delete mode 100644 app/components/doctrine_show_component/doctrine_show_component.html.erb rename app/components/{doctrine_index_component.rb => document_doctrine_index_component.rb} (77%) create mode 100644 app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb create mode 100644 app/components/document_doctrine_show_component.rb create mode 100644 app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb create mode 100644 app/controllers/document/doctrines_controller.rb create mode 100644 app/views/document/doctrines/show.html.erb 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 @@