From 360f3d5a95bbbee140c7612cf4aa7a95dde91142 Mon Sep 17 00:00:00 2001 From: alexdbondoc17 Date: Wed, 16 Feb 2022 01:22:23 +0000 Subject: [PATCH] Enahncement of UI for `doctrines` --- .../doctrine_index_table_component.html.erb | 2 +- .../document_doctrine_index_component.rb | 5 - ...document_doctrine_index_component.html.erb | 2 +- .../document_doctrine_show_component.rb | 19 +-- .../document_doctrine_show_component.html.erb | 2 +- .../subject_index_form_component.html.erb | 7 +- app/controllers/api/doctrines_controller.rb | 3 +- app/controllers/api/documents_controller.rb | 5 +- .../controllers/doctrines_controller.js | 26 +-- .../controllers/document_controller.js | 148 ++++++++++++++++++ .../controllers/selectize_controller.js | 19 ++- app/javascript/src/application.scss | 2 +- app/models/doctrine.rb | 5 +- app/reflexes/subjects_reflex.rb | 10 ++ app/views/api/doctrines/create.json.jbuilder | 1 + app/views/api/doctrines/show.json.jbuilder | 2 +- app/views/doctrines/show.html.erb | 31 ++++ app/views/document/doctrines/show.html.erb | 2 +- app/views/documents/show.html.erb | 2 +- config/routes.rb | 4 +- 20 files changed, 250 insertions(+), 47 deletions(-) create mode 100644 app/views/api/doctrines/create.json.jbuilder create mode 100644 app/views/doctrines/show.html.erb diff --git a/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb b/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb index cff8648..676ab1a 100644 --- a/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb +++ b/app/components/doctrine_index_table_component/doctrine_index_table_component.html.erb @@ -7,7 +7,7 @@ <% search_results.each do |search_result| %> - + <%= document_reference_number(search_result.document) %> <%= document_title(search_result.document) %> <%= date_or_year(search_result.document) %> diff --git a/app/components/document_doctrine_index_component.rb b/app/components/document_doctrine_index_component.rb index 2e182ac..e62e32c 100644 --- a/app/components/document_doctrine_index_component.rb +++ b/app/components/document_doctrine_index_component.rb @@ -10,14 +10,9 @@ class DocumentDoctrineIndexComponent < BaseComponent delegate :id, to: :doctrine delegate :subject_ids, to: :doctrine delegate :content, to: :doctrine - delegate :document_id, to: :doctrine delegate :annotations, to: :doctrine delegate :subjects, to: :doctrine - def doctrine_form_url - jurisprudence_doctrines_path(jurisprudence_id: document_id) - end - def annotation_form_url doctrine_annotations_path(doctrine_id: id) end diff --git a/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb b/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb index 045420a..1e90379 100644 --- a/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb +++ b/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb @@ -1,4 +1,4 @@ -
- <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user)) %> + <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { document_id: @document.id })) %>
diff --git a/config/routes.rb b/config/routes.rb index 6d08589..0ecb35b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ Rails.application.routes.draw do root to: "home#index" - resources :doctrines, only: %i[index] do + resources :doctrines, only: %i[index show] do get :search, on: :collection scope module: :doctrine do resources :annotations, only: %i[create update destroy] @@ -26,7 +26,7 @@ Rails.application.routes.draw do end namespace :api, defaults: { format: :json } do - resources :doctrines, only: %i[index show] do + resources :doctrines do scope module: :doctrine do resources :annotations end