Skip to content

Commit

Permalink
[GH-182] - Improved search results UI, CSS Refactoring and Cleanup (#185
Browse files Browse the repository at this point in the history
)

* 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>
  • Loading branch information
soufianerafik and github-actions[bot] authored Feb 3, 2025
1 parent f7e44bd commit 0ec8031
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 182 deletions.
157 changes: 32 additions & 125 deletions husky_directory/static/css/body.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
117 changes: 114 additions & 3 deletions husky_directory/static/css/print.css
Original file line number Diff line number Diff line change
@@ -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;
}
}
14 changes: 1 addition & 13 deletions husky_directory/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,11 @@
<meta name="robots" content="noarchive" />

<!-- Desktop -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.css"
type="text/css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.css" type="text/css"/>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/mini.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/body.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='assets/favicon.ico') }}">

<link rel="stylesheet" type="text/css" media="print" href="{{ url_for('static', filename='css/print.css') }}">

<style>
.btn.search:hover { color: black; }
/*------------ Workday changes --------- */
ul.dir-listing { list-style-type: none; padding: 0; }
ul.multiaddr, ul.title, ul.address { list-style-type: none; padding: 0; }
li.dir-boxstuff { padding-bottom: .6em }
/*------------ End Workday stuff-------*/
</style>
</head>

<body>
Expand Down
66 changes: 39 additions & 27 deletions husky_directory/templates/full_result.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
<h4>{{ person['name'] }}</h4>
<ul class="dir-listing">
{% for email in person['emails'] %}
<li>{{ email }}</li>
{% endfor %}
{% for contact_method, numbers in
person['phone_contacts'].items() %}
{% if numbers|length %}
<!-- Begin Person Card -->
<div class="person-card">
<!-- Full Name -->
<h4 class="person-name">{{ person['name'] }}</h4>
<!-- Departments -->
<ul class="no-style-list">
{% for entry in person['departments'] %}
<li>{{ entry.title }}, {{ entry.department }}</li>
{% endfor %}
</ul>
<ul class="dir-listing no-style-list">
<!-- Emails -->
{% if person['emails']|length %}
<li>
{{ contact_method|singularize|titleize }}:
{{ numbers|join(', ') }}
{% if person['emails']|length > 1 %}
Emails: {{ person['emails']|join(', ') }}
{% else %}
Email: {{ person['emails'][0] }}
{% endif %}
</li>
{% endif %}
{% endfor %}
{% if person['box_number'] %}
<li class="dir-boxstuff">Box {{ person['box_number'] }}</li>
{% endif %}
</ul>
<ul class="multiaddr">
{% for entry in person['departments'] %}
<li>{{ entry.title }}, {{ entry.department }}</li>
{% endfor %}
</ul>
<form method="POST" action="/person/vcard">
<input type="hidden" name="person_href" value="{{ person['href'] }}">
<input class="btn btn-primary"
type="submit"
name="expand-{{ person['href'] }}"
value="Download vcard">
</form>
<!-- Phones -->
{% for contact_method, numbers in person['phone_contacts'].items() %}
{% if numbers|length %}
<li>{{ contact_method|singularize|titleize }}: {{ numbers|join(', ') }}</li>
{% endif %}
{% endfor %}
<!-- Box Number -->
{% if person['box_number'] %}
<li class="person-box-number">Box {{ person['box_number'] }}</li>
{% endif %}
</ul>
<!-- Download vCard Button -->
<form method="POST" action="/person/vcard">
<input type="hidden" name="person_href" value="{{ person['href'] }}">
<input class="btn btn-primary"
type="submit"
name="expand-{{ person['href'] }}"
value="Download vcard">
</form>
</div>
<!-- End Person Card -->
2 changes: 0 additions & 2 deletions husky_directory/templates/full_results.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{# scenario: models.search.DirectoryQueryScenarioOutput #}
{% for scenario in search_result["scenarios"]%}
{% if scenario['num_results'] > 0 %}
<p>
{# population: str
# results: models.search.DirectoryQueryPopulationOutput
#}
Expand All @@ -16,6 +15,5 @@
{% endfor %}
{% endif %}
{% endfor %}
</p>
{% endif %}
{% endfor %}
Loading

0 comments on commit 0ec8031

Please sign in to comment.