From 1478f6ab38068a0dac8ab302c92eeb6540568d04 Mon Sep 17 00:00:00 2001 From: j-corry Date: Fri, 29 Nov 2024 14:57:20 +0000 Subject: [PATCH 1/3] - Further changes to EDM preliminary sentences: -- Move primary sponsor to before sponsor name -- Add comma after primary sponsor party -- Remove 'and tabled on' as it is now redundant --- app/views/search/preliminary_sentences/_edm.haml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/views/search/preliminary_sentences/_edm.haml b/app/views/search/preliminary_sentences/_edm.haml index bc65cbf..3fb15cc 100644 --- a/app/views/search/preliminary_sentences/_edm.haml +++ b/app/views/search/preliminary_sentences/_edm.haml @@ -3,16 +3,13 @@ .content-prelim-text#prelim-text %span>= object_display_name_link(object.object_name) - unless object.primary_sponsor.blank? - %span=" tabled by " + %span=" tabled by primary sponsor " %span>= search_link(object.primary_sponsor) - - if object.primary_sponsor_party.blank? - %span= " (primary sponsor)" - - else - %span= " (primary sponsor, " + - unless object.primary_sponsor_party.blank? + %span= " (" %span>= render 'search/fragments/list', items: object.primary_sponsor_party, terminator: '', singular: false - %span= ")" - %span= " and " - %span= " tabled on " + %span>= ")" + %span= ", on " %span>= format_date(object.date_tabled) %span= ", in the " %span= render 'search/fragments/list', items: object.legislature, terminator: '.', singular: false From afb8c2992da7a664d7042cf8d9ad3588a186f1d5 Mon Sep 17 00:00:00 2001 From: j-corry Date: Fri, 29 Nov 2024 17:12:55 +0000 Subject: [PATCH 2/3] - Add claw row to every search result --- app/assets/stylesheets/primary.css | 3 +-- app/assets/stylesheets/search_results.css | 19 ++++++++++++++ app/javascript/controllers/claw_controller.js | 11 +++++--- .../fragments/_about_this_result.html.erb | 2 +- .../search/fragments/_search_claw.html.erb | 26 +++++++++++++++++++ app/views/search/index.html.erb | 4 ++- app/views/search/results/_bill.html.erb | 3 +-- .../_church_of_england_measure.html.erb | 3 +-- .../search/results/_command_paper.html.erb | 3 +-- .../results/_committee_proceeding.html.erb | 3 +-- .../search/results/_deposited_paper.html.erb | 3 +-- .../search/results/_early_day_motion.html.erb | 3 +-- .../_european_deposited_document.html.erb | 3 +-- .../results/_european_material.html.erb | 3 +-- ...n_scrutiny_explanatory_memorandum.html.erb | 3 +-- ...rutiny_ministerial_correspondence.html.erb | 3 +-- ..._european_scrutiny_recommendation.html.erb | 3 +-- .../results/_formal_proceeding.html.erb | 3 +-- .../_grand_committee_proceeding.html.erb | 3 +-- .../results/_house_of_commons_paper.html.erb | 3 +-- .../results/_impact_assessment.html.erb | 3 +-- .../results/_ministerial_correction.html.erb | 3 +-- .../_observation_on_a_petition.html.erb | 3 +-- .../results/_oral_answer_to_question.html.erb | 3 +-- .../search/results/_oral_question.html.erb | 3 +-- .../_oral_question_time_intervention.html.erb | 3 +-- .../_paper_ordered_to_be_printed.html.erb | 3 +-- .../search/results/_paper_petition.html.erb | 3 +-- .../results/_parliamentary_committee.erb | 3 +-- .../_parliamentary_paper_laid.html.erb | 3 +-- .../_parliamentary_proceeding.html.erb | 3 +-- .../search/results/_private_act.html.erb | 3 +-- .../results/_proceeding_contribution.html.erb | 3 +-- app/views/search/results/_public_act.html.erb | 3 +-- .../results/_research_briefing.html.erb | 3 +-- .../results/_research_material.html.erb | 3 +-- .../results/_statutory_instrument.html.erb | 3 +-- app/views/search/results/_template.html.erb | 3 +-- ...t_and_works_act_order_application.html.erb | 3 +-- .../results/_unprinted_command_paper.html.erb | 3 +-- .../search/results/_unprinted_paper.html.erb | 3 +-- .../search/results/_written_question.html.erb | 3 +-- .../results/_written_statement.html.erb | 3 +-- 43 files changed, 94 insertions(+), 82 deletions(-) create mode 100644 app/views/search/fragments/_search_claw.html.erb diff --git a/app/assets/stylesheets/primary.css b/app/assets/stylesheets/primary.css index c68b211..aff064e 100644 --- a/app/assets/stylesheets/primary.css +++ b/app/assets/stylesheets/primary.css @@ -166,7 +166,7 @@ div.callout { /* Object view sections */ -#about-this-result { +.object-claw { border: 1px solid black; padding: 16px; @@ -409,7 +409,6 @@ table { padding: 4px 8px; cursor: pointer; font-size: small; - /*width: 250px;*/ &:hover { background: #f1f1f1; diff --git a/app/assets/stylesheets/search_results.css b/app/assets/stylesheets/search_results.css index baa6660..0ec309b 100644 --- a/app/assets/stylesheets/search_results.css +++ b/app/assets/stylesheets/search_results.css @@ -38,6 +38,25 @@ } } +.results-claw { + font-size: smaller; + + div.grid-container { + display: grid; + grid-template-columns: auto auto auto auto auto; + grid-template-rows: auto; + padding: 0; + margin-top: 4px; + column-gap: 12px; + row-gap: 12px; + + span { + align-content: center; + word-wrap: anywhere; + } + } +} + #search-results { width: 100%; diff --git a/app/javascript/controllers/claw_controller.js b/app/javascript/controllers/claw_controller.js index 2dd9b63..0bb73af 100644 --- a/app/javascript/controllers/claw_controller.js +++ b/app/javascript/controllers/claw_controller.js @@ -14,9 +14,12 @@ export default class extends Controller { } showClaw() { - const element = document.querySelector("#about-this-result"); - if (element) { - element.toggleAttribute("hidden"); - } + const all_elements = Array.from(document.getElementsByClassName('claw')); + + all_elements.forEach( + element => { + element.toggleAttribute("hidden"); + } + ) } } diff --git a/app/views/search/fragments/_about_this_result.html.erb b/app/views/search/fragments/_about_this_result.html.erb index 150e0cf..eac2b16 100644 --- a/app/views/search/fragments/_about_this_result.html.erb +++ b/app/views/search/fragments/_about_this_result.html.erb @@ -1,4 +1,4 @@ - \ No newline at end of file diff --git a/app/views/search/results/_church_of_england_measure.html.erb b/app/views/search/results/_church_of_england_measure.html.erb index a74a8a6..7b6fa78 100644 --- a/app/views/search/results/_church_of_england_measure.html.erb +++ b/app/views/search/results/_church_of_england_measure.html.erb @@ -47,5 +47,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_command_paper.html.erb b/app/views/search/results/_command_paper.html.erb index e1a441b..c2d74c0 100644 --- a/app/views/search/results/_command_paper.html.erb +++ b/app/views/search/results/_command_paper.html.erb @@ -100,5 +100,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_committee_proceeding.html.erb b/app/views/search/results/_committee_proceeding.html.erb index 29e246b..9b8d945 100644 --- a/app/views/search/results/_committee_proceeding.html.erb +++ b/app/views/search/results/_committee_proceeding.html.erb @@ -69,5 +69,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_deposited_paper.html.erb b/app/views/search/results/_deposited_paper.html.erb index e122be4..b67562f 100644 --- a/app/views/search/results/_deposited_paper.html.erb +++ b/app/views/search/results/_deposited_paper.html.erb @@ -82,5 +82,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_early_day_motion.html.erb b/app/views/search/results/_early_day_motion.html.erb index e76b4c1..fd6dde5 100644 --- a/app/views/search/results/_early_day_motion.html.erb +++ b/app/views/search/results/_early_day_motion.html.erb @@ -66,5 +66,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_european_deposited_document.html.erb b/app/views/search/results/_european_deposited_document.html.erb index 369a742..bab1be0 100644 --- a/app/views/search/results/_european_deposited_document.html.erb +++ b/app/views/search/results/_european_deposited_document.html.erb @@ -54,5 +54,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_european_material.html.erb b/app/views/search/results/_european_material.html.erb index 24b92b6..55167e0 100644 --- a/app/views/search/results/_european_material.html.erb +++ b/app/views/search/results/_european_material.html.erb @@ -45,5 +45,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_european_scrutiny_explanatory_memorandum.html.erb b/app/views/search/results/_european_scrutiny_explanatory_memorandum.html.erb index fa2406d..2bd3888 100644 --- a/app/views/search/results/_european_scrutiny_explanatory_memorandum.html.erb +++ b/app/views/search/results/_european_scrutiny_explanatory_memorandum.html.erb @@ -40,5 +40,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_european_scrutiny_ministerial_correspondence.html.erb b/app/views/search/results/_european_scrutiny_ministerial_correspondence.html.erb index b7a1e56..4657db4 100644 --- a/app/views/search/results/_european_scrutiny_ministerial_correspondence.html.erb +++ b/app/views/search/results/_european_scrutiny_ministerial_correspondence.html.erb @@ -40,5 +40,4 @@
- -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_european_scrutiny_recommendation.html.erb b/app/views/search/results/_european_scrutiny_recommendation.html.erb index 24c0b3f..714e951 100644 --- a/app/views/search/results/_european_scrutiny_recommendation.html.erb +++ b/app/views/search/results/_european_scrutiny_recommendation.html.erb @@ -39,5 +39,4 @@
- -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_formal_proceeding.html.erb b/app/views/search/results/_formal_proceeding.html.erb index 9929fec..de2dbeb 100644 --- a/app/views/search/results/_formal_proceeding.html.erb +++ b/app/views/search/results/_formal_proceeding.html.erb @@ -64,5 +64,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_grand_committee_proceeding.html.erb b/app/views/search/results/_grand_committee_proceeding.html.erb index 65edb1f..265ff8d 100644 --- a/app/views/search/results/_grand_committee_proceeding.html.erb +++ b/app/views/search/results/_grand_committee_proceeding.html.erb @@ -66,5 +66,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_house_of_commons_paper.html.erb b/app/views/search/results/_house_of_commons_paper.html.erb index 9feee01..e884095 100644 --- a/app/views/search/results/_house_of_commons_paper.html.erb +++ b/app/views/search/results/_house_of_commons_paper.html.erb @@ -90,5 +90,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_impact_assessment.html.erb b/app/views/search/results/_impact_assessment.html.erb index d31ee4f..73d0e3d 100644 --- a/app/views/search/results/_impact_assessment.html.erb +++ b/app/views/search/results/_impact_assessment.html.erb @@ -64,5 +64,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_ministerial_correction.html.erb b/app/views/search/results/_ministerial_correction.html.erb index b496e97..b052bb6 100644 --- a/app/views/search/results/_ministerial_correction.html.erb +++ b/app/views/search/results/_ministerial_correction.html.erb @@ -52,5 +52,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_observation_on_a_petition.html.erb b/app/views/search/results/_observation_on_a_petition.html.erb index 2b93750..5ecc541 100644 --- a/app/views/search/results/_observation_on_a_petition.html.erb +++ b/app/views/search/results/_observation_on_a_petition.html.erb @@ -68,5 +68,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_oral_answer_to_question.html.erb b/app/views/search/results/_oral_answer_to_question.html.erb index d8b4c9a..992c335 100644 --- a/app/views/search/results/_oral_answer_to_question.html.erb +++ b/app/views/search/results/_oral_answer_to_question.html.erb @@ -75,5 +75,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_oral_question.html.erb b/app/views/search/results/_oral_question.html.erb index 99f2cd9..b76f21f 100644 --- a/app/views/search/results/_oral_question.html.erb +++ b/app/views/search/results/_oral_question.html.erb @@ -94,5 +94,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_oral_question_time_intervention.html.erb b/app/views/search/results/_oral_question_time_intervention.html.erb index 73da940..14d0d96 100644 --- a/app/views/search/results/_oral_question_time_intervention.html.erb +++ b/app/views/search/results/_oral_question_time_intervention.html.erb @@ -63,5 +63,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_paper_ordered_to_be_printed.html.erb b/app/views/search/results/_paper_ordered_to_be_printed.html.erb index 0f4bdbc..b447174 100644 --- a/app/views/search/results/_paper_ordered_to_be_printed.html.erb +++ b/app/views/search/results/_paper_ordered_to_be_printed.html.erb @@ -89,5 +89,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_paper_petition.html.erb b/app/views/search/results/_paper_petition.html.erb index 2d356b6..002773f 100644 --- a/app/views/search/results/_paper_petition.html.erb +++ b/app/views/search/results/_paper_petition.html.erb @@ -50,5 +50,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_parliamentary_committee.erb b/app/views/search/results/_parliamentary_committee.erb index b8fa2a8..eda0b48 100644 --- a/app/views/search/results/_parliamentary_committee.erb +++ b/app/views/search/results/_parliamentary_committee.erb @@ -52,5 +52,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_parliamentary_paper_laid.html.erb b/app/views/search/results/_parliamentary_paper_laid.html.erb index 2d5b636..2959132 100644 --- a/app/views/search/results/_parliamentary_paper_laid.html.erb +++ b/app/views/search/results/_parliamentary_paper_laid.html.erb @@ -90,5 +90,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_parliamentary_proceeding.html.erb b/app/views/search/results/_parliamentary_proceeding.html.erb index 4a17f17..909d518 100644 --- a/app/views/search/results/_parliamentary_proceeding.html.erb +++ b/app/views/search/results/_parliamentary_proceeding.html.erb @@ -68,5 +68,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_private_act.html.erb b/app/views/search/results/_private_act.html.erb index 53d7add..91a372f 100644 --- a/app/views/search/results/_private_act.html.erb +++ b/app/views/search/results/_private_act.html.erb @@ -48,5 +48,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_proceeding_contribution.html.erb b/app/views/search/results/_proceeding_contribution.html.erb index 73da940..14d0d96 100644 --- a/app/views/search/results/_proceeding_contribution.html.erb +++ b/app/views/search/results/_proceeding_contribution.html.erb @@ -63,5 +63,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_public_act.html.erb b/app/views/search/results/_public_act.html.erb index f0d9af9..8edf6ab 100644 --- a/app/views/search/results/_public_act.html.erb +++ b/app/views/search/results/_public_act.html.erb @@ -51,5 +51,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_research_briefing.html.erb b/app/views/search/results/_research_briefing.html.erb index 38675ec..ecbede9 100644 --- a/app/views/search/results/_research_briefing.html.erb +++ b/app/views/search/results/_research_briefing.html.erb @@ -51,5 +51,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_research_material.html.erb b/app/views/search/results/_research_material.html.erb index 9789a0b..85e1333 100644 --- a/app/views/search/results/_research_material.html.erb +++ b/app/views/search/results/_research_material.html.erb @@ -26,5 +26,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_statutory_instrument.html.erb b/app/views/search/results/_statutory_instrument.html.erb index 978f227..92f3728 100644 --- a/app/views/search/results/_statutory_instrument.html.erb +++ b/app/views/search/results/_statutory_instrument.html.erb @@ -99,5 +99,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_template.html.erb b/app/views/search/results/_template.html.erb index 7a39088..499736a 100644 --- a/app/views/search/results/_template.html.erb +++ b/app/views/search/results/_template.html.erb @@ -127,5 +127,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_transport_and_works_act_order_application.html.erb b/app/views/search/results/_transport_and_works_act_order_application.html.erb index 7b9801c..217ca21 100644 --- a/app/views/search/results/_transport_and_works_act_order_application.html.erb +++ b/app/views/search/results/_transport_and_works_act_order_application.html.erb @@ -63,5 +63,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_unprinted_command_paper.html.erb b/app/views/search/results/_unprinted_command_paper.html.erb index 4bd96d4..e4e6ef6 100644 --- a/app/views/search/results/_unprinted_command_paper.html.erb +++ b/app/views/search/results/_unprinted_command_paper.html.erb @@ -94,5 +94,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_unprinted_paper.html.erb b/app/views/search/results/_unprinted_paper.html.erb index e777c3b..61e65bb 100644 --- a/app/views/search/results/_unprinted_paper.html.erb +++ b/app/views/search/results/_unprinted_paper.html.erb @@ -104,5 +104,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_written_question.html.erb b/app/views/search/results/_written_question.html.erb index 382d048..ebf3800 100644 --- a/app/views/search/results/_written_question.html.erb +++ b/app/views/search/results/_written_question.html.erb @@ -97,5 +97,4 @@ - -
\ No newline at end of file + \ No newline at end of file diff --git a/app/views/search/results/_written_statement.html.erb b/app/views/search/results/_written_statement.html.erb index da3abf7..8ee9b78 100644 --- a/app/views/search/results/_written_statement.html.erb +++ b/app/views/search/results/_written_statement.html.erb @@ -52,5 +52,4 @@ - -
\ No newline at end of file + \ No newline at end of file From b8d0330a40dfc8bd67859fc68ff1a5d02e0dd974 Mon Sep 17 00:00:00 2001 From: j-corry Date: Fri, 29 Nov 2024 17:17:32 +0000 Subject: [PATCH 3/3] - Add conditional wrapping to timestamp & object_uri items in search result claw to avoid errors where not present --- .../search/fragments/_search_claw.html.erb | 10 ++-- coverage/.resultset.json | 22 ++++----- coverage/index.html | 46 +++++++++---------- 3 files changed, 41 insertions(+), 37 deletions(-) diff --git a/app/views/search/fragments/_search_claw.html.erb b/app/views/search/fragments/_search_claw.html.erb index 83c4199..23f449e 100644 --- a/app/views/search/fragments/_search_claw.html.erb +++ b/app/views/search/fragments/_search_claw.html.erb @@ -1,10 +1,14 @@