Compare commits
269 Commits
remove-doc
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
0cb656a60a | 4 years ago |
|
|
5b61cf9dba | 4 years ago |
|
|
6b4830b22a | 4 years ago |
|
|
0e00dd3f0c | 4 years ago |
|
|
63755e8268 | 4 years ago |
|
|
08480eab46 | 4 years ago |
|
|
d05d7fa28a | 4 years ago |
|
|
412c8b58aa | 4 years ago |
|
|
0cf7193f13 | 4 years ago |
|
|
9bebc0180b | 4 years ago |
|
|
2964d47de1 | 4 years ago |
|
|
05b0f0f94a | 4 years ago |
|
|
7aefbbb23f | 4 years ago |
|
|
2805c86964 | 4 years ago |
|
|
ce34a3f4c2 | 4 years ago |
|
|
37d6fd421a | 4 years ago |
|
|
7c9b443dfc | 4 years ago |
|
|
e65c339289 | 4 years ago |
|
|
9f06b3c0cd | 4 years ago |
|
|
7ec5ad0bb9 | 4 years ago |
|
|
5ea09cf3ad | 4 years ago |
|
|
83d340b013 | 4 years ago |
|
|
e66ea59b44 | 4 years ago |
|
|
6010d4e096 | 4 years ago |
|
|
c7c72c5ee7 | 4 years ago |
|
|
8acbcbdae7 | 4 years ago |
|
|
79636b0a90 | 4 years ago |
|
|
411896fc81 | 4 years ago |
|
|
c3bc942e19 | 4 years ago |
|
|
ee2595e9d1 | 4 years ago |
|
|
9e1748d357 | 4 years ago |
|
|
66858ce260 | 4 years ago |
|
|
201674e543 | 4 years ago |
|
|
ea8f1d61e0 | 4 years ago |
|
|
729073bbd6 | 4 years ago |
|
|
9795dd8ca8 | 4 years ago |
|
|
4a27beca8d | 4 years ago |
|
|
81c27a3806 | 4 years ago |
|
|
c9abc3411b | 4 years ago |
|
|
353e53bb43 | 4 years ago |
|
|
185030b45d | 4 years ago |
|
|
d92783bdfa | 4 years ago |
|
|
a446aa3bd5 | 4 years ago |
|
|
74a094aae8 | 4 years ago |
|
|
28d4a20016 | 4 years ago |
|
|
06de925d8b | 4 years ago |
|
|
45bec150ac | 4 years ago |
|
|
117981d2f5 | 4 years ago |
|
|
32311ab1b9 | 4 years ago |
|
|
7d79f9d9f4 | 4 years ago |
|
|
8308ce3934 | 4 years ago |
|
|
9e9c6c5ea5 | 4 years ago |
|
|
f5e36b7437 | 4 years ago |
|
|
537fb356c5 | 4 years ago |
|
|
d0094c1345 | 4 years ago |
|
|
1549514e13 | 4 years ago |
|
|
104c0df415 | 4 years ago |
|
|
01a040958e | 4 years ago |
|
|
cc5e703a8a | 4 years ago |
|
|
9c17ee115c | 4 years ago |
|
|
98d60dca96 | 4 years ago |
|
|
0e8da90449 | 4 years ago |
|
|
1c8bd06a3f | 4 years ago |
|
|
58099bba41 | 4 years ago |
|
|
4920225246 | 4 years ago |
|
|
ba95906f5c | 4 years ago |
|
|
1321cca174 | 4 years ago |
|
|
1fc6ec5694 | 4 years ago |
|
|
7b4d5481ae | 4 years ago |
|
|
099854f3ad | 4 years ago |
|
|
f14998b01c | 4 years ago |
|
|
792d7f32c7 | 4 years ago |
|
|
3a8e1ce27a | 4 years ago |
|
|
2894706a8a | 4 years ago |
|
|
eaa5ab3d32 | 4 years ago |
|
|
4da7152ec1 | 4 years ago |
|
|
2be01091b2 | 4 years ago |
|
|
ed3fd52c8f | 4 years ago |
|
|
4d5a9462ef | 4 years ago |
|
|
2d89915690 | 4 years ago |
|
|
19c3b09136 | 4 years ago |
|
|
ff0662d8bb | 4 years ago |
|
|
ba521d084d | 4 years ago |
|
|
f52cb13ce6 | 4 years ago |
|
|
3415a7658b | 4 years ago |
|
|
f393481673 | 4 years ago |
|
|
e6e30144b6 | 4 years ago |
|
|
85cb54a2c9 | 4 years ago |
|
|
3744e9357c | 4 years ago |
|
|
45f5a8d791 | 4 years ago |
|
|
4a3a8108a7 | 4 years ago |
|
|
aeb09ff360 | 4 years ago |
|
|
9a8ff8a3ba | 4 years ago |
|
|
ab06f59469 | 4 years ago |
|
|
204097ca6f | 4 years ago |
|
|
7960921520 | 4 years ago |
|
|
eeae268509 | 4 years ago |
|
|
ca804bc736 | 4 years ago |
|
|
3f0e16feaa | 4 years ago |
|
|
9b4ac90af4 | 4 years ago |
|
|
bf755666ef | 4 years ago |
|
|
f4657de4b9 | 4 years ago |
|
|
d5135f7f56 | 4 years ago |
|
|
1bc838ebed | 4 years ago |
|
|
e5e877a8f6 | 4 years ago |
|
|
3318de9600 | 4 years ago |
|
|
5b88ce7262 | 4 years ago |
|
|
3535030ed8 | 4 years ago |
|
|
89501bd677 | 4 years ago |
|
|
84b3957ed6 | 4 years ago |
|
|
115e7618f0 | 4 years ago |
|
|
8c8ea407f6 | 4 years ago |
|
|
c775815f49 | 4 years ago |
|
|
b1fa34dfc2 | 4 years ago |
|
|
136a574e79 | 4 years ago |
|
|
3d2e135975 | 4 years ago |
|
|
8c91ab3186 | 4 years ago |
|
|
8566e12046 | 4 years ago |
|
|
88d64da031 | 4 years ago |
|
|
71d56cecf1 | 4 years ago |
|
|
1948e49392 | 4 years ago |
|
|
92548141ea | 4 years ago |
|
|
25d8a749df | 4 years ago |
|
|
5f851449da | 4 years ago |
|
|
56e26e8344 | 4 years ago |
|
|
cda8badb1e | 4 years ago |
|
|
b144e5a23d | 4 years ago |
|
|
dfe25ae762 | 4 years ago |
|
|
777784b20c | 4 years ago |
|
|
23d8eeea4f | 4 years ago |
|
|
33bc8f9a26 | 4 years ago |
|
|
57b82ce4be | 4 years ago |
|
|
99b8eb565d | 4 years ago |
|
|
cfa965670f | 4 years ago |
|
|
041b7c590a | 4 years ago |
|
|
6fcfa5af5f | 4 years ago |
|
|
6f2c419131 | 4 years ago |
|
|
9fd378d494 | 4 years ago |
|
|
412887e56e | 4 years ago |
|
|
86a9d99100 | 4 years ago |
|
|
d6837c2b28 | 4 years ago |
|
|
77c9df64a1 | 4 years ago |
|
|
28a8095e2f | 4 years ago |
|
|
dc5503a1ed | 4 years ago |
|
|
a635b84f31 | 4 years ago |
|
|
e6ea4d4e6a | 4 years ago |
|
|
7dbac7e518 | 4 years ago |
|
|
9712f91703 | 4 years ago |
|
|
724e16c4c3 | 4 years ago |
|
|
4e00821e70 | 4 years ago |
|
|
9b63b2293e | 4 years ago |
|
|
9179060672 | 4 years ago |
|
|
c0337a80ed | 4 years ago |
|
|
cfa969a1e3 | 4 years ago |
|
|
edd56c330f | 4 years ago |
|
|
7e2c68e3d6 | 4 years ago |
|
|
dffeb48443 | 4 years ago |
|
|
0e67315f7f | 4 years ago |
|
|
4b65448ef3 | 4 years ago |
|
|
b7f397490a | 4 years ago |
|
|
daa3679d45 | 4 years ago |
|
|
a66786c9df | 4 years ago |
|
|
01403fa028 | 4 years ago |
|
|
6aff545626 | 4 years ago |
|
|
49ed6d0588 | 4 years ago |
|
|
fccc11fa61 | 4 years ago |
|
|
a0ee3f5c0b | 4 years ago |
|
|
9135baa160 | 4 years ago |
|
|
0b7bb9ffa8 | 4 years ago |
|
|
7f7adcff07 | 4 years ago |
|
|
a311289978 | 4 years ago |
|
|
7a2732417c | 4 years ago |
|
|
4e29407497 | 4 years ago |
|
|
3c3fb7453f | 4 years ago |
|
|
7e19d84e84 | 4 years ago |
|
|
d9eba8ebf8 | 4 years ago |
|
|
690c569793 | 4 years ago |
|
|
94b47a2ecf | 4 years ago |
|
|
f1fa322c4f | 4 years ago |
|
|
dea6f7228f | 4 years ago |
|
|
7da90b0d6f | 4 years ago |
|
|
039e4e071b | 4 years ago |
|
|
fa204a9afc | 4 years ago |
|
|
5c4e66691e | 4 years ago |
|
|
0c54ce628e | 4 years ago |
|
|
a3eb6589be | 4 years ago |
|
|
44f2b67518 | 4 years ago |
|
|
25de4bcf25 | 4 years ago |
|
|
09db635fa6 | 4 years ago |
|
|
48c6b5ed6b | 4 years ago |
|
|
120580af94 | 4 years ago |
|
|
1f32229d01 | 4 years ago |
|
|
a414efc842 | 4 years ago |
|
|
31baa776e1 | 4 years ago |
|
|
d3b793fed3 | 4 years ago |
|
|
1243af9db9 | 4 years ago |
|
|
a2717b88ca | 4 years ago |
|
|
efab230381 | 4 years ago |
|
|
58d6da775f | 4 years ago |
|
|
8c0ad7d874 | 4 years ago |
|
|
79f9b94ff7 | 4 years ago |
|
|
f33b9c4ba7 | 4 years ago |
|
|
a09e8e63a4 | 4 years ago |
|
|
02f8d5cc4e | 4 years ago |
|
|
1263afb8fa | 4 years ago |
|
|
a152a12b5f | 4 years ago |
|
|
c8ae5d2c6c | 4 years ago |
|
|
582733dac6 | 4 years ago |
|
|
4c18bc1788 | 4 years ago |
|
|
4058de54c3 | 4 years ago |
|
|
cb0800860d | 4 years ago |
|
|
d288c8298e | 4 years ago |
|
|
62a46f3053 | 4 years ago |
|
|
d90f3446fd | 4 years ago |
|
|
c5b4bd5110 | 4 years ago |
|
|
c5222a185a | 4 years ago |
|
|
a87eae7b28 | 4 years ago |
|
|
2e6da67d26 | 4 years ago |
|
|
c9b765942f | 4 years ago |
|
|
7b246a19d9 | 4 years ago |
|
|
7db5197694 | 4 years ago |
|
|
c901c71f90 | 4 years ago |
|
|
5e3664af47 | 4 years ago |
|
|
359f084f77 | 4 years ago |
|
|
703b20b281 | 4 years ago |
|
|
763add5169 | 4 years ago |
|
|
b693185d0e | 4 years ago |
|
|
47ce931c1a | 4 years ago |
|
|
2963e1c088 | 4 years ago |
|
|
3b1ad3cb83 | 4 years ago |
|
|
48616520ba | 4 years ago |
|
|
9c0d08ef33 | 4 years ago |
|
|
d5c99ecd76 | 4 years ago |
|
|
96c38e8335 | 4 years ago |
|
|
755367b975 | 4 years ago |
|
|
63eab67ecc | 4 years ago |
|
|
dc3294b1a7 | 4 years ago |
|
|
5ccfafdc61 | 4 years ago |
|
|
e0035895cb | 4 years ago |
|
|
f922e548c8 | 4 years ago |
|
|
9bc18af1a3 | 4 years ago |
|
|
51ec0610e1 | 4 years ago |
|
|
57f37a7fa7 | 4 years ago |
|
|
8ae1f2eff9 | 4 years ago |
|
|
30eacb2484 | 4 years ago |
|
|
806cb3d197 | 4 years ago |
|
|
14744a463f | 4 years ago |
|
|
2483548d33 | 4 years ago |
|
|
b449107f0a | 4 years ago |
|
|
f6538a1736 | 4 years ago |
|
|
4e777a45a2 | 4 years ago |
|
|
9c4cf193ab | 4 years ago |
|
|
69301237bc | 4 years ago |
|
|
d0b73bd3c9 | 4 years ago |
|
|
0e86e0ffe3 | 4 years ago |
|
|
c4e7701ef1 | 4 years ago |
|
|
0c47f0c29b | 4 years ago |
|
|
1b91b80dc9 | 4 years ago |
|
|
a0010760c4 | 4 years ago |
|
|
d79f783687 | 4 years ago |
|
|
3345aeb669 | 4 years ago |
|
|
acf73a15d0 | 4 years ago |
|
|
d4456f337f | 4 years ago |
|
|
70a8e31523 | 4 years ago |
|
|
d384b6b0ad | 4 years ago |
|
|
360f3d5a95 | 4 years ago |
|
|
44116d116c | 4 years ago |
|
|
ffbff6dbf8 | 4 years ago |
|
|
3069c8577e | 4 years ago |
202 changed files with 6923 additions and 1072 deletions
@ -1,2 +1,3 @@ |
|||||||
web: rails s |
web: rails s |
||||||
webpack: ./bin/webpack-dev-server |
webpack: ./bin/webpack-dev-server |
||||||
|
worker: bundle exec sidekiq -q default,2 -q mailers,1 -q active_storage_analysis,1 -q active_storage_purge,1 -q sunspot_index,1 |
||||||
|
|||||||
@ -1,24 +1,7 @@ |
|||||||
# README |
# Development |
||||||
|
|
||||||
This README would normally document whatever steps are necessary to get the |
``` |
||||||
application up and running. |
docker-compose up -d |
||||||
|
bin/setup |
||||||
Things you may want to cover: |
foreman start |
||||||
|
``` |
||||||
* Ruby version |
|
||||||
|
|
||||||
* System dependencies |
|
||||||
|
|
||||||
* Configuration |
|
||||||
|
|
||||||
* Database creation |
|
||||||
|
|
||||||
* Database initialization |
|
||||||
|
|
||||||
* How to run the test suite |
|
||||||
|
|
||||||
* Services (job queues, cache servers, search engines, etc.) |
|
||||||
|
|
||||||
* Deployment instructions |
|
||||||
|
|
||||||
* ... |
|
||||||
|
|||||||
@ -0,0 +1,51 @@ |
|||||||
|
class AnnotationFormComponent < BaseComponent |
||||||
|
attr_reader :annotation, :opts |
||||||
|
|
||||||
|
def initialize(current_user:, annotation:, opts: {}) |
||||||
|
@annotation = annotation |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def document |
||||||
|
return annotation.document if annotation.persisted? |
||||||
|
|
||||||
|
Cdao::Document.find(opts[:document_id].to_i) |
||||||
|
end |
||||||
|
|
||||||
|
def clean_phil_rep(annotation) |
||||||
|
return if annotation.phil_rep.blank? |
||||||
|
|
||||||
|
annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") |
||||||
|
end |
||||||
|
|
||||||
|
def display_text |
||||||
|
return annotation.content if annotation.persisted? && annotation.content.present? && annotation.content.include?("Phil") |
||||||
|
|
||||||
|
display_text = nil |
||||||
|
title = document.short_title || document.title |
||||||
|
year_or_date = document.doc_date.present? ? document.doc_date.strftime("%B %d, %Y") : document.year |
||||||
|
|
||||||
|
if annotation.new_record? |
||||||
|
display_text = [title, document.clean_reference_number, year_or_date].join(", ") |
||||||
|
else |
||||||
|
contents = [[title, document.clean_reference_number, year_or_date].reject(&:blank?).join(", ")] |
||||||
|
|
||||||
|
annotation.documents.each do |citing_doc| |
||||||
|
citing_doc_title = citing_doc.short_title || citing_doc.title |
||||||
|
citing_doc_year_or_date = citing_doc.doc_date.present? ? citing_doc.doc_date.strftime("%B %d, %Y") : citing_doc.year |
||||||
|
contents << [citing_doc_title, citing_doc.clean_reference_number, citing_doc_year_or_date].join(", ") |
||||||
|
end |
||||||
|
|
||||||
|
display_text = contents.reject(&:blank?).join(" citing ") |
||||||
|
end |
||||||
|
|
||||||
|
display_text |
||||||
|
end |
||||||
|
|
||||||
|
def phil_rep |
||||||
|
return annotation.phil_rep if annotation.persisted? |
||||||
|
|
||||||
|
document.phil_rep |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
@ -0,0 +1,51 @@ |
|||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-12 p-2"> |
||||||
|
<strong> Annotation Marks </strong> |
||||||
|
<%= hidden_field_tag :document_ids, annotation.citing_document_ids, data: { target: "annotations.document_ids" } %> |
||||||
|
<%= select_tag "annomark_ids[]", options_from_collection_for_select(Annomark.all.order(name: :asc), :id, :name, annotation.annomark_ids), |
||||||
|
class: "form-control default-selectize ps-0", multiple: true, prompt: "Please select" %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-12 p-2"> |
||||||
|
<strong> <%= label_tag :document_title %> </strong> |
||||||
|
<%= rich_text_area_tag :content, display_text, placeholder: "Document Title" %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div id="annotatedDocumentsSearchResults"> |
||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-10 p-2"> |
||||||
|
<%= text_field_tag :q, nil, class: "form-control", placeholder: "Search GR Number, Title or Short Title", data: { target: "annotations.q" } %> |
||||||
|
</div> |
||||||
|
<div class="col-sm-1 p-2"> |
||||||
|
<button type="button" class="btn btn-success" data-action="click->annotations#searchDocuments"> Search </button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="row tab"> |
||||||
|
<table class="table table-striped table-hover mb-0" style="width: 98%; margin: 0 auto;"> |
||||||
|
<thead> |
||||||
|
<th class="bg-light"> Reference No. </th> |
||||||
|
<th class="bg-light"> Title </th> |
||||||
|
<th class="bg-light"> Date </th> |
||||||
|
<th class="bg-light"> </th> |
||||||
|
</thead> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-12 p-2"> |
||||||
|
<strong> <%= label_tag :phil_rep %> </strong> |
||||||
|
<%= text_field_tag :phil_rep, phil_rep, class: "form-control", data: { target: "annotations.phil_rep" } %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-12 p-2"> |
||||||
|
<strong> <%= label_tag "Editor's Note" %> </strong> |
||||||
|
<%= rich_text_area_tag :editor_notes, annotation.editor_notes, placeholder: "Editor's Note", data: { target: "annotations.editor_notes" } %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -1,4 +1,6 @@ |
|||||||
class AnnotationMarksModalFormComponent < BaseComponent |
class AnnotationMarksModalFormComponent < BaseComponent |
||||||
|
attr_reader :opts |
||||||
def initialize(current_user:); end |
def initialize(current_user:, opts: {}) |
||||||
end |
@opts = opts |
||||||
|
end |
||||||
|
end |
||||||
|
|||||||
@ -0,0 +1,7 @@ |
|||||||
|
<tr class="clickable-tr" data-controller="application" |
||||||
|
data-href="<%= citator_path %>" |
||||||
|
data-action="click->application#openLinkToNewTab"> |
||||||
|
<td> <%= clean_reference_number %> </td> |
||||||
|
<td> <%= short_title || title %> </td> |
||||||
|
<td> <%= date_or_year %> </td> |
||||||
|
</tr> |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
class DoctrineFormComponent < BaseComponent |
||||||
|
attr_reader :doctrine, :jurisprudence_id, :opts |
||||||
|
|
||||||
|
def initialize(current_user:, doctrine:, jurisprudence_id:, opts: {}) |
||||||
|
@doctrine = doctrine |
||||||
|
@jurisprudence_id = jurisprudence_id |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
@ -0,0 +1,38 @@ |
|||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-12"> |
||||||
|
<label for="subject-name" class="col-form-label"> Subjects </label> |
||||||
|
<%= hidden_field_tag :document_id, jurisprudence_id, data: { target: "doctrines.document_id" } %> |
||||||
|
<%= hidden_field_tag :doctrine_id, doctrine.id, data: { target: "doctrines.doctrine_id" } %> |
||||||
|
<select class="form-control subject-ids-selectize ps-0" name="subject_ids[]" id="subject_ids_" multiple="true" required> |
||||||
|
<% doctrine.subjects.each do |subject| %> |
||||||
|
<option value="<%= subject.id %>" selected> <%= subject.lineage_name %> </option> |
||||||
|
<% end if doctrine.persisted? %> |
||||||
|
</select> |
||||||
|
<div class="invalid-feedback" id="subjects-blank-message"> Subject/s cannot be blank. </div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<% if doctrine.new_record? %> |
||||||
|
<div class="row" id="doctine_content_suggestions_div"> |
||||||
|
<div class="col-sm-12"> |
||||||
|
<label for="subject-name" class="col-form-label">Doctine content suggestions</label> |
||||||
|
<select id="doctine_content_suggestions" class="form-control ps-0"> </select> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-12"> |
||||||
|
<label for="subject-name" class="col-form-label">Head Note</label> |
||||||
|
<%= text_field_tag :headnote, doctrine.headnote, class: "form-control", placeholder: "Head note", required: true, data: { target: "doctrines.headnote" } %> |
||||||
|
<div class="invalid-feedback" id="headnote-blank-message"> Headnote cannot be blank. </div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="col-sm-12"> |
||||||
|
<label for="subject-name" class="col-form-label">Content</label> |
||||||
|
<%= rich_text_area_tag :content, doctrine.content, placeholder: "Doctrine Content", required: true, data: { target: "doctrines.content" } %> |
||||||
|
<div class="invalid-feedback" id="content-blank-message"> Content cannot be blank. </div> |
||||||
|
<div> |
||||||
|
</div> |
||||||
@ -0,0 +1,65 @@ |
|||||||
|
class DoctrineIndexComponent < BaseComponent |
||||||
|
attr_reader :search_results, :opts |
||||||
|
|
||||||
|
include AnnotationSearch |
||||||
|
include DoctrineSearch |
||||||
|
|
||||||
|
def initialize(search_results:, current_user:, opts: {}) |
||||||
|
@search_results = search_results |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def annotation_form_url |
||||||
|
doctrine_annotations_path(doctrine_id: id) |
||||||
|
end |
||||||
|
|
||||||
|
def subject_names |
||||||
|
"(No Subjects Provided)" |
||||||
|
end |
||||||
|
|
||||||
|
def document_title(annotation) |
||||||
|
return annotation.document.short_title if annotation.document.short_title.present? |
||||||
|
|
||||||
|
annotation.document.title |
||||||
|
end |
||||||
|
|
||||||
|
def date_or_year(annotation) |
||||||
|
return annotation.document.docdate.to_date.strftime("%B %d, %Y") if annotation.document.docdate.present? |
||||||
|
|
||||||
|
annotation.document.year |
||||||
|
end |
||||||
|
|
||||||
|
def doctrine_show_url |
||||||
|
return document_doctrine_path(jurisprudence.id, id, is_index_table: false, subject_ids: opts[:subject_ids].reject(&:blank?)) if jurisprudence.present? |
||||||
|
|
||||||
|
doctrine_path(id, is_index_table: false, subject_ids: opts[:subject_ids].reject(&:blank?)) |
||||||
|
end |
||||||
|
|
||||||
|
def clean_phil_rep(annotation) |
||||||
|
return if annotation.phil_rep.blank? |
||||||
|
|
||||||
|
annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") |
||||||
|
end |
||||||
|
|
||||||
|
def search_annotations(search_params) |
||||||
|
search = annotation_search(search_params) |
||||||
|
search.results |
||||||
|
end |
||||||
|
|
||||||
|
def content_diplay_text(annotation) |
||||||
|
return annotation.content.gsub("<div>", "").gsub("</div>", "") if annotation.content.include?("Phil") |
||||||
|
|
||||||
|
contents = annotation.content.gsub("<div>", "").gsub("</div>", "").split(" citing ") |
||||||
|
contents[0] = [contents[0], clean_phil_rep(annotation)].reject(&:blank?).join(", ") |
||||||
|
contents.join(" citing ") |
||||||
|
end |
||||||
|
|
||||||
|
def search_doctrines(search_params) |
||||||
|
search = doctrine_search(search_params) |
||||||
|
search |
||||||
|
end |
||||||
|
|
||||||
|
def render? |
||||||
|
search_results.present? |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,58 @@ |
|||||||
|
<div class="row-flex m-3 mt-0 doctrine-content-body"> |
||||||
|
<div class="container-sm <%= params[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> |
||||||
|
<% search_results.uniq(&:headnote).each do |uniq_by_headnote| %> |
||||||
|
<h5> <%= uniq_by_headnote.headnote %> </h5> |
||||||
|
|
||||||
|
<% grouped_by_content_search_params = { subject_ids: opts[:subject_ids], headnote: uniq_by_headnote.headnote, is_grouped_by_content: true } %> |
||||||
|
<% search_doctrines(grouped_by_content_search_params).group(:content).groups.each do |group_by_content| %> |
||||||
|
<% group_by_content.results.each do |content_result| %> |
||||||
|
<div class="mb-0 fs-5"> <%= raw content_result.content.html_safe %> </div> |
||||||
|
|
||||||
|
<% grouped_by_juris_search_params = { subject_ids: opts[:subject_ids], content: content_result.content, is_grouped_by_juris_id: true } %> |
||||||
|
<% search_doctrines(grouped_by_juris_search_params).group(:jurisprudence_id).groups.each do |grouped_by_juris| %> |
||||||
|
<% grouped_by_juris.results.each do |juris_result| %> |
||||||
|
<h5 class="clickable-link" style="color: darkred;" data-controller="application" |
||||||
|
data-href="<%= document_path(juris_result.jurisprudence.document.id, is_index_table: false, subject_ids: params[:subject_ids]) %>" |
||||||
|
data-action="click->application#openLink"> |
||||||
|
<% document_title = juris_result.jurisprudence.short_title || juris_result.jurisprudence.title %> |
||||||
|
<% date_or_year = juris_result.jurisprudence.doc_date.present? ? juris_result.jurisprudence.doc_date.strftime("%B, %d, %Y") : doctrine.jurisprudence.year %> |
||||||
|
<%= [document_title, juris_result.jurisprudence.clean_reference_number, date_or_year].join(", ") %> |
||||||
|
</h5> |
||||||
|
|
||||||
|
<% search_params = { subject_ids: opts[:subject_ids], headnote: uniq_by_headnote.headnote, content: content_result.content, jurisprudence_id: juris_result.jurisprudence.id } %> |
||||||
|
<% search_doctrines(search_params).results.each do |doctrine| %> |
||||||
|
<% search_annotations({ doctrine_id: doctrine.id }).each do |annotation| %> |
||||||
|
<% annotated_documents_title = [] %> |
||||||
|
<% annotation.documents.each do |annotated_document| %> |
||||||
|
<% ad_title = annotated_document.short_title || annotated_document.title %> |
||||||
|
<% ad_date_or_year = annotated_document.doc_date.present? ? annotated_document.doc_date.strftime("%B %d, %Y") : annotated_document.year %> |
||||||
|
<% annotated_documents_title << [" citing #{ad_title}", annotated_document.clean_reference_number, ad_date_or_year].join(", ") %> |
||||||
|
<% end %> |
||||||
|
<% citing_document_title = [document_title, annotation.document.clean_reference_number, date_or_year, clean_phil_rep(annotation), annotated_documents_title].reject(&:blank?).join(', ').html_safe %> |
||||||
|
|
||||||
|
<div class="row mb-2 pb-0 ms-3"> |
||||||
|
<div class="col-sm-1 p-0 me-1" style="width: auto;"> <strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> </div> |
||||||
|
<div class="col-sm-9 p-0 ms-1"> <%= raw annotation.content.present? ? content_diplay_text(annotation) : citing_document_title %> </div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<% if annotation.editor_notes.present? %> |
||||||
|
<div class="row ms-5 mb-2"> |
||||||
|
<div class="col-sm-2 p-0" style="width: 105px;"> |
||||||
|
<span> Editor's Note: </span> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="col-sm-10 ps-0"> |
||||||
|
<%= raw annotation.editor_notes %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
<hr/> |
||||||
|
</div> |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
class DoctrinesOffcanvasAccordionComponent < BaseComponent |
||||||
|
with_collection_parameter :search_result |
||||||
|
attr_reader :search_result, :opts |
||||||
|
|
||||||
|
def initialize(search_result:, current_user:, opts: {}) |
||||||
|
@search_result = search_result |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_name |
||||||
|
"doctrinesOffCanvasAccordion" |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_body_name |
||||||
|
"doctrinesOffCanvasAccordionBody" |
||||||
|
end |
||||||
|
|
||||||
|
def parent_accordion_id |
||||||
|
return accordion_body_name if search_result["parent_id"].blank? |
||||||
|
|
||||||
|
[accordion_name, search_result["parent_id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def children_accordion_id |
||||||
|
[accordion_name, search_result["heirarchy_level"], search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_id |
||||||
|
[accordion_name, search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_body_id |
||||||
|
[accordion_body_name, search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def index_url |
||||||
|
search_doctrines_path(subject_ids: [search_result["id"]], is_index_table: false) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
<div class="accordion accordion-flush offcanvas-item" id="<%= accordion_id %>"> |
||||||
|
<div class="accordion-item"> |
||||||
|
<div class="accordion-header d-flex justify-content-between"> |
||||||
|
<% if search_result["has_children?"].present? %> |
||||||
|
<div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>" |
||||||
|
data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>" |
||||||
|
data-action="click->subjects#loadDoctrinesOffcanvasAccordion"> |
||||||
|
<%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link", |
||||||
|
data: { controller: "application", href: index_url, action: "click->application#openLink" } %> |
||||||
|
</div> |
||||||
|
<% else %> |
||||||
|
<%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link", |
||||||
|
data: { controller: "application", href: index_url, action: "click->application#openLink" } %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= children_accordion_id %>" data-bs-parent="#<%= accordion_id %>"> |
||||||
|
<div class="accordion-body pt-1 sub-body<%= search_result["heirarchy_level"] + 1 %> pb-1" id="<%= accordion_body_id %>"> |
||||||
|
<div class="text-center"> |
||||||
|
<div class="spinner-border text-danger" role="status"> |
||||||
|
<span class="visually-hidden">Loading...</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
class DoctrinesOffcanvasComponent < BaseComponent |
||||||
|
attr_reader :opts |
||||||
|
|
||||||
|
def initialize(current_user:, opts: {}) |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def render? |
||||||
|
opts[:is_render].present? |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,40 @@ |
|||||||
|
<div class="offcanvas offcanvas-start offcanvas-contents" data-bs-scroll="true" tabindex="-1" data-bs-backdrop="false" id="doctrinesOffCanvas" data-controller="subjects"> |
||||||
|
<div class="offcanvas-header"> |
||||||
|
<h5 class="offcanvas-title"> Doctrines </h5> |
||||||
|
<hr class="m-0"> |
||||||
|
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="offcanvas-body"> |
||||||
|
<div class="accordion accordion-flush subject-index-body" id="doctrinesOffCanvasMainAccordion" > |
||||||
|
<% Cdao::Subject.roots.order(name: :asc).each do |root| %> |
||||||
|
<div class="accordion-item"> |
||||||
|
<div class="accordion-header d-flex justify-content-between"> |
||||||
|
<% if root.children.present? %> |
||||||
|
<div class="accordion-button collapsed m-0 p-0" data-bs-toggle="collapse" data-bs-target="#<%= ["doctrinesOffCanvasAccordion", root.id].join %>" |
||||||
|
data-controller="subjects" data-subject-parent-id="<%= root.id %>" |
||||||
|
data-accordion-target="#<%= ['doctrinesOffCanvasAccordionBody', root.id].join %>" |
||||||
|
data-action="click->subjects#loadDoctrinesOffcanvasAccordion"> |
||||||
|
<%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link", |
||||||
|
data: { controller: "application", href: search_doctrines_path(subject_ids: [root.id], is_index_table: false), action: "click->application#openLink" } %> |
||||||
|
</div> |
||||||
|
<% else %> |
||||||
|
<%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link", |
||||||
|
data: { controller: "application", href: search_doctrines_path(subject_ids: [root.id], is_index_table: false), action: "click->application#openLink" } %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= ["doctrinesOffCanvasAccordion", root.id].join %>" data-bs-parent="#doctrinesOffCanvasMainAccordion"> |
||||||
|
<div class="accordion-body pt-1 pb-1 sub-body1" id="<%= ["doctrinesOffCanvasAccordionBody", root.id].join %>"> |
||||||
|
<div class="text-center"> |
||||||
|
<div class="spinner-border text-danger" role="status"> |
||||||
|
<span class="visually-hidden">Loading...</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
class DocumentAdvancedSearchComponent < BaseComponent |
||||||
|
attr_reader :opts |
||||||
|
|
||||||
|
def initialize(current_user:, opts: {}) |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def years |
||||||
|
start_year = Cdao::Jurisprudence.order(year: :asc).first(10).map(&:year).compact.uniq.first || "1900" |
||||||
|
end_year = Cdao::Jurisprudence.order(year: :asc).last(10).map(&:year).compact.uniq.last || Time.zone.today.year |
||||||
|
(start_year..end_year).entries.reverse |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
<%= form_tag(documents_path, method: :get) do %> |
||||||
|
<div class="mb-2"> |
||||||
|
<%= text_field_tag :q, params[:q], placeholder: 'Full text search', class: "form-control mb-0" %> |
||||||
|
</div> |
||||||
|
<hr class="simple mb-0"> |
||||||
|
<div class="mb-2"> |
||||||
|
<label for="exampleFormControlInput1" class="form-label text-white">G.R. Number</label> |
||||||
|
<%= text_field_tag :reference_number, params[:reference_number], class: "form-control mb-0" %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="mb-2"> |
||||||
|
<label for="exampleFormControlInput1" class="form-label text-white">Title</label> |
||||||
|
<%= text_field_tag :title, params[:title], class: "form-control mb-0" %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="d-flex align-items-end"> |
||||||
|
<div class="mb-2 w-100 pe-2"> |
||||||
|
<label for="exampleFormControlInput1" class="form-label text-white">Year</label> |
||||||
|
<%= select_tag :year_start, options_for_select(years, params[:year_start]), class: "form-select", include_blank: true %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="mb-2 w-100 ps-2"> |
||||||
|
<%= select_tag :year_end, options_for_select(years, params[:year_end]), class: "form-select", include_blank: true %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<hr class="simple mb-0"> |
||||||
|
<div class="mb-2"> |
||||||
|
<label for="exampleFormControlInput1" class="form-label text-white">Citation Finder</label> |
||||||
|
<%= text_field_tag :citation_finder, params[:citation_finder], class: "form-control mb-0" %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="d-flex justify-content-end mt-3"> |
||||||
|
<button class="btn btn-success reset-document-advanced-search me-2 mb-2"><i class="fas fa-sync"></i> Refresh</button> |
||||||
|
<button type="submit" class="btn btn-danger mb-2">Search</button> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
@ -1,53 +1,45 @@ |
|||||||
<div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" href="<%= opts[:is_disable_clickable_link].present? ? '#' : document_doctrine_path(document_id, id)%>"> |
<div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" data-controller="application" |
||||||
<% if opts[:is_subjects_index].blank? %> |
data-href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>" |
||||||
<% if opts[:is_doctrines_index].present? && opts[:subject_ids].reject(&:blank?).present? %> |
data-action="click->application#openLink"> |
||||||
<h5 style="color: darkred;"> <%= subjects.where(id: opts[:subject_ids].map(&:to_i)).map(&:lineage_name).join(" ") %> </h5> |
<div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> |
||||||
<% elsif subjects.present? %> |
<span> <b> <i> <%= headnote %> </i> </b> </span> |
||||||
<% subjects.each do |subject| %> |
<p class="mb-0"> <%= raw content.html_safe %> </p> |
||||||
<h5 style="color: darkred;"> <%= subject.lineage_name %> </h5> |
|
||||||
<% end %> |
<div class="container-fluid p-0"> |
||||||
<% else %> |
<% if opts[:is_doctrines_index].present? %> |
||||||
<h5> (No Subjects Provided) </h5> |
<% document_title = jurisprudence.short_title || jurisprudence.title %> |
||||||
<% end %> |
<% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.to_date.strftime("%B %d, %Y") : jurisprudence.year %> |
||||||
<% end %> |
<h5 style="color: darkred;"> <%= [document_title, jurisprudence.clean_reference_number, date_or_year].join(", ") %> </h5> |
||||||
|
<% end %> |
||||||
<div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> |
|
||||||
<p class="mb-0"> <%= raw content.html_safe %> </p> |
|
||||||
|
|
||||||
<div class="container-sm ms-3"> |
|
||||||
<% annotations.each do |annotation| %> |
|
||||||
<% if opts[:is_doctrines_index].present? %> |
|
||||||
<% document_title = annotation.doctrine.document.short_title || annotation.doctrine.document.title %> |
|
||||||
<% date_or_year = annotation.doctrine.document.docdate.present? ? annotation.doctrine.document.docdate.to_date.strftime("%B %d, %Y") : annotation.document.year %> |
|
||||||
<span> <%= [document_title, annotation.document.reference_number, date_or_year].join(", ") %> </span> |
|
||||||
<% end %> |
|
||||||
|
|
||||||
<p class="mb-0 ms-3"> |
<% annotations.each do |annotation| %> |
||||||
<% annotated_documents_title = [] %> |
<% annotated_documents_title = [] %> |
||||||
<% annotation.documents.each do |annotated_document| %> |
<% annotation.documents.each do |annotated_document| %> |
||||||
<% ad_title = annotated_document.short_title || annotated_document.title %> |
<% ad_title = annotated_document.short_title || annotated_document.title %> |
||||||
<% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %> |
<% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %> |
||||||
<% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %> |
<% annotated_documents_title << [" citing #{ad_title}", annotated_document.clean_reference_number, ad_date_or_year].join(", ") %> |
||||||
<% end %> |
<% end %> |
||||||
|
<% citing_document_title = [document_title, annotation.document.clean_reference_number, date_or_year, clean_phil_rep(annotation), annotated_documents_title].reject(&:blank?).join(', ').html_safe %> |
||||||
|
|
||||||
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> |
<div class="row mb-2 pb-0 ms-3"> |
||||||
<%= raw [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %> |
<div class="col-sm-1 p-0 me-1" style="width: auto;"> <strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> </div> |
||||||
</p> |
<div class="col-sm-9 p-0 ms-1"> <%= raw annotation.content.present? ? content_diplay_text(annotation) : citing_document_title %> </div> |
||||||
|
</div> |
||||||
|
|
||||||
<% if annotation.editor_notes.present? %> |
<% if annotation.editor_notes.present? %> |
||||||
<div class="row ms-5"> |
<div class="row ms-5 mb-2"> |
||||||
<div class="col-sm-2 p-0" style="width: 105px;"> |
<div class="col-sm-2 p-0" style="width: 105px;"> |
||||||
<span> Editors Note: </span> |
<span> Editor's Note: </span> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<div class="col-sm-10 ps-0"> |
<div class="col-sm-10 ps-0"> |
||||||
<%= raw annotation.editor_notes %> |
<%= raw annotation.editor_notes %> |
||||||
</div> |
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
</div> |
</div> |
||||||
<% end %> |
</div> |
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<hr/> |
<hr/> |
||||||
</div> |
</div> |
||||||
|
|||||||
@ -1,5 +0,0 @@ |
|||||||
<tr href="<%= document_path(search_result.id) %>" class="<%= opts.reject{ |k, v| v.blank? }.blank? ? 'clickable-tr' : ''%>" target="_blank"> |
|
||||||
<td> <%= clean_reference_number %> </td> |
|
||||||
<td> <%= short_title || title %> </td> |
|
||||||
<td> <%= date_or_year %> </td> |
|
||||||
</tr> |
|
||||||
@ -0,0 +1,25 @@ |
|||||||
|
class JurisprudencesIndexTableComponent < BaseComponent |
||||||
|
with_collection_parameter :jurisprudence |
||||||
|
attr_reader :jurisprudence, :opts |
||||||
|
|
||||||
|
def initialize(jurisprudence:, current_user:, opts: {}) |
||||||
|
@jurisprudence = jurisprudence |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
delegate :id, to: :jurisprudence |
||||||
|
delegate :clean_reference_number, to: :jurisprudence |
||||||
|
delegate :title, to: :jurisprudence |
||||||
|
delegate :short_title, to: :jurisprudence |
||||||
|
delegate :document, to: :jurisprudence |
||||||
|
|
||||||
|
def date_or_year |
||||||
|
return jurisprudence.docdate.strftime("%B %d, %Y") if jurisprudence.docdate.present? |
||||||
|
|
||||||
|
jurisprudence.year |
||||||
|
end |
||||||
|
|
||||||
|
def doctrine_annotations_path(doctrine_id) |
||||||
|
doctrine_annotations_path(doctrine_id: doctrine_id) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
<tr class="clickable-link" data-controller="application" data-href="<%= document_path(document.id) %>" |
||||||
|
data-action="click->application#openLink"> |
||||||
|
<td> <%= clean_reference_number %> </td> |
||||||
|
<td> <%= short_title || title %> </td> |
||||||
|
<td> <%= date_or_year %> </td> |
||||||
|
</tr> |
||||||
@ -1,33 +1,30 @@ |
|||||||
<div class="col col-md-12"> |
<header class="header bg-white b-b clearfix"> |
||||||
<header class="header bg-white b-b clearfix"> |
<div class="row m-t-sm align-items-end pagination-body"> |
||||||
<div class="row m-t-sm align-items-end pagination-body"> |
<div class="<%=data.present? ? "col-md-8 mb-0 " : "col-md-12 mb-0"%> <%= opts[:is_cited_in_doc].present? ? 'd-none': ""%> "> |
||||||
<div class="col-md-6 mb-0<%=opts[:is_subject_breadcrums].present? && subjects.present? ? '' : ' ps-0' %> "> |
<% if opts[:is_subject_breadcrums].present? && subjects.present? %> |
||||||
<% if opts[:is_subject_breadcrums].present? && subjects.present? %> |
<ol class="breadcrumb mb-0"> |
||||||
<ol class="breadcrumb mb-0"> |
<% subjects.each do |subject| %> |
||||||
<% subjects.each do |subject| %> |
<% subject.ancestors.each do |ancestor| %> |
||||||
<% subject.ancestors.each do |ancestor| %> |
<li class="breadcrumb-item d-inline-flex"> |
||||||
<li class="breadcrumb-item d-inline-flex"> |
<h4 class="label-breadcrumb"> <%= link_to ancestor.name, custom_url(ancestor.id), class: "text-decoration-none" %> </h4> |
||||||
<h4> <%= link_to ancestor.name, subject_index_path(ancestor), class: "text-decoration-none" %> </h4> |
</li> |
||||||
</li> |
<% end %> |
||||||
<% end %> |
<li class="breadcrumb-item d-inline-flex active"> |
||||||
|
<h4> <%= subject.name %> </h4> |
||||||
<li class="breadcrumb-item d-inline-flex active"> |
</li> |
||||||
<h4> <%= subject.name %> </h4> |
<% end %> |
||||||
</li> |
</ol> |
||||||
<% end %> |
<% else %> |
||||||
</ol> |
<h4 style="color: darkred" class="m-0">Search Results</h4> |
||||||
<% else %> |
<small style="color: darkred"> |
||||||
<h4 style="color: darkred" class="m-0">Search Results</h4> |
<%= page_entries_info data, entry_name: 'records' if data.present? %> |
||||||
<small style="color: darkred"> |
</small> |
||||||
<%= page_entries_info data, entry_name: 'records' if data.present? %> |
<% end %> |
||||||
</small> |
</div> |
||||||
<% end %> |
<div class="<%=data.present? ? "col-md-4 position-relative" : "d-none"%>"> |
||||||
</div> |
<div class="text-center pagination justify-content-end me-3"> |
||||||
<div class="col-md-6 position-relative"> |
<%= (paginate data) if data.present? %> |
||||||
<div class="text-center pagination justify-content-end"> |
|
||||||
<%= (paginate data) if data.present? %> |
|
||||||
</div> |
|
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
</header> |
</div> |
||||||
</div> |
</header> |
||||||
|
|||||||
@ -0,0 +1,47 @@ |
|||||||
|
class ReportsSearchResultsComponent < BaseComponent |
||||||
|
with_collection_parameter :search_result |
||||||
|
attr_reader :search_result, :opts |
||||||
|
|
||||||
|
def initialize(search_result:, current_user:, opts: {}) |
||||||
|
@search_result = search_result |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
delegate :id, to: :search_result |
||||||
|
delegate :headnote, to: :search_result |
||||||
|
delegate :subject_ids, to: :search_result |
||||||
|
delegate :content, to: :search_result |
||||||
|
delegate :annotations, to: :search_result |
||||||
|
delegate :subjects, to: :search_result |
||||||
|
delegate :doctrine_jurisprudences, to: :search_result |
||||||
|
|
||||||
|
def annotation_form_url |
||||||
|
doctrine_annotations_path(doctrine_id: id) |
||||||
|
end |
||||||
|
|
||||||
|
def subject_names |
||||||
|
"(No Subjects Provided)" |
||||||
|
end |
||||||
|
|
||||||
|
def jurisprudence |
||||||
|
return nil if doctrine_jurisprudences.blank? |
||||||
|
|
||||||
|
doctrine_jurisprudences.first.jurisprudence |
||||||
|
end |
||||||
|
|
||||||
|
def document_title(annotation) |
||||||
|
return annotation.document.short_title if annotation.document.short_title.present? |
||||||
|
|
||||||
|
annotation.document.title |
||||||
|
end |
||||||
|
|
||||||
|
def date_or_year(annotation) |
||||||
|
return annotation.document.docdate.to_date.strftime("%B %d, %Y") if annotation.document.docdate.present? |
||||||
|
|
||||||
|
annotation.document.year |
||||||
|
end |
||||||
|
|
||||||
|
def render? |
||||||
|
opts[:is_render].present? |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,42 @@ |
|||||||
|
<div class="row-flex m-3 mt-0 doctrine-content-body clickable-link" data-controller="application" |
||||||
|
data-href="<%= jurisprudence.present? ? document_doctrine_path(jurisprudence.id, id) : doctrine_path(id)%>" |
||||||
|
data-action="click->application#openLink"> |
||||||
|
<div class="container-sm <%= opts[:is_subjects_index].present? ? 'm-0 ps-0' : '' %>"> |
||||||
|
<p class="mb-0"> <%= raw content.html_safe %> </p> |
||||||
|
|
||||||
|
|
||||||
|
<div class="container-fluid p-0"> |
||||||
|
<% document_title = jurisprudence.short_title || jurisprudence.title %> |
||||||
|
<% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.strftime : jurisprudence.year %> |
||||||
|
<h5 style="color: darkred;"> <%= [document_title, jurisprudence.reference_number, date_or_year].join(", ") %> </h5> |
||||||
|
|
||||||
|
<% annotations.each do |annotation| %> |
||||||
|
<p class="mb-0 ms-5"> |
||||||
|
<% annotated_documents_title = [] %> |
||||||
|
<% annotation.documents.each do |annotated_document| %> |
||||||
|
<% ad_title = annotated_document.short_title || annotated_document.title %> |
||||||
|
<% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %> |
||||||
|
<% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %> |
||||||
|
<% end %> |
||||||
|
|
||||||
|
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> |
||||||
|
<%= raw [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %> |
||||||
|
</p> |
||||||
|
|
||||||
|
<% if annotation.editor_notes.present? %> |
||||||
|
<div class="row ms-5"> |
||||||
|
<div class="col-sm-2 p-0" style="width: 105px;"> |
||||||
|
<span> Editor's Note: </span> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="col-sm-10 ps-0"> |
||||||
|
<%= raw annotation.editor_notes %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<hr/> |
||||||
|
</div> |
||||||
@ -1,5 +1,8 @@ |
|||||||
class SidenavComponent < BaseComponent |
class SidenavComponent < BaseComponent |
||||||
def initialize(current_user:) |
attr_reader :current_user, :opts |
||||||
|
|
||||||
|
def initialize(current_user:, opts: {}) |
||||||
@current_user = current_user |
@current_user = current_user |
||||||
|
@opts = opts |
||||||
end |
end |
||||||
end |
end |
||||||
|
|||||||
@ -1,72 +1,115 @@ |
|||||||
<% if current_user.present? %> |
<% if current_user.present? %> |
||||||
<div class="sidebar sidebar-body d-flex flex-column align-items-center align-items-sm-start pt-2 text-white min-vh-100"> |
<% if opts[:is_sidenav].present? %> |
||||||
<ul class="nav flex-column text-white w-100"> |
<div class="col-auto col-md-3 col-xl-2 px-sm-2 px-0 bg-secondary min-vh-100" style="padding: 0 !important;"> |
||||||
<a href="/" class="nav-link d-flex align-items-center h3 text-white my-2 w-100"> |
<div class="sidebar sidebar-body d-flex flex-column align-items-center align-items-sm-start pt-2 text-white min-vh-100"> |
||||||
PJET |
<ul class="nav flex-column text-white w-100"> |
||||||
</a> |
<a href="/" class="nav-link d-flex align-items-center h3 text-white my-2 w-100"> |
||||||
<hr/> |
PJET |
||||||
|
</a> |
||||||
|
<hr/> |
||||||
|
|
||||||
<li class="nav-link d-flex align-items-center d-flex align-items-center"> |
<li class="nav-link d-flex align-items-center d-flex align-items-center"> |
||||||
<i class="fas fa-home"></i> <%= link_to "Home", root_path, class: "mx-2 text-white text-decoration-none w-100" %> |
<i class="fas fa-home"></i> <%= link_to "Home", root_path, class: "mx-2 text-white text-decoration-none w-100" %> |
||||||
</li> |
</li> |
||||||
|
|
||||||
<li class="nav-link d-flex align-items-center"> |
<li class="nav-link d-flex align-items-center"> |
||||||
<i class="fas fa-search"></i> <%= link_to "Search", documents_path, class: "mx-2 text-white text-decoration-none w-100" %> |
<i class="fas fa-search"></i> <%= link_to "Search", documents_path, class: "mx-2 text-white text-decoration-none w-100" %> |
||||||
</li> |
</li> |
||||||
|
|
||||||
<li class="nav-link"> |
<li class="nav-link"> |
||||||
<div class="accordion-item accordion-body bg-transparent "> |
<div class="accordion-item accordion-body bg-transparent "> |
||||||
<div class="accordion-header bg-transparent"> |
<div class="accordion-header bg-transparent"> |
||||||
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#mainSubjectIndexSubMenu"> |
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#mainSubjectIndexSubMenu"> |
||||||
<i class="fas fa-indent"></i> <%= link_to "Subjects", "#", class: "accordion-link text-decoration-none mx-2 text-dark text-white " %> |
<i class="fas fa-indent"></i> <%= link_to "Subjects", "#", class: "accordion-link text-decoration-none mx-2 text-dark text-white " %> |
||||||
</button> |
</button> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<%= render(SubjectsSidenavSubMenuComponent.new(current_user: current_user, opts: { is_subjects_index: true, main_sub_menu: "mainSubjectIndexSubMenu", second_sub_menu: "secondSubjectIndexSubMenu", third_sub_menu: "thirdSubjectIndexSubMenu", fourth_sub_menu: "fourthSubjectIndexSubMenu", fifth_sub_menu: "fifthSubjectIndexSubMenu" })) %> |
<%= render(SubjectsSidenavSubMenuComponent.new(current_user: current_user, opts: { is_subjects_index: true, main_sub_menu: "mainSubjectIndexSubMenu", second_sub_menu: "secondSubjectIndexSubMenu", third_sub_menu: "thirdSubjectIndexSubMenu", fourth_sub_menu: "fourthSubjectIndexSubMenu", fifth_sub_menu: "fifthSubjectIndexSubMenu" })) %> |
||||||
</div> |
</div> |
||||||
</li> |
</li> |
||||||
|
|
||||||
<li class="nav-link "> |
<li class="nav-link "> |
||||||
<div class="accordion-item accordion-body bg-transparent"> |
<div class="accordion-item accordion-body bg-transparent"> |
||||||
<div class="accordion-header"> |
<div class="accordion-header"> |
||||||
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#mainDoctrinesSubMenu"> |
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#mainDoctrinesSubMenu"> |
||||||
<i class="fas fa-book"></i> <%= link_to "Doctrines", "#", class: "accordion-link text-decoration-none mx-2 text-dark text-white " %> |
<i class="fas fa-book"></i> <%= link_to "Doctrines", "#", class: "accordion-link text-decoration-none mx-2 text-dark text-white " %> |
||||||
</button> |
</button> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<%= render(SubjectsSidenavSubMenuComponent.new(current_user: current_user, opts: { is_doctrines_index: true, main_sub_menu: "mainDoctrinesSubMenu", second_sub_menu: "secondDoctrinesSubMenu", third_sub_menu: "thirdDoctrinesSubMenu", fourth_sub_menu: "fourthDoctrinesSubMenu", fifth_sub_menu: "fifthDoctrinesSubMenu" })) %> |
<%= render(SubjectsSidenavSubMenuComponent.new(current_user: current_user, opts: { is_doctrines_index: true, main_sub_menu: "mainDoctrinesSubMenu", second_sub_menu: "secondDoctrinesSubMenu", third_sub_menu: "thirdDoctrinesSubMenu", fourth_sub_menu: "fourthDoctrinesSubMenu", fifth_sub_menu: "fifthDoctrinesSubMenu" })) %> |
||||||
</div> |
</div> |
||||||
</li> |
</li> |
||||||
|
|
||||||
<li class="nav-link d-flex align-items-center"> |
<li class="nav-link d-flex align-items-center"> |
||||||
<i class="fas fa-map-signs"></i> <%= link_to "Desicions", decisions_path, class: "mx-2 text-white text-decoration-none" %> |
<i class="fas fa-map-signs"></i> <%= link_to "Desicions", decisions_path, class: "mx-2 text-white text-decoration-none" %> |
||||||
</li> |
</li> |
||||||
|
|
||||||
<li class="nav-link"> |
<li class="nav-link"> |
||||||
<div class="accordion-item accordion-body bg-transparent "> |
<div class="accordion-item accordion-body bg-transparent "> |
||||||
<div class="accordion-header bg-transparent"> |
<div class="accordion-header bg-transparent"> |
||||||
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#settings"> |
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#settings"> |
||||||
<i class="fas fa-cog"></i> <%= link_to "Settings", "#", class: "accordion-link text-decoration-none mx-2 text-white" %> |
<i class="fas fa-cog"></i> <%= link_to "Settings", "#", class: "accordion-link text-decoration-none mx-2 text-white" %> |
||||||
</button> |
</button> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="settings" data-bs-parent="#sidenav"> |
<div class="accordion-collapse collapse" id="settings" data-bs-parent="#sidenav"> |
||||||
<div class="accordion-body pb-0 pe-0 pt-0"> |
<div class="accordion-body pb-0 pe-0 pt-0"> |
||||||
<div class="accordion accordion-flush ps-20" id="firstLevelSubMenu"> |
<div class="accordion accordion-flush ps-20" id="firstLevelSubMenu"> |
||||||
<div class="accordion-item bg-transparent"> |
<div class="accordion-item bg-transparent"> |
||||||
<div class="accordion-header bg-transparent"> |
<div class="accordion-header bg-transparent"> |
||||||
<%= link_to "Subjects", subject_indexes_path, class: "accordion-link text-white text-decoration-none text-dark d-block sub1 clickable-link" %> |
<%= link_to "Subjects", subject_indexes_path, class: "accordion-link text-white text-decoration-none text-dark d-block sub1 clickable-link" %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
|
</li> |
||||||
|
|
||||||
|
<li class="nav-link d-flex align-items-center"> |
||||||
|
<i class="fas fa-sign-out-alt"></i> <%= link_to "Logout", destroy_user_session_path, class: "mx-2 text-white text-decoration-none" %> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% elsif opts[:is_nav_bar].present? %> |
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-light p-0 navbar-body"> |
||||||
|
<div class="container-fluid"> |
||||||
|
<div class="collapse navbar-collapse justify-content-between" id="navbarSupportedContent"> |
||||||
|
<div> |
||||||
|
<a class="navbar-brand" href="#"><%= image_pack_tag 'application/cdasiaonline_logo.png', class:"nav-bar-app-logo" %></a> |
||||||
</div> |
</div> |
||||||
|
<form class="d-flex"> |
||||||
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> |
||||||
|
<li class="nav-item p-2"> |
||||||
|
<%= link_to '<i class="fas fa-search me-2"></i>Search'.html_safe, documents_path, class: "nav-link" %> |
||||||
|
</li> |
||||||
|
<li class="nav-item p-2"> |
||||||
|
<a class="nav-link" style="cursor: pointer" data-bs-toggle="offcanvas" data-bs-target="#subjectsOffCanvas"> |
||||||
|
<i class="fas fa-indent me-2"></i> Subjects |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<li class="nav-item p-2" style="cursor: pointer"> |
||||||
|
<a class="nav-link" data-bs-toggle="offcanvas" data-bs-target="#doctrinesOffCanvas"> |
||||||
|
<i class="fas fa-book me-2"></i> Doctrines |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<li class="nav-item p-2"> |
||||||
|
<%= link_to '<i class="fas fa-map-signs me-2"></i> Decisions'.html_safe, decisions_path, class: "nav-link" %> |
||||||
|
</li> |
||||||
|
<li class="nav-item p-2"> |
||||||
|
<%= link_to '<i class="fas fa-cog me-2"></i>Settings'.html_safe, subject_indexes_path, class: "nav-link" %> |
||||||
|
</li> |
||||||
|
<li class="nav-item p-2"> |
||||||
|
<%= link_to '<i class="fa-solid fa-file-lines"></i>Reports'.html_safe, reports_path, class: "nav-link" %> |
||||||
|
</li> |
||||||
|
<li class="nav-item p-2 active-red"> |
||||||
|
<%= link_to '<i class="fas fa-sign-out-alt"></i> Sign Out'.html_safe, destroy_user_session_path, class:" text-white nav-link" %> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
</form> |
||||||
</div> |
</div> |
||||||
</li> |
</div> |
||||||
|
</nav> |
||||||
<li class="nav-link d-flex align-items-center"> |
<% end %> |
||||||
<i class="fas fa-sign-out-alt"></i> <%= link_to "Logout", destroy_user_session_path, class: "mx-2 text-white text-decoration-none" %> |
|
||||||
</li> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
<% end %> |
<% end %> |
||||||
|
|||||||
@ -1,8 +0,0 @@ |
|||||||
class SubjectAccordionComponent < BaseComponent |
|
||||||
attr_reader :parent |
|
||||||
|
|
||||||
def initialize(current_user:, parent:) |
|
||||||
@parent = parent |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
@ -1,76 +0,0 @@ |
|||||||
<% parent.children.order(name: :asc).each do |sub1| %> |
|
||||||
<div class="accordion accordion-flush ps-20" id="#secondLevelPanel<%= sub1.id %>"> |
|
||||||
<div class="accordion-item"> |
|
||||||
<div class="accordion-header d-flex justify-content-between"> |
|
||||||
<% if sub1.children.present? %> |
|
||||||
<div class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#<%= ["secondLevel", sub1.id].join %>"> |
|
||||||
<%= link_to sub1.name, subject_index_path(sub1.id), class: "accordion-link text-decoration-none text-dark d-block sub2 clickable-link" %> |
|
||||||
<%= link_to "Add Sub Level", new_subject_index_path(parent_id: sub1.id), class: "btn btn-sm btn-primary text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %> |
|
||||||
</div> |
|
||||||
<% else %> |
|
||||||
<%= link_to sub1.name, subject_index_path(sub1.id), class: "accordion-link text-decoration-none text-dark d-block sub2 clickable-link" %> |
|
||||||
<%= link_to "Add Sub Level", new_subject_index_path(parent_id: sub1.id), class: "btn btn-sm btn-primary text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin" %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= ["secondLevel", sub1.id].join %>" data-bs-parent="#secondLevelPanel<%= sub1.id %>"> |
|
||||||
<div class="accordion-body pt-1"> |
|
||||||
<% sub1.children.order(name: :asc).each do |sub2| %> |
|
||||||
<div class="accordion accordion-flush ps-20" id="thirdLevelPanel<%= sub2.id %>"> |
|
||||||
<div class="accordion-item"> |
|
||||||
<div class="accordion-header d-flex justify-content-between"> |
|
||||||
<% if sub1.children.present? %> |
|
||||||
<div class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#<%= ["thirdLevel", sub2.id].join %>"> |
|
||||||
<%= link_to sub2.name, subject_index_path(sub2.id), class: "accordion-link text-decoration-none text-dark d-block sub3 clickable-link" %> |
|
||||||
<%= link_to "Add Sub Level", new_subject_index_path(parent_id: sub2.id), class: "btn btn-sm btn-primary text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %> |
|
||||||
</div> |
|
||||||
<% else %> |
|
||||||
<%= link_to sub2.name, subject_index_path(sub2.id), class: "accordion-link text-decoration-none text-dark d-block sub3 clickable-link" %> |
|
||||||
<%= link_to "Add Sub Level", new_subject_index_path(parent_id: sub2.id), class: "btn btn-sm btn-primary text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin" %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= ["thirdLevel", sub2.id].join %>" data-bs-parent="#thirdLevelPanel<%= sub2.id %>"> |
|
||||||
<div class="accordion-body pt-1"> |
|
||||||
<% sub2.children.order(name: :asc).each do |sub3| %> |
|
||||||
<div class="accordion accordion-flush ps-20" id="fourthLevelPanel<%= sub3.id %>"> |
|
||||||
<div class="accordion-item"> |
|
||||||
<div class="accordion-header d-flex justify-content-between"> |
|
||||||
<% if sub3.children.present? %> |
|
||||||
<div class="<%= sub3.children.present? ? 'accordion-button' : '' %> collapsed" data-bs-toggle="collapse" data-bs-target="#<%= ["fourthLevel", sub3.id].join %>"> |
|
||||||
<%= link_to sub3.name, subject_index_path(sub3.id), class: "accordion-link text-decoration-none text-dark d-block sub4 clickable-link" %> |
|
||||||
<%= link_to "Add Sub Level", new_subject_index_path(parent_id: sub3.id), class: "btn btn-sm btn-primary text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %> |
|
||||||
</div> |
|
||||||
<% else %> |
|
||||||
<%= link_to sub3.name, subject_index_path(sub3.id), class: "accordion-link text-decoration-none text-dark d-block sub4 clickable-link" %> |
|
||||||
<%= link_to "Add Sub Level", new_subject_index_path(parent_id: sub3.id), class: "btn btn-sm btn-primary text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin" %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= ["fourthLevel", sub3.id].join %>" data-bs-parent="#fourthLevelPanel<%= sub3.id %>"> |
|
||||||
<div class="accordion-body pt-1"> |
|
||||||
<% sub3.children.order(name: :asc).each do |sub4| %> |
|
||||||
<div class="accordion accordion-flush ps-20"> |
|
||||||
<div class="accordion-item d-flex justify-content-between"> |
|
||||||
<div> |
|
||||||
<%= link_to sub4.name, subject_index_path(sub4.id), class: "accordion-link text-decoration-none text-dark d-block sub5 clickable-link" %> |
|
||||||
<%= link_to "Add Sub Level", new_subject_index_path(parent_id: sub4.id), class: "btn btn-sm btn-primary text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin" %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
@ -0,0 +1,38 @@ |
|||||||
|
class SubjectsAccordionComponent < BaseComponent |
||||||
|
with_collection_parameter :search_result |
||||||
|
attr_reader :search_result, :opts |
||||||
|
|
||||||
|
def initialize(search_result:, current_user:, opts: {}) |
||||||
|
@search_result = search_result |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_name |
||||||
|
"subjectsAccordion" |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_body_name |
||||||
|
"subjectsAccordionBody" |
||||||
|
end |
||||||
|
|
||||||
|
def parent_accordion_id |
||||||
|
[accordion_name, search_result["parent_id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def children_accordion_id |
||||||
|
[accordion_name, search_result["heirarchy_level"], search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_id |
||||||
|
[accordion_name, search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_body_id |
||||||
|
[accordion_body_name, search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def custom_url |
||||||
|
subject_index_path(search_result["id"]) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
@ -0,0 +1,31 @@ |
|||||||
|
<div class="accordion accordion-flush" id="<%= accordion_id %>"> |
||||||
|
<div class="accordion-item"> |
||||||
|
<div class="accordion-header d-flex justify-content-between"> |
||||||
|
<% if search_result["has_children?"].present? %> |
||||||
|
<div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>" |
||||||
|
data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>" |
||||||
|
data-action="click->subjects#loadSubjectsAccordion"> |
||||||
|
<%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link", |
||||||
|
data: { controller: "application", href: custom_url, action: "click->application#openLink" } %> |
||||||
|
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: search_result["id"]), |
||||||
|
class: "text-decoration-none d-block sub#{search_result["heirarchy_level"]} clickable-link position-absolute end-0 me-5" %> |
||||||
|
</div> |
||||||
|
<% else %> |
||||||
|
<%= link_to search_result["name"], custom_url, class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link", |
||||||
|
data: { controller: "application", href: custom_url, action: "click->application#openLink" } %> |
||||||
|
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: search_result["id"]), |
||||||
|
class: "text-decoration-none d-block sub#{search_result["heirarchy_level"]} clickable-link position-absolute end-0 non-toggle" %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= children_accordion_id %>" data-bs-parent="#<%= accordion_id %>"> |
||||||
|
<div class="accordion-body pt-1 sub-body<%= search_result["heirarchy_level"] + 1 %> pb-0" id="<%= accordion_body_id %>"> |
||||||
|
<div class="text-center"> |
||||||
|
<div class="spinner-border text-danger" role="status"> |
||||||
|
<span class="visually-hidden">Loading...</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
class SubjectsOffcanvasAccordionComponent < BaseComponent |
||||||
|
with_collection_parameter :search_result |
||||||
|
attr_reader :search_result, :opts |
||||||
|
|
||||||
|
def initialize(search_result:, current_user:, opts: {}) |
||||||
|
@search_result = search_result |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_name |
||||||
|
"subjectsOffCanvasAccordion" |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_body_name |
||||||
|
"subjectsOffCanvasAccordionBody" |
||||||
|
end |
||||||
|
|
||||||
|
def parent_accordion_id |
||||||
|
return accordion_body_name if search_result["parent_id"].blank? |
||||||
|
|
||||||
|
[accordion_name, search_result["parent_id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def children_accordion_id |
||||||
|
[accordion_name, search_result["heirarchy_level"], search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_id |
||||||
|
[accordion_name, search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def accordion_body_id |
||||||
|
[accordion_body_name, search_result["id"]].join |
||||||
|
end |
||||||
|
|
||||||
|
def index_url |
||||||
|
search_documents_path(subject_ids: search_result["id"], is_index_table: true) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
<div class="accordion accordion-flush offcanvas-item" id="<%= accordion_id %>"> |
||||||
|
<div class="accordion-item"> |
||||||
|
<div class="accordion-header d-flex justify-content-between"> |
||||||
|
<% if search_result["has_children?"].present? %> |
||||||
|
<div class="accordion-button collapsed m-0 p-0 sub-label<%= search_result["heirarchy_level"] + 1 %>" data-bs-toggle="collapse" data-bs-target="#<%= children_accordion_id %>" |
||||||
|
data-controller="subjects" data-subject-parent-id="<%= search_result["id"] %>" data-accordion-target="#<%= accordion_body_id %>" |
||||||
|
data-action="click->subjects#loadSubjectsOffcanvasAccordion"> |
||||||
|
<%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link", |
||||||
|
data: { controller: "application", href: index_url, action: "click->application#openLink" } %> |
||||||
|
</div> |
||||||
|
<% else %> |
||||||
|
<%= link_to search_result["name"], "#", class: "accordion-link text-decoration-none text-dark d-block sub#{search_result["heirarchy_level"] + 1} clickable-link", |
||||||
|
data: { controller: "application", href: index_url, action: "click->application#openLink" } %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= children_accordion_id %>" data-bs-parent="#<%= accordion_id %>"> |
||||||
|
<div class="accordion-body pt-1 sub-body<%= search_result["heirarchy_level"] + 1 %> pb-1" id="<%= accordion_body_id %>"> |
||||||
|
<div class="text-center"> |
||||||
|
<div class="spinner-border text-danger" role="status"> |
||||||
|
<span class="visually-hidden">Loading...</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
class SubjectsOffcanvasComponent < BaseComponent |
||||||
|
attr_reader :opts |
||||||
|
|
||||||
|
def initialize(current_user:, opts: {}) |
||||||
|
@opts = opts |
||||||
|
end |
||||||
|
|
||||||
|
def render? |
||||||
|
opts[:is_render].present? |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,40 @@ |
|||||||
|
<div class="offcanvas offcanvas-start offcanvas-contents" data-bs-scroll="true" tabindex="-1" data-bs-backdrop="false" id="subjectsOffCanvas" data-controller="subjects"> |
||||||
|
<div class="offcanvas-header"> |
||||||
|
<h5 class="offcanvas-title"> Subjects </h5> |
||||||
|
<hr class="m-0"> |
||||||
|
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="offcanvas-body"> |
||||||
|
<div class="accordion accordion-flush subject-index-body" id="subjectsOffCanvasMainAccordion" > |
||||||
|
<% Cdao::Subject.roots.order(name: :asc).each do |root| %> |
||||||
|
<div class="accordion-item"> |
||||||
|
<div class="accordion-header d-flex justify-content-between"> |
||||||
|
<% if root.children.present? %> |
||||||
|
<div class="accordion-button collapsed m-0 p-0" data-bs-toggle="collapse" data-bs-target="#<%= ["subjectsOffCanvasAccordion", root.id].join %>" |
||||||
|
data-controller="subjects" data-subject-parent-id="<%= root.id %>" |
||||||
|
data-accordion-target="#<%= ['subjectsOffCanvasAccordionBody', root.id].join %>" |
||||||
|
data-action="click->subjects#loadSubjectsOffcanvasAccordion"> |
||||||
|
<%= link_to root.name, "#", class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link", |
||||||
|
data: { controller: "application", href: search_documents_path(subject_ids: root.id, is_index_table: true), action: "click->application#openLink" } %> |
||||||
|
</div> |
||||||
|
<% else %> |
||||||
|
<%= link_to root.name, search_documents_path(subject_ids: root.id, is_index_table: true), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link", |
||||||
|
data: { controller: "application", href: search_documents_path(subject_ids: root.id, is_index_table: true), action: "click->application#openLink" } %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="accordion-collapse collapse" id="<%= ["subjectsOffCanvasAccordion", root.id].join %>" data-bs-parent="#subjectsOffCanvasMainAccordion"> |
||||||
|
<div class="accordion-body pt-1 pb-1 sub-body1" id="<%= ["subjectsOffCanvasAccordionBody", root.id].join %>"> |
||||||
|
<div class="text-center"> |
||||||
|
<div class="spinner-border text-danger" role="status"> |
||||||
|
<span class="visually-hidden">Loading...</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -1,93 +0,0 @@ |
|||||||
<div class="accordion-collapse collapse" id="<%= opts[:main_sub_menu] %>" data-bs-parent="#sidenav"> |
|
||||||
<div class="accordion-body pb-0 pe-0 pt-0"> |
|
||||||
<% Cdao::Subject.roots.order(name: :asc).each do |root| %> |
|
||||||
<div class="accordion accordion-flush ps-20" id="firstLevelSubMenu"> |
|
||||||
<div class="accordion-item bg-transparent"> |
|
||||||
<div class="accordion-header bg-transparent"> |
|
||||||
<% if root.children.present? %> |
|
||||||
<button class="<%= root.children.present? ? 'accordion-button' : '' %> collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:second_sub_menu], root.id].join %>"> |
|
||||||
<%= link_to root.name, index_url(root.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub1 clickable-link" %> |
|
||||||
</button> |
|
||||||
<% else %> |
|
||||||
<%= link_to root.name, index_url(root.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub1 clickable-link" %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<% if root.children.present? %> |
|
||||||
<div class="accordion-collapse collapse" id="<%= [opts[:second_sub_menu], root.id].join %>" data-bs-parent="#firstLevelSubMenu"> |
|
||||||
<div class="accordion-body pb-0 pe-0 pt-0"> |
|
||||||
<% root.children.order(name: :asc).each do |sub1| %> |
|
||||||
<div class="accordion accordion-flush ps-20" id="secondLevelSubMenu"> |
|
||||||
<div class="accordion-item bg-transparent"> |
|
||||||
<div class="accordion-header bg-transparent"> |
|
||||||
<% if sub1.children.present? %> |
|
||||||
<button class="<%= sub1.children.present? ? 'accordion-button' : '' %> collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:third_sub_menu], sub1.id].join %>"> |
|
||||||
<%= link_to sub1.name, index_url(sub1.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub2 clickable-link" %> |
|
||||||
</button> |
|
||||||
<% else %> |
|
||||||
<%= link_to sub1.name, index_url(sub1.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub2 clickable-link" %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= [opts[:third_sub_menu], sub1.id].join %>" data-bs-parent="#secondLevelSubMenu"> |
|
||||||
<div class="accordion-body pb-0 pe-0 pt-0"> |
|
||||||
<% sub1.children.order(name: :asc).each do |sub2| %> |
|
||||||
<div class="accordion accordion-flush" id="thirdLevelSubMenu"> |
|
||||||
<div class="accordion-item bg-transparent"> |
|
||||||
<div class="accordion-header bg-transparent"> |
|
||||||
<% if sub2.children.present? %> |
|
||||||
<button class="<%= sub2.children.present? ? 'accordion-button' : '' %> collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:fourth_sub_menu], sub2.id].join %>"> |
|
||||||
<%= link_to sub2.name, index_url(sub2.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub3 clickable-link" %> |
|
||||||
</button> |
|
||||||
<% else %> |
|
||||||
<%= link_to sub2.name, index_url(sub2.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub3 clickable-link" %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= [opts[:fourth_sub_menu], sub2.id].join %>" data-bs-parent="#thirdLevelSubMenu"> |
|
||||||
<div class="accordion-body pb-0 pe-0 pt-0"> |
|
||||||
<% sub2.children.order(name: :asc).each do |sub3| %> |
|
||||||
<div class="accordion accordion-flush ps-20" id="fourthLevelSubMenu"> |
|
||||||
<div class="accordion-item bg-transparent"> |
|
||||||
<div class="accordion-header"> |
|
||||||
<% if sub3.children.present? %> |
|
||||||
<button class="accordion-button collapsed bg-transparent" type="button" data-bs-toggle="collapse" data-bs-target="#<%= [opts[:fifth_sub_menu], sub3.id].join %>"> |
|
||||||
<%= link_to sub3.name, index_url(sub3.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub4 clickable-link" %> |
|
||||||
</button> |
|
||||||
<% else%> |
|
||||||
<%= link_to sub3.name, index_url(sub3.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub4 clickable-link" %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="accordion-collapse collapse" id="<%= [opts[:fifth_sub_menu], sub3.id].join %>" data-bs-parent="#fourthLevelSubMenu"> |
|
||||||
<div class="accordion-body pb-0 pe-0 pt-0"> |
|
||||||
<% sub3.children.order(name: :asc).each do |sub4| %> |
|
||||||
<div class="accordion-item bg-transparent"> |
|
||||||
<div class="accordion-header"> |
|
||||||
<%= link_to sub4.name, index_url(sub4.id), class: "accordion-link text-white text-decoration-none text-dark d-block sub5 clickable-link" %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end if sub3.children.present? %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end if sub2.children.present? %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end if sub1.children.present? %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end if root.children.present? %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<% end if Cdao::Subject.roots.present? %> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
@ -0,0 +1,21 @@ |
|||||||
|
module AnnotationSearch |
||||||
|
def annotation_search(search_params) |
||||||
|
fulltext_fields = %i[phil_rep].freeze |
||||||
|
|
||||||
|
search = ::Annotation.search do |
||||||
|
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? |
||||||
|
|
||||||
|
%i[doctrine_id document_id].each do |field| |
||||||
|
with field, search_params[field] if search_params[field].present? |
||||||
|
end |
||||||
|
|
||||||
|
order_by :library_rank, :asc |
||||||
|
order_by :search_year, :desc |
||||||
|
order_by :search_doc_date, :desc |
||||||
|
|
||||||
|
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20 |
||||||
|
end |
||||||
|
|
||||||
|
search |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,70 @@ |
|||||||
|
module DocumentSearch |
||||||
|
def document_search(search_params) |
||||||
|
search_params.each { |k, v| params[k] = v.gsub(/“|”/, '"') if v.is_a?(String) } |
||||||
|
fulltext_fields = %i[reference_number title short_title].freeze |
||||||
|
|
||||||
|
search = Cdao::Document.search do |
||||||
|
fulltext search_params[:q], fields: fulltext_fields, query_phrase_slop: 1 if search_params[:q].present? |
||||||
|
|
||||||
|
fulltext_fields.each do |field| |
||||||
|
fulltext search_params[field], fields: [field], query_phrase_slop: 1 if search_params[field].present? |
||||||
|
end |
||||||
|
|
||||||
|
with(:year, search_params[:year].to_i) if search_params[:year].present? |
||||||
|
|
||||||
|
without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present? |
||||||
|
|
||||||
|
with(:citation_finders_names).any_of(sanitize_citer_finder_param(search_params[:citation_finder])) if search_params[:citation_finder].present? |
||||||
|
|
||||||
|
if search_params[:sort_by].blank? |
||||||
|
order_by :search_year, :desc |
||||||
|
order_by :search_doc_date, :desc |
||||||
|
order_by :reference_number, :desc |
||||||
|
end |
||||||
|
|
||||||
|
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20 |
||||||
|
end |
||||||
|
|
||||||
|
search |
||||||
|
end |
||||||
|
|
||||||
|
def sanitize_citer_finder_param(citation_finder_param) |
||||||
|
citation_finder = [] |
||||||
|
params_vol = [] |
||||||
|
params_type = [] |
||||||
|
params_page = [] |
||||||
|
params[:citation_finder].scan(/\b((\d+\-?\w?)\s(SCRA|PhilRep|Phil|\S+)\.?,?\s?([-,\d\s]+)?)\b/i).map do |cit_fin| |
||||||
|
params_vol << cit_fin[1].gsub(/\s+/, "").gsub(/\A0*/, "") |
||||||
|
params_type.concat(case cit_fin[2] |
||||||
|
when /SCRA/i |
||||||
|
["SCRA"] |
||||||
|
when /(PhilRep|Phil)\.?,?/i |
||||||
|
["Phil"] |
||||||
|
else |
||||||
|
[] |
||||||
|
end |
||||||
|
) |
||||||
|
cit_fin[3].scan(/\d+-?\d*/).each do |page| |
||||||
|
if page.match?(/-/) |
||||||
|
page_range = [] |
||||||
|
page.scan(/\d+?\d*/).each do |each_page| |
||||||
|
page_range << each_page.to_i |
||||||
|
end |
||||||
|
params_page.concat((page_range[0]..page_range[1]).to_a) |
||||||
|
else |
||||||
|
params_page << page.to_i if params_page.index(page.to_i).blank? |
||||||
|
end |
||||||
|
end if cit_fin[3].present? |
||||||
|
end |
||||||
|
|
||||||
|
params_type.compact.each do |type| |
||||||
|
citation_finder << "#{params_vol[0] if params_vol.present?} #{type}" if params_page.blank? |
||||||
|
params_page.compact.uniq.each do |page| |
||||||
|
citation_finder << "#{params_vol[0] if params_vol.present?} #{type} #{page}" |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
return [] if citation_finder.blank? |
||||||
|
citation_finder |
||||||
|
end |
||||||
|
end |
||||||
@ -1,30 +1,78 @@ |
|||||||
module JurisprudenceSearch |
module JurisprudenceSearch |
||||||
def jurisprudence_search(search_params) |
def jurisprudence_search(search_params) |
||||||
|
search_params.each { |k, v| params[k] = v.gsub(/“|”/, '"') if v.is_a?(String) } |
||||||
fulltext_fields = %i[reference_number title short_title].freeze |
fulltext_fields = %i[reference_number title short_title].freeze |
||||||
|
|
||||||
search = Cdao::Jurisprudence.search do |
search = Cdao::Jurisprudence.search do |
||||||
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? |
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? |
||||||
|
|
||||||
fulltext_fields.each do |field| |
%i[reference_number title short_title].each do |field| |
||||||
fulltext search_params[field], fields: [field] if search_params[field].present? |
fulltext search_params[field], fields: [field], query_phrase_slop: 1 if search_params[field].present? |
||||||
end |
end |
||||||
|
|
||||||
with(:year, search_params[:year].to_i) if search_params[:year].present? |
if search_params[:year_start].present? && search_params[:year_end].present? |
||||||
|
with(:year).between(search_params[:year_start].to_i..search_params[:year_start].to_i) |
||||||
|
end |
||||||
|
|
||||||
|
if search_params[:year_start].present? && search_params[:year_end].blank? |
||||||
|
with(:year, search_params[:year_start].to_i) |
||||||
|
end |
||||||
|
|
||||||
with(:subject_ids).any_of(search_params[:subject_ids].split(",").map(&:strip).map(&:to_i)) if search_params[:subject_ids].present? |
with(:subject_ids).any_of(search_params[:subject_ids].split(",").map(&:strip).map(&:to_i)) if search_params[:subject_ids].present? |
||||||
|
|
||||||
with(:citation_finders_names).any_of(search_params[:citation_finder]) if search_params[:citation_finder].present? |
with(:citation_finders_names).any_of(sanitize_citer_finder_param(search_params[:citation_finder])) if search_params[:citation_finder].present? |
||||||
|
|
||||||
without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present? |
without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present? |
||||||
|
|
||||||
with(:is_only_in_premium_libraries, false) |
|
||||||
|
|
||||||
order_by :doc_date, :desc |
|
||||||
order_by :year, :desc |
|
||||||
|
|
||||||
|
if search_params[:sort_by].blank? |
||||||
|
order_by :search_year, :desc |
||||||
|
order_by :search_doc_date, :desc |
||||||
|
order_by :reference_number, :desc |
||||||
|
end |
||||||
|
|
||||||
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20 |
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20 |
||||||
end |
end |
||||||
|
|
||||||
search |
search |
||||||
end |
end |
||||||
|
|
||||||
|
def sanitize_citer_finder_param(citation_finder_param) |
||||||
|
citation_finder = [] |
||||||
|
params_vol = [] |
||||||
|
params_type = [] |
||||||
|
params_page = [] |
||||||
|
params[:citation_finder].scan(/\b((\d+\-?\w?)\s(SCRA|PhilRep|Phil|\S+)\.?,?\s?([-,\d\s]+)?)\b/i).map do |cit_fin| |
||||||
|
params_vol << cit_fin[1].gsub(/\s+/, "").gsub(/\A0*/, "") |
||||||
|
params_type.concat(case cit_fin[2] |
||||||
|
when /SCRA/i |
||||||
|
["SCRA"] |
||||||
|
when /(PhilRep|Phil)\.?,?/i |
||||||
|
["Phil"] |
||||||
|
else |
||||||
|
[] |
||||||
|
end |
||||||
|
) |
||||||
|
cit_fin[3].scan(/\d+-?\d*/).each do |page| |
||||||
|
if page.match?(/-/) |
||||||
|
page_range = [] |
||||||
|
page.scan(/\d+?\d*/).each do |each_page| |
||||||
|
page_range << each_page.to_i |
||||||
|
end |
||||||
|
params_page.concat((page_range[0]..page_range[1]).to_a) |
||||||
|
else |
||||||
|
params_page << page.to_i if params_page.index(page.to_i).blank? |
||||||
|
end |
||||||
|
end if cit_fin[3].present? |
||||||
|
end |
||||||
|
|
||||||
|
params_type.compact.each do |type| |
||||||
|
citation_finder << "#{params_vol[0] if params_vol.present?} #{type}" if params_page.blank? |
||||||
|
params_page.compact.uniq.each do |page| |
||||||
|
citation_finder << "#{params_vol[0] if params_vol.present?} #{type} #{page}" |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
return [] if citation_finder.blank? |
||||||
|
citation_finder |
||||||
|
end |
||||||
end |
end |
||||||
|
|||||||
@ -1,7 +1,12 @@ |
|||||||
class Document::DoctrinesController < ApplicationController |
class Document::DoctrinesController < ApplicationController |
||||||
|
include AnnotationSearch |
||||||
|
|
||||||
load_and_authorize_resource :document, class: "Cdao::Jurisprudence" |
load_and_authorize_resource :document, class: "Cdao::Jurisprudence" |
||||||
load_and_authorize_resource :doctrine, class: "Doctrine", through: :document |
load_and_authorize_resource :doctrine, class: "Doctrine", through: :document |
||||||
|
|
||||||
|
|
||||||
def show; end |
def show |
||||||
|
search = annotation_search({ doctrine_id: @doctrine.id }) |
||||||
|
@annotations = search.results |
||||||
|
end |
||||||
end |
end |
||||||
|
|||||||
@ -1,52 +0,0 @@ |
|||||||
class Jurisprudence::DoctrinesController < ApplicationController |
|
||||||
load_and_authorize_resource :jurisprudence, class: "Cdao::Jurisprudence" |
|
||||||
load_and_authorize_resource :doctrine, class: "Doctrine", through: :jurisprudence |
|
||||||
|
|
||||||
def create |
|
||||||
attrs = resource_params.to_unsafe_h.deep_symbolize_keys |
|
||||||
subject_ids = attrs.delete(:subject_ids) |
|
||||||
|
|
||||||
@doctrine = @jurisprudence.doctrines.new(attrs) |
|
||||||
|
|
||||||
respond_to do |format| |
|
||||||
if @doctrine.save |
|
||||||
@doctrine.subject_ids = subject_ids if subject_ids.present? |
|
||||||
|
|
||||||
format.html { redirect_to document_doctrine_path(@jurisprudence, @doctrine), notice: "Doctrine was successfully created." } |
|
||||||
else |
|
||||||
format.html { redirect_to document_doctrine_path(@jurisprudence) } |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
def update |
|
||||||
attrs = resource_params.to_unsafe_h.deep_symbolize_keys |
|
||||||
subject_ids = attrs.delete(:subject_ids) |
|
||||||
|
|
||||||
respond_to do |format| |
|
||||||
if @doctrine.update(attrs) |
|
||||||
@doctrine.subject_ids = subject_ids if subject_ids.present? |
|
||||||
|
|
||||||
format.html { redirect_to document_doctrine_path(@jurisprudence, @doctrine), notice: "Doctrine was successfully updated." } |
|
||||||
else |
|
||||||
format.html { redirect_to document_doctrine_path(@jurisprudence) } |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
def destroy |
|
||||||
respond_to do |format| |
|
||||||
if @doctrine.destroy |
|
||||||
format.html { redirect_to document_path(@jurisprudence), notice: "Doctrine was successfully destroyed." } |
|
||||||
else |
|
||||||
format.html { redirect_to document_path(@jurisprudence), alert: @doctrine.errors.full_messages } |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
private |
|
||||||
|
|
||||||
def resource_params |
|
||||||
params.permit(:content, subject_ids: []) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -0,0 +1,17 @@ |
|||||||
|
class ReportsController < ApplicationController |
||||||
|
include DoctrineSearch |
||||||
|
|
||||||
|
def index |
||||||
|
authorize! :display, Doctrine |
||||||
|
|
||||||
|
search = doctrine_search(search_params) |
||||||
|
@results = search.results |
||||||
|
@users = User.all |
||||||
|
end |
||||||
|
|
||||||
|
private |
||||||
|
|
||||||
|
def search_params |
||||||
|
params.permit(:created_at, :created_at_start, :created_at_end, :q, :page, :per_page, exclude_ids: [], subject_ids: [], user_ids: []) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
import ApplicationController from './application_controller' |
||||||
|
export default class extends ApplicationController { |
||||||
|
static targets = ["q", "headnote", "date_created"] |
||||||
|
|
||||||
|
connect () { |
||||||
|
super.connect() |
||||||
|
} |
||||||
|
|
||||||
|
search () { |
||||||
|
var $search_box = $('.advanced-search-box'),
|
||||||
|
search_params = { q: this.qTarget.value, headnote: this.headnoteTarget.value,
|
||||||
|
subject_ids: $search_box.find("select[name='subject_ids[]']").val(), |
||||||
|
user_ids: $search_box.find("select[name='user_ids[]']").val() } |
||||||
|
|
||||||
|
this.stimulate("ReportsReflex#render_search_results", search_params) |
||||||
|
} |
||||||
|
} |
||||||
|
After Width: | Height: | Size: 508 KiB |
|
After Width: | Height: | Size: 867 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 30 KiB |
@ -0,0 +1,144 @@ |
|||||||
|
(function ($) { |
||||||
|
'use strict'; |
||||||
|
$.fn.footnotes = function () { |
||||||
|
var a, b, c; |
||||||
|
a = $(this), b = a.find('a[href^="#footnote"]') |
||||||
|
c = a.find('p>span, p>a[href^="#fn"]>span').filter(function() { |
||||||
|
return ($(this).css('color') == 'rgb(255, 0, 0)') |
||||||
|
}) |
||||||
|
|
||||||
|
b.each(function(){ |
||||||
|
var $this = $(this); |
||||||
|
if($this.anchor_check()){ |
||||||
|
if(!$this.parent('span.footnote-x').length){ |
||||||
|
// Wrap the anchor with 'footnote-x'
|
||||||
|
$this.wrap('<span class="footnote-x"></span>') |
||||||
|
} |
||||||
|
} |
||||||
|
}) |
||||||
|
// Append index to every anchor
|
||||||
|
b = a.find('span.footnote-x a[href^="#footnote"]') |
||||||
|
b.each(function(){ |
||||||
|
var $this = $(this); |
||||||
|
var $matches = $($this.prop("tagName") + '#' + $this.attr("id") + ':not([data-index])') |
||||||
|
var index = 0; |
||||||
|
$matches.each(function(){ |
||||||
|
$(this).attr('id', $(this).attr('id') + '_' + index) |
||||||
|
$(this).attr('name', $(this).attr('name') + '_' + index) |
||||||
|
$(this).attr('href', $(this).attr('href') + '_' + index) |
||||||
|
$(this).attr('data-index', index) |
||||||
|
index = index + 1; |
||||||
|
}) |
||||||
|
}) |
||||||
|
c.each(function(){ |
||||||
|
var $this = $(this) |
||||||
|
$this.footnote_check() |
||||||
|
}) |
||||||
|
c = a.find('a[href^="#fn"]') |
||||||
|
c.each(function(){ |
||||||
|
var $this = $(this); |
||||||
|
var $matches = $($this.prop("tagName") + '#' + $this.attr("id") + ':not([data-index])') |
||||||
|
var index = 0; |
||||||
|
$matches.each(function(){ |
||||||
|
var self, parent |
||||||
|
self = $(this), parent = self.parent() |
||||||
|
self.closest('p').find('#cdasiatab').detach() |
||||||
|
self.attr('id', self.attr('id') + '_' + index) |
||||||
|
self.attr('name', self.attr('name') + '_' + index) |
||||||
|
self.attr('href', self.attr('href') + '_' + index) |
||||||
|
self.attr('data-index', index) |
||||||
|
parent.is('a') ? parent.replaceWith(self) : parent.closest('a').replaceWith(parent) // Remove parent its parent 'a' tag
|
||||||
|
index = index + 1; |
||||||
|
}) |
||||||
|
}) |
||||||
|
} |
||||||
|
$.fn.anchor_check = function () { |
||||||
|
var a, b, c, d; |
||||||
|
a = $(this), b = a.attr('href'), c = $.trim(a.text()) |
||||||
|
if(!$.isNumeric($.trim(c)) && c != '*' && c != 'n'){return false} |
||||||
|
if($.trim(b) && a.is('[href^="#footnote"]')){ |
||||||
|
// Check whether href, name and text is valid
|
||||||
|
var a_href_id = a.attr('href').substring(9) // Get only the value after '#footnote'
|
||||||
|
var a_name_id = a.attr('name') ? a.attr('name').substring(2) : a_href_id // Get only the value after 'fn' if name attr is present if not return a_href_id
|
||||||
|
var a_id = a.attr('id') ? a.attr('id').substring(2) : '' |
||||||
|
if(a_href_id != a_name_id || a_href_id != c || a_id != c || a_name_id != c){ |
||||||
|
a.attr('href', '#footnote' + c), a.attr('id', 'fn' + c), a.attr('name', 'fn' + c) |
||||||
|
} |
||||||
|
}else{ |
||||||
|
// If anchor to footnote is invalid by href=#footnote*** or no href
|
||||||
|
// the text inside the 'a' tag will use as a reference
|
||||||
|
a.attr('href', '#footnote' + c), a.attr('id', 'fn' + c), a.attr('name', 'fn' + c) |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
$.fn.footnote_check = function () { |
||||||
|
var a, b, c, d; |
||||||
|
a = $(this), d = null |
||||||
|
if(a.find('a:not([href^="#footnote"])').length){ |
||||||
|
a.find('a').each(function(){ |
||||||
|
b = $.trim($(this).text()), c = b.match(/([\*]{1,3}|[\d]{1,3})/) |
||||||
|
if(c!= null){ |
||||||
|
c = c[0] |
||||||
|
d = $(document.createElement('a')) |
||||||
|
d.text(b), d.attr('href', '#fn' + c), d.attr('id', 'footnote' + c), d.attr('name', 'footnote' + c), d.addClass('m-r-lg'), d.css('color', 'red') |
||||||
|
a.html(''), a.append(d) |
||||||
|
return true; |
||||||
|
} |
||||||
|
}) |
||||||
|
if(d=null){ |
||||||
|
return false |
||||||
|
} |
||||||
|
}else if(!a.find('a').length){ |
||||||
|
b = $.trim(a.text()), c = b.match(/([\*]{1,3}|[\d]{1,3})/) |
||||||
|
if(c!= null){ |
||||||
|
c = c[0] |
||||||
|
d = $(document.createElement('a')) |
||||||
|
d.text(b), d.attr('href', '#fn' + c), d.attr('id', 'footnote' + c), d.attr('name', 'footnote' + c), d.addClass('m-r-lg'), d.css('color', 'red') |
||||||
|
a.html(''), a.append(d) |
||||||
|
}else{ |
||||||
|
return false |
||||||
|
} |
||||||
|
} |
||||||
|
return true |
||||||
|
} |
||||||
|
$.fn.footnote = function () { |
||||||
|
var a = $(this) |
||||||
|
// Validation of footnote
|
||||||
|
var b, c, d; |
||||||
|
b = $(a.attr('href')) |
||||||
|
if(b.length<=0 && a.data('index')>0){ |
||||||
|
var a_id = a.attr('id').substring(0, a.attr('id').indexOf('_')) |
||||||
|
var a_like = $('a[href^="#footnote"][id^="' + a_id + '"]') |
||||||
|
var a_found = false; |
||||||
|
a_like.each(function(){ |
||||||
|
if(!a_found){b = $($(this).attr('href'))} |
||||||
|
a_found = b.length>0 |
||||||
|
}) |
||||||
|
} |
||||||
|
if(b.length>0){ |
||||||
|
c = b.closest('p') |
||||||
|
d = c.footnote_text(b.parent('span') || b), d = d.substring(0,499) + (d.length > 500 ? '...' : '') |
||||||
|
a.attr('data-original-title', d), a.attr('data-toggle', 'tooltip') |
||||||
|
a.tooltip({title: d}), a.tooltip('show') |
||||||
|
}else{ |
||||||
|
// typeof a._errorReport === "function" && a._errorReport({
|
||||||
|
// type: 'footnote',
|
||||||
|
// details: 'Footnote not found @ ' + a.attr('href')
|
||||||
|
// })
|
||||||
|
} |
||||||
|
return a |
||||||
|
} |
||||||
|
$.fn.footnote_text = function (except) { |
||||||
|
var a = ''; |
||||||
|
$(this).children().not(except).each(function(){ |
||||||
|
// Check first if the current select element not equal to except
|
||||||
|
var self = $(this) |
||||||
|
a += self.text() |
||||||
|
}) |
||||||
|
return a; |
||||||
|
} |
||||||
|
$(document).on('mouseover mouseenter focus', 'a[href^="#footnote"]', function(event){ |
||||||
|
event.preventDefault() |
||||||
|
$(this).footnote() |
||||||
|
}) |
||||||
|
}(jQuery)) |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
.advanced-search-box { |
||||||
|
padding: 20px; |
||||||
|
background: #525962; |
||||||
|
|
||||||
|
input { |
||||||
|
margin-bottom: 20px; |
||||||
|
} |
||||||
|
} |
||||||
|
.no-search-body { |
||||||
|
padding-top: 70px; |
||||||
|
|
||||||
|
.label-no-search { |
||||||
|
font-size: 30px; |
||||||
|
font-weight: 700; |
||||||
|
} |
||||||
|
|
||||||
|
.search-doc-icon { |
||||||
|
width: 157px; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
hr.simple { |
||||||
|
border: 1px dotted #000; |
||||||
|
border-style: none none dotted; |
||||||
|
color: #fff; |
||||||
|
background-color: #fff; |
||||||
|
} |
||||||
|
|
||||||
|
.doctrine-index-body { |
||||||
|
width: 98% !important; |
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
img.nav-bar-app-logo { |
||||||
|
width: 220px; |
||||||
|
} |
||||||
|
|
||||||
|
.active-red { |
||||||
|
background: #f75353; |
||||||
|
} |
||||||
|
|
||||||
|
.active-red a:hover { |
||||||
|
background: transparent; |
||||||
|
} |
||||||
|
|
||||||
|
.nav-body { |
||||||
|
box-shadow: 0 2px 2px rgb(0 0 0 / 5%), 0 1px 0 rgb(0 0 0 / 5%); |
||||||
|
background: #fff; |
||||||
|
} |
||||||
@ -0,0 +1,125 @@ |
|||||||
|
.offcanvas-contents { |
||||||
|
width: auto !important; |
||||||
|
min-width: 400px !important; |
||||||
|
box-shadow: 0 0 15px -5px #000 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.offcanvas-contents .offcanvas-item.accordion, .accordion-item { |
||||||
|
border: none !important; |
||||||
|
} |
||||||
|
|
||||||
|
.offcanvas-contents .offcanvas-item .accordion-button:not(.collapsed) { |
||||||
|
background-color: #fff; |
||||||
|
a { |
||||||
|
color: darkred !important; |
||||||
|
font-weight: 600; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.for-body-grid.sub-body1{ |
||||||
|
display: grid; |
||||||
|
grid-template-columns: 1fr 1fr; |
||||||
|
column-gap: 10px; |
||||||
|
// max-width: 500px; |
||||||
|
padding-left: 10px !important; |
||||||
|
} |
||||||
|
|
||||||
|
.for-body-grid.sub-body2{ |
||||||
|
display: grid; |
||||||
|
grid-template-columns: 1fr 1fr; |
||||||
|
column-gap: 10px; |
||||||
|
max-width: 600px; |
||||||
|
padding-left: 20px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.for-body-grid.sub-body3{ |
||||||
|
display: grid; |
||||||
|
grid-template-columns: 1fr 1fr; |
||||||
|
column-gap: 10px; |
||||||
|
max-width: 700px; |
||||||
|
padding-left: 30px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.for-body-grid.sub-body4{ |
||||||
|
display: grid; |
||||||
|
grid-template-columns: 1fr 1fr; |
||||||
|
column-gap: 10px; |
||||||
|
max-width: 800px; |
||||||
|
padding-left: 40px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.for-body-grid.sub-body5{ |
||||||
|
display: grid; |
||||||
|
grid-template-columns: 1fr 1fr; |
||||||
|
column-gap: 10px; |
||||||
|
max-width: 900px; |
||||||
|
padding-left: 50px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.for-body-grid.sub-body6{ |
||||||
|
display: grid; |
||||||
|
grid-template-columns: 1fr 1fr; |
||||||
|
column-gap: 10px; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 60px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.for-body-grid.sub-body7{ |
||||||
|
display: grid; |
||||||
|
grid-template-columns: 1fr 1fr; |
||||||
|
column-gap: 10px; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 70px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-body1{ |
||||||
|
width: auto; |
||||||
|
max-width: 1200px; |
||||||
|
padding-left: 10px !important; |
||||||
|
padding-right: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-body2{ |
||||||
|
width: auto; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 20px!important; |
||||||
|
padding-right: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-body3{ |
||||||
|
width: auto; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 30px!important; |
||||||
|
padding-right: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-body4{ |
||||||
|
width: auto; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 40px!important; |
||||||
|
padding-right: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-body5{ |
||||||
|
width: auto; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 50px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-body6{ |
||||||
|
width: auto; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 60px!important; |
||||||
|
padding-right: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-body7{ |
||||||
|
width: auto; |
||||||
|
max-width: 1000px; |
||||||
|
padding-left: 70px!important; |
||||||
|
} |
||||||
|
|
||||||
|
.offcanvas-header { |
||||||
|
border-bottom: 1px solid #0000004d; |
||||||
|
color: #00000099 !important; |
||||||
|
} |
||||||
@ -1,6 +1,19 @@ |
|||||||
.login-body-box .content-body { |
.login-body-box .content-body { |
||||||
padding: 26px; |
padding: 26px; |
||||||
background: #949494ba; |
background: #9494946b; |
||||||
box-shadow: 10px 5px 5px #e8e8e8; |
box-shadow: 10px 5px 5px #7a6346; |
||||||
border-radius: 4px; |
border-radius: 4px; |
||||||
} |
width: 380px; |
||||||
|
margin-left: 40px; |
||||||
|
} |
||||||
|
|
||||||
|
.login-logo { |
||||||
|
height: 100%; |
||||||
|
} |
||||||
|
|
||||||
|
.login-logo { |
||||||
|
.app-logo { |
||||||
|
width: 330px; |
||||||
|
margin-top: 15px; |
||||||
|
} |
||||||
|
} |
||||||
|
|||||||
@ -0,0 +1,38 @@ |
|||||||
|
.subject-body-index .accordion-item{ |
||||||
|
border-bottom: 1px solid #e5e5e5 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.subject-body-index .accordion-button:not(.collapsed) { |
||||||
|
background-color: #fff; |
||||||
|
a { |
||||||
|
color: darkred !important; |
||||||
|
font-weight: 600; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.subject-body-index .sub-body1 { |
||||||
|
max-width: 100% !important; |
||||||
|
padding-bottom: 0 !important; |
||||||
|
padding-left: 26px !important; |
||||||
|
padding-right: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.subject-body-index .sub-body2, .sub-body3, .sub-body4, .sub-body5, .sub-body6, .sub-body7 { |
||||||
|
max-width: 100% !important; |
||||||
|
padding-bottom: 0 !important; |
||||||
|
padding-right: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.non-toggle { |
||||||
|
margin-right: 65px !important; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-icon-add a { |
||||||
|
font-size: large; |
||||||
|
color: #4caf50; |
||||||
|
} |
||||||
|
|
||||||
|
.sub-icon-add a:hover { |
||||||
|
color: darkred; |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,66 @@ |
|||||||
|
class ParseLinkableContentJob < ActiveJob::Base |
||||||
|
queue_as :default |
||||||
|
|
||||||
|
def perform(annotation) |
||||||
|
content = "" |
||||||
|
document = annotation.document |
||||||
|
citing_docs = annotation.documents |
||||||
|
|
||||||
|
if annotation.content.present? |
||||||
|
content = annotation.content.gsub("<div>", "").gsub("</div>", "") |
||||||
|
|
||||||
|
contents = content.split(" citing ") |
||||||
|
contents.each_with_index do |content, i| |
||||||
|
linkable_content = nil |
||||||
|
if i.eql?(0) |
||||||
|
linkable_content = add_linkable_content(document.id, [content[i], clean_phil_rep(annotation)].reject(&:blank?).join(", ")) |
||||||
|
else |
||||||
|
citing_docs.each do |citing_doc| |
||||||
|
old_content = contents[i] |
||||||
|
next if !old_content.include?(citing_doc.clean_reference_number) |
||||||
|
|
||||||
|
linkable_content = add_linkable_content(citing_doc.id, old_content) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
contents[i] = linkable_content |
||||||
|
end |
||||||
|
|
||||||
|
content = contents.join(" citing ") |
||||||
|
else |
||||||
|
contents = [] |
||||||
|
doc_title = document.short_title || document.title |
||||||
|
doc_date_or_year = document.doc_date.present? ? document.doc_date.strftime("%B %d, %Y") : document.year |
||||||
|
doc_ref_num = document.clean_reference_number |
||||||
|
contents << add_linkable_content(document.id, [doc_title, doc_ref_num, doc_date_or_year, clean_phil_rep(annotation)].reject(&:blank?).join(", ")) |
||||||
|
|
||||||
|
if citing_docs.present? |
||||||
|
citing_docs.each do |citing_doc| |
||||||
|
citing_doc_title = citing_doc.short_title || citing_doc.title |
||||||
|
citing_doc_date_or_year = citing_doc.doc_date.present? ? citing_doc.doc_date.strftime("%B %d, %Y") : citing_doc.year |
||||||
|
citing_doc_ref_num = citing_doc.clean_reference_number |
||||||
|
|
||||||
|
citing_content = [citing_doc_title, citing_doc_date_or_year, citing_doc_ref_num].join(", ") |
||||||
|
contents << ["citing", add_linkable_content(citing_doc, citing_content)].join(" ") |
||||||
|
end |
||||||
|
end |
||||||
|
content = contents.join(", ") |
||||||
|
end |
||||||
|
|
||||||
|
annotation.update_column(:content, content) if content.present? |
||||||
|
annotation.index! |
||||||
|
end |
||||||
|
|
||||||
|
private |
||||||
|
def add_linkable_content(document_id, content) |
||||||
|
document_route = Rails.application.routes.url_helpers.document_path(document_id) |
||||||
|
|
||||||
|
"<a href='#{document_route}'> #{content} </a>" |
||||||
|
end |
||||||
|
|
||||||
|
def clean_phil_rep(annotation) |
||||||
|
return if annotation.phil_rep.blank? |
||||||
|
|
||||||
|
annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
class DoctrineJurisprudence < ApplicationRecord |
||||||
|
acts_as_list column: :rank, scope: %i[doctrine_id] |
||||||
|
|
||||||
|
belongs_to :doctrine, optional: false |
||||||
|
belongs_to :jurisprudence, class_name: "Cdao::Jurisprudence", optional: false |
||||||
|
|
||||||
|
end |
||||||
@ -1,8 +1,24 @@ |
|||||||
# frozen_string_literal: true |
# frozen_string_literal: true |
||||||
|
|
||||||
class AnnotationReflex < ApplicationReflex |
class AnnotationReflex < ApplicationReflex |
||||||
def render_document_search_results(results) |
include DocumentSearch |
||||||
opts = { is_citing_document: true } |
include AnnotationSearch |
||||||
morph "tbody#documentSearchResultTable", render(partial: "document_search_results_table", locals: { search_results: results, opts: opts }) |
|
||||||
|
def render_document_search_results(search_params) |
||||||
|
search = document_search(search_params.merge(sort_by: %w[reference_number_texts title_texts short_title_texts])) |
||||||
|
@documents = search.results |
||||||
|
opts = { current_page: search_params[:page], q: search_params[:q] } |
||||||
|
morph "#annotatedDocumentsSearchResults", render(partial: "/shared/annotated_documents_search_results", locals: { documents: @documents, opts: opts }) |
||||||
|
end |
||||||
|
|
||||||
|
def render_annotations_views(search_params) |
||||||
|
search = annotation_search(search_params) |
||||||
|
@annotations = search.results |
||||||
|
morph "#annotationsIndexView", render(partial: "/shared/annotations_index_view", locals: { annotations: @annotations, |
||||||
|
opts: { doctrine_id: search_params[:doctrine_id], current_page: search_params[:page] } }) |
||||||
|
end |
||||||
|
|
||||||
|
def render_default_case_lists_search(doctrine_id) |
||||||
|
morph "#caseListsCollapse", render(partial: "/shared/case_lists_no_results", locals: { doctrine_id: doctrine_id }) |
||||||
end |
end |
||||||
end |
end |
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue