Skip to content

Commit

Permalink
Unify search view for all search results
Browse files Browse the repository at this point in the history
  • Loading branch information
BreathingFlesh committed Dec 31, 2024
1 parent ee62c7a commit 3ffd2f6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 29 deletions.
77 changes: 48 additions & 29 deletions src/onegov/town6/templates/macros.pt
Original file line number Diff line number Diff line change
Expand Up @@ -1796,17 +1796,23 @@
</metal:bullets>

<metal:search_result_users define-macro="search_result_users" i18n:domain="onegov.town6">
<a href="${request.return_here(request.link(result))}">${result.title} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" /></a>
<ul>
<li>${translate(result.role.capitalize())}</li>
</ul>
<a href="${request.return_here(request.link(result))}" class="list-link">
<h5 class="list-title">${result.title} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" /></h5>
</a>
<p class="search-preview">
${translate(result.role.capitalize())}
</p>
</metal:search_result_users>


<metal:search_result_files define-macro="search_result_files" i18n:domain="onegov.town6">
<a href="${request.return_here(request.link(result))}">${result.name} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" /></a>
<ul>
<li>
<a class="list-link" href="${request.return_here(request.link(result))}">
<h5 class="list-title">
${result.name} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" />
</h5>
</a>
<a href="${request.return_here(request.link(result))}">
<p class="search-preview">
<tal:b condition="result.signed">
<span i18n:translate>Has a digital seal</span>,
</tal:b>
Expand All @@ -1819,36 +1825,49 @@
<tal:b i18n:name="count">${result.stats.get('pages', 0)}</tal:b> pages
</tal:b>
</span>
</li>
</ul>
</p>
</a>
</metal:search_result_files>


<metal:search_result_tickets define-macro="search_result_tickets" i18n:domain="onegov.town6">
<a href="${request.link(result)}">${result.number} <i title="This site is private" i18n:attributes="title" class="private-hint"></i></a>
<ul>
<li>${translate(result.group)}</li>
<li tal:content="result.title"></li>
<li tal:content="result.subtitle"></li>
</ul>
<a class="list-link" href="${request.link(result)}">
<h5 class="list-title">
${result.number}
<i title="This site is private" i18n:attributes="title" class="private-hint"></i>
</h5>
</a>
<a href="${request.link(result)}">
<p class="search-preview">
<tal:b>${translate(result.group)}</tal:b><br/>
<tal:b tal:content="result.title"></tal:b><br/>
<tal:b tal:content="result.subtitle"></tal:b>
</p>
</a>
</metal:search_result_tickets>


<metal:search_result_events define-macro="search_result_events" i18n:domain="onegov.town6">
<a href="${request.link(result, 'latest')}">${result.title} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" /></a>
<ul tal:define="latest result.latest_occurrence">
<li tal:condition="latest">
<a class="list-link" href="${request.link(result, 'latest')}">
<h5 class="list-title">
${result.title} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" />
</h5>
</a>
<p tal:define="latest result.latest_occurrence" class="search-preview">
<tal:b tal:condition="latest">
${
'{}, {} - {}'.format(
layout.format_date(latest.localized_start, 'event'),
layout.format_date(latest.localized_start, 'time'),
layout.format_date(latest.localized_end, 'time')
)
}
</li>
<li tal:condition="result.location">${result.location}</li>

<tal:b tal:condition="future_occ" tal:define="future_occ result.future_occurrences(offset=1).all()">
}<br/>
</tal:b>
<tal:b tal:condition="result.location">
${result.location}</tal:b>
</p>
<tal:b tal:condition="future_occ" tal:define="future_occ result.future_occurrences(offset=1).all()">
<ul>
<li><span i18n:translate="">Further occurrences:</span>
<div class="event-child-results">
<ul>
Expand All @@ -1867,17 +1886,17 @@
</tal:b>
</ul>
</div></li>
</tal:b>
</ul>
</ul>
</tal:b>
</metal:search_result_events>


<metal:search_result_people define-macro="search_result_people" i18n:domain="onegov.town6">
<a href="${request.link(result)}" class="list-link">
<h5 class="list-title">${result.title} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" /></h5>
</a>
<p class="list-lead preview" tal:condition="result.function|nothing">${result.function}</p>
<p class="list-lead preview" tal:condition="not:result.function|nothing" i18n:translate>People</p>
<p class="search-preview" tal:condition="result.function|nothing">${result.function}</p>
<p class="search-preview" tal:condition="not:result.function|nothing" i18n:translate>People</p>
</metal:search_result_people>


Expand All @@ -1886,7 +1905,7 @@
<span class="h5 list-title">${result.title} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" /></span>
</a>
<a tal:condition="result.lead" href="${result.url}">
<p class="list-lead preview">
<p class="search-preview">
${result.lead[:160]}<tal:b condition="len(result.lead) > 160">…</tal:b>
</p>
</a>
Expand All @@ -1899,7 +1918,7 @@
<h5 class="list-title">${result.title} <metal:hint use-macro="layout.macros['access_hint']" tal:define="item result" /></h5>
</a>
<a tal:condition="result.lead|None" href="${request.link(result)}">
<p class="list-lead preview">
<p class="search-preview">
${result.lead[:160]}<tal:b condition="len(result.lead) > 160">…</tal:b>
</p>
</a>
Expand Down
4 changes: 4 additions & 0 deletions src/onegov/town6/theme/styles/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,7 @@
font-size: .8rem;
padding: 0 3px;
}

.search-preview {
color: $jumbo;
}

0 comments on commit 3ffd2f6

Please sign in to comment.