diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
index f188f55..e026f98 100644
--- a/app/channels/application_cable/connection.rb
+++ b/app/channels/application_cable/connection.rb
@@ -8,7 +8,8 @@ module ApplicationCable
private
def find_verified_user
- if verified_user = User.find_by(id: cookies.encrypted[:user_id])
+ user_id = cookies.encrypted[:_cdao_pjet_session]["warden.user.user.key"].first.pop
+ if verified_user = User.find_by(id: user_id)
verified_user
else
reject_unauthorized_connection
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 3496bc1..ec7697a 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
@@ -17,9 +17,8 @@
<% 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(', ')}" %>
-
+ <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %>
+ <%= raw [annotation.document.title, annotation.document.reference_number, annotation.document.docdate.strftime("%B %d, %Y"), annotation.phil_rep].reject(&:blank?).join(', ') %>
<% if annotation.editor_notes.present? %>
diff --git a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb
index 7a338df..77cde84 100644
--- a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb
+++ b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb
@@ -71,7 +71,7 @@
<%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %>
- <%= raw [annotation.document.title, annotation.document.reference_number, annotation.document.docdate.strftime("%B %d, %Y"), annotation.phil_rep].join(', ').html_safe %>
+ <%= raw [annotation.document.title, annotation.document.reference_number, annotation.document.docdate.strftime("%B %d, %Y"), annotation.phil_rep].reject(&:blank?).join(', ').html_safe %>
diff --git a/app/components/document_index_table_body_component.rb b/app/components/document_index_table_body_component.rb
index 2215c0c..279a54a 100644
--- a/app/components/document_index_table_body_component.rb
+++ b/app/components/document_index_table_body_component.rb
@@ -6,6 +6,10 @@ class DocumentIndexTableBodyComponent < BaseComponent
@search_result = search_result
@opts = opts
end
+
+ def document_id
+ search_result["id"]
+ end
def reference_number
search_result["reference_number"]
@@ -24,8 +28,4 @@ class DocumentIndexTableBodyComponent < BaseComponent
def form_url
doctrine_annotations_path(doctrine_id: opts[:doctrine_id])
end
-
- def render?
- search_result.present?
- end
end
diff --git a/app/components/document_index_table_body_component/document_index_table_body_component.html.erb b/app/components/document_index_table_body_component/document_index_table_body_component.html.erb
index 9b53ef9..97d5d8d 100644
--- a/app/components/document_index_table_body_component/document_index_table_body_component.html.erb
+++ b/app/components/document_index_table_body_component/document_index_table_body_component.html.erb
@@ -2,4 +2,57 @@
<%= reference_number %> |
<%= title %> |
<%= date_or_year %> |
+ <% if opts[:is_case_lists].present? %>
+
+ Add
+
+
+ <%= form_tag(opts[:form_url], method: :post) do %>
+
+ <% end %>
+
+ |
+ <% end %>
diff --git a/app/components/subjects_sidenav_sub_menu_component.rb b/app/components/subjects_sidenav_sub_menu_component.rb
index d26651d..13900bc 100644
--- a/app/components/subjects_sidenav_sub_menu_component.rb
+++ b/app/components/subjects_sidenav_sub_menu_component.rb
@@ -6,8 +6,8 @@ class SubjectsSidenavSubMenuComponent < BaseComponent
end
def index_url(subject_id)
- return doctrines_path(subject_ids: [subject_id]) if opts[:is_doctrines_index].present?
+ return search_doctrines_path(subject_ids: [subject_id]) if opts[:is_doctrines_index].present?
- subject_index_path(subject_id)
+ doctrines_subject_index_path(subject_id)
end
end
diff --git a/app/controllers/doctrines_controller.rb b/app/controllers/doctrines_controller.rb
index 7dceeba..e595378 100644
--- a/app/controllers/doctrines_controller.rb
+++ b/app/controllers/doctrines_controller.rb
@@ -10,6 +10,15 @@ class DoctrinesController < ApplicationController
end
end
+ def search
+ @search = search_doctrines(search_params)
+ @doctrines = @search.results
+
+ respond_to do |format|
+ format.html
+ end
+ end
+
def show; end
private
diff --git a/app/controllers/subject_indexes_controller.rb b/app/controllers/subject_indexes_controller.rb
index 5546125..8d1e47e 100644
--- a/app/controllers/subject_indexes_controller.rb
+++ b/app/controllers/subject_indexes_controller.rb
@@ -9,6 +9,10 @@ class SubjectIndexesController < ApplicationController
def edit; end
+ def doctrines
+ @doctrines = @subject_index.doctrines
+ end
+
def show
@doctrines = @subject_index.doctrines
end
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
index 832affe..2cb160a 100644
--- a/app/javascript/packs/application.js
+++ b/app/javascript/packs/application.js
@@ -28,7 +28,7 @@ Rails.start()
Turbolinks.start()
ActiveStorage.start()
-$(document).ready(function () {
+$(document).on("ready turbolinks:load", function () {
$('#toggleSideNav').on('click', function () {
$('#sidenav').toggleClass('active');
});
diff --git a/app/javascript/src/application.scss b/app/javascript/src/application.scss
index 81249c9..030447e 100644
--- a/app/javascript/src/application.scss
+++ b/app/javascript/src/application.scss
@@ -17,3 +17,11 @@
position: sticky;
left: 0;
}
+
+.clickable-link, .clickable-tr {
+ cursor: pointer;
+}
+
+.current {
+ background-color: #535353;
+}
diff --git a/app/reflexes/document_reflex.rb b/app/reflexes/document_reflex.rb
index 94c9ffc..3d580a8 100644
--- a/app/reflexes/document_reflex.rb
+++ b/app/reflexes/document_reflex.rb
@@ -4,8 +4,7 @@ class DocumentReflex < ApplicationReflex
include JurisprudenceSearch
def render_index_table(results)
- @results = results
- morph "tbody#documentIndexTable", render(DocumentIndexTableBodyComponent.with_collection(@results, current_user: current_user, opts: { is_case_lists: true }))
+ morph "tbody#documentIndexTable", render(DocumentIndexTableBodyComponent.with_collection(results, current_user: current_user, opts: { is_case_lists: true }))
end
def render_years(results)
@@ -13,6 +12,6 @@ class DocumentReflex < ApplicationReflex
end
def render_moda_document_search_table(results)
- morph "tbody#modalDocumentSearchTable", render(DocumentIndexTableBodyComponent.with_collection(@results, current_user: current_user, opts: { is_case_lists: true }))
+ morph "tbody#modalDocumentSearchTable", render(DocumentIndexTableBodyComponent.with_collection(results, current_user: current_user, opts: { is_case_lists: true }))
end
end
diff --git a/app/views/doctrines/index.html.erb b/app/views/doctrines/index.html.erb
index 03e59ad..e69de29 100644
--- a/app/views/doctrines/index.html.erb
+++ b/app/views/doctrines/index.html.erb
@@ -1,4 +0,0 @@
-
-
<%= render PaginationComponent.new(data: @doctrines) %>
- <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_disable_clickable_link: true, is_doctrines_index: true, subject_ids: params[:subject_ids] })) %>
-
diff --git a/app/views/doctrines/search.html.erb b/app/views/doctrines/search.html.erb
new file mode 100644
index 0000000..16fc0b6
--- /dev/null
+++ b/app/views/doctrines/search.html.erb
@@ -0,0 +1,4 @@
+
+
<%= render PaginationComponent.new(data: @doctrines) %>
+ <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_doctrines_index: true, subject_ids: params[:subject_ids] })) %>
+
diff --git a/app/views/subject_indexes/doctrines.html.erb b/app/views/subject_indexes/doctrines.html.erb
new file mode 100644
index 0000000..193d3c2
--- /dev/null
+++ b/app/views/subject_indexes/doctrines.html.erb
@@ -0,0 +1,6 @@
+
+
+
+ <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_subjects_index: true })) %>
+
+
diff --git a/app/views/subject_indexes/show.html.erb b/app/views/subject_indexes/show.html.erb
index 9ff19c2..e69de29 100644
--- a/app/views/subject_indexes/show.html.erb
+++ b/app/views/subject_indexes/show.html.erb
@@ -1,6 +0,0 @@
-
-
-
- <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_subjects_index: true, is_disable_clickable_link: true })) %>
-
-
diff --git a/config/routes.rb b/config/routes.rb
index 04f0a1d..9810efc 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,6 +4,7 @@ Rails.application.routes.draw do
root to: "home#index"
resources :doctrines, only: %i[index] do
+ get :search, on: :collection
scope module: :doctrine do
resources :annotations, only: %i[create update destroy]
end
@@ -25,7 +26,9 @@ Rails.application.routes.draw do
resources :decisions, only: %i[index]
resources :subject_indexes do
- get :search, on: :collection
+ member do
+ get :doctrines
+ end
end
namespace :api, defaults: { format: :json } do