From 0ec8031655732fb9733441f85d29e4052c6fa99b Mon Sep 17 00:00:00 2001 From: Soufiane <13897436+soufianerafik@users.noreply.github.com> Date: Mon, 3 Feb 2025 13:43:51 -0800 Subject: [PATCH] [GH-182] - Improved search results UI, CSS Refactoring and Cleanup (#185) * feat(frontend): Fix CSS issues and UI cleanups * feat(frontend): Remove unused css * [Bot] Update version to 2.4.1 * fix(frontend): extend "listing type" width * fix(frontend): Update email separator to ',' --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- husky_directory/static/css/body.css | 157 ++++-------------- husky_directory/static/css/print.css | 117 ++++++++++++- husky_directory/templates/base.html | 14 +- husky_directory/templates/full_result.html | 66 +++++--- husky_directory/templates/full_results.html | 2 - husky_directory/templates/links.html | 2 +- husky_directory/templates/result_count.html | 4 +- husky_directory/templates/search_options.html | 2 +- .../templates/summary_results_table/base.html | 2 +- .../scenario_population_block.html | 7 +- pyproject.toml | 2 +- tests/blueprints/test_search_blueprint.py | 2 +- 12 files changed, 195 insertions(+), 182 deletions(-) diff --git a/husky_directory/static/css/body.css b/husky_directory/static/css/body.css index 65633182..fd328857 100644 --- a/husky_directory/static/css/body.css +++ b/husky_directory/static/css/body.css @@ -261,12 +261,6 @@ img { .img-circle { border-radius: 50%; } -hr { - margin-top: 29px; - margin-bottom: 29px; - border: 0; - border-top: 1px solid #8e7bb1; -} .sr-only { position: absolute; width: 1px; @@ -3993,123 +3987,36 @@ label.screen-reader { background: url(http://www.washington.edu/static/home/wp-content/themes/uw-2014/assets/images/alert.png) no-repeat 0 -10px transparent; } } -@media print { - .uw-thinstrip, - #dawgdrops, - #quicklinks, - #uwsearcharea, - .uw-breadcrumbs, - .uw-hero-image, - .uw-hero-image:after, - .uw-hero-image:before, - .uw-news-image, - .site-news.single .uw-site-title, - .screen-reader-shortcut, - #wpadminbar, - #respond, - .uw-footer h4, - .uw-footer .footer-social, - .uw-footer > a, - .uw-footer { - display: none !important; - } - .uw-footer { - border-top: none; - } - .uw-footer ul.footer-links li a { - color: #fff !important; - } - .info-box { - margin-left: 0; - } - .widget { - padding-left: 0; - } - ul.uw-sidebar-menu { - margin-top: 0; - } - * { - text-shadow: none !important; - color: #000 !important; - background: transparent !important; - box-shadow: none !important; - position: static !important; - overflow: visible !important; - } - .site-regents p, - .site-regents a, - .site-regents li, - .site-regents td { - font-size: 14px !important; - line-height: 18px !important; - } - .site-regents h1 { - font-size: 23px !important; - } - .site-regents h2 { - font-size: 20px !important; - } - .site-regents h2.uw-site-title { - font-size: 40px !important; - } - .site-regents h3, - .site-regents h4 { - font-size: 17px !important; - } - a, - a:visited { - text-decoration: underline; - } - abbr[title]:after { - content: " (" attr(title) ")"; - } - pre, - blockquote { - border: 1px solid #999; - page-break-inside: avoid; - } - thead { - display: table-header-group; - } - tr, - img { - page-break-inside: avoid; - } - img { - max-width: 100% !important; - } - p, - h2, - h3 { - orphans: 3; - widows: 3; - } - h2, - h3 { - page-break-after: avoid; - } - select { - background: #fff !important; - } - .navbar { - display: none; - } - .table td, - .table th { - background-color: #fff !important; - } - .btn > .caret, - .dropup > .btn > .caret { - border-top-color: #000 !important; - } - .label { - border: 1px solid #000; - } - .table { - border-collapse: collapse !important; - } - .table-bordered th, - .table-bordered td { - border: 1px solid #ddd !important; - } + +.person-card { + background: #fff; + border: 1px solid #dfdfdf; + border-radius: 4px; + padding: 10px; + margin-bottom: 10px; +} + +.person-name { + margin: 0; +} + +.scenario-anchor, +.scenario-anchor-reference { + margin: 10px 0; +} + +.table-view-more-btn { + width: 100%; + height: 30px; + padding: inherit; +} + +.results-summary { + margin: 10px 0; +} + +.no-style-list { + list-style-type: none; + padding: 0; + margin: 0; } diff --git a/husky_directory/static/css/print.css b/husky_directory/static/css/print.css index db8e5f20..2d9e4582 100644 --- a/husky_directory/static/css/print.css +++ b/husky_directory/static/css/print.css @@ -1,5 +1,116 @@ -/****** Print Styles ******/ +/* + TODO: + - This print stylesheet was originally mixed into body.css, making it unnecessarily long and hard to maintain. + - Cleaned it up a bit, but it still needs further refactoring for better readability and maintainability. + - One approach worth considering is using a `.no-print` class in the HTML instead of explicitly listing elements here. + - Something like `@media print { .no-print { display: none !important; } }` would make it cleaner and easier to manage. +*/ -#wheader, .cblock, .rsummary, .mobileHeader, #footerMain, #footerMainNoPatch, .title, .btn-primary { - display: none; +@media print { + /* Hide unnecessary UI elements */ + .uw-thinstrip, #dawgdrops, #quicklinks, #uwsearcharea, .uw-breadcrumbs, + .uw-hero-image, .uw-hero-image:after, .uw-hero-image:before, .uw-news-image, + .site-news.single .uw-site-title, .screen-reader-shortcut, #wpadminbar, #respond, + .uw-footer h4, .uw-footer .footer-social, .uw-footer > a, .uw-footer, + .cblock, .results-summary, .title, .btn-primary, #view-more, .navbar, .view-more { + display: none !important; + } + + /* Footer cleanup */ + .uw-footer { + border-top: none; + } + + .uw-footer ul.footer-links li a { + color: #fff !important; + } + + /* Layout fixes */ + .info-box, .widget, ul.uw-sidebar-menu { + margin-left: 0; + padding-left: 0; + margin-top: 0; + } + + /* Reset styles for print */ + * { + text-shadow: none !important; + color: #000 !important; + background: transparent !important; + box-shadow: none !important; + position: static !important; + overflow: visible !important; + } + + /* Typography adjustments */ + .site-regents { + font-size: 14px !important; + line-height: 18px !important; + } + + .site-regents h1 { font-size: 23px !important; } + .site-regents h2 { font-size: 20px !important; } + .site-regents h2.uw-site-title { font-size: 40px !important; } + .site-regents h3, .site-regents h4 { font-size: 17px !important; } + + /* Link styles */ + a, a:visited { + text-decoration: underline; + } + + /* Abbreviation title formatting */ + abbr[title]:after { + content: " (" attr(title) ")"; + } + + /* Block elements */ + pre, blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + + /* Ensure headers remain at the top of pages */ + thead { + display: table-header-group; + } + + /* Prevent page break issues */ + tr, img { + page-break-inside: avoid; + } + + img { + max-width: 100% !important; + } + + p, h2, h3 { + orphans: 3; + widows: 3; + } + + h2, h3 { + page-break-after: avoid; + } + + /* Form and table styles */ + select { + background: #fff !important; + } + + .table, .table-bordered { + border-collapse: collapse !important; + } + + .table-bordered th, .table-bordered td { + border: 1px solid #ddd !important; + } + + /* Buttons and labels */ + .btn > .caret, .dropup > .btn > .caret { + border-top-color: #000 !important; + } + + .label { + border: 1px solid #000; + } } diff --git a/husky_directory/templates/base.html b/husky_directory/templates/base.html index 2469fa0e..72adf7a0 100644 --- a/husky_directory/templates/base.html +++ b/husky_directory/templates/base.html @@ -12,23 +12,11 @@ - + - - - diff --git a/husky_directory/templates/full_result.html b/husky_directory/templates/full_result.html index f073e70f..b19d81c6 100644 --- a/husky_directory/templates/full_result.html +++ b/husky_directory/templates/full_result.html @@ -1,30 +1,42 @@ -

{{ person['name'] }}

- + +
+ + +
+ + diff --git a/husky_directory/templates/full_results.html b/husky_directory/templates/full_results.html index 1d3330d4..333e045f 100644 --- a/husky_directory/templates/full_results.html +++ b/husky_directory/templates/full_results.html @@ -1,7 +1,6 @@ {# scenario: models.search.DirectoryQueryScenarioOutput #} {% for scenario in search_result["scenarios"]%} {% if scenario['num_results'] > 0 %} -

{# population: str # results: models.search.DirectoryQueryPopulationOutput #} @@ -16,6 +15,5 @@ {% endfor %} {% endif %} {% endfor %} -

{% endif %} {% endfor %} diff --git a/husky_directory/templates/links.html b/husky_directory/templates/links.html index d23e268d..8561f0b2 100644 --- a/husky_directory/templates/links.html +++ b/husky_directory/templates/links.html @@ -1,4 +1,4 @@ -
+

Pursuant to RCW 42.56, the UW is providing this directory information diff --git a/husky_directory/templates/result_count.html b/husky_directory/templates/result_count.html index 6ec53332..8cc6045a 100644 --- a/husky_directory/templates/result_count.html +++ b/husky_directory/templates/result_count.html @@ -1,4 +1,4 @@ -

+
{% if search_result['num_results'] > 0 %} {% for scenario in search_result['scenarios'] %} {% if scenario['num_results'] > 0 %} @@ -36,9 +36,7 @@ {% endif %} {% endfor %} -
{% endif %} {% endfor %} -
{% endif %}
diff --git a/husky_directory/templates/search_options.html b/husky_directory/templates/search_options.html index 09240e7c..f19493c8 100644 --- a/husky_directory/templates/search_options.html +++ b/husky_directory/templates/search_options.html @@ -52,7 +52,7 @@

Search options

{% if request_input is not blank %} {% set selected_length = request_input['render_length'] %} {% endif %} -
+

Kind of listing