-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from syslabcom/scrum-1990-search-template
Use results-listing in search
- Loading branch information
Showing
4 changed files
with
358 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,340 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
lang="en" | ||
metal:use-macro="context/@@main_template/macros/master" | ||
xml:lang="en" | ||
i18n:domain="plone" | ||
> | ||
|
||
<head> | ||
<metal:block metal:fill-slot="head_slot"> | ||
|
||
<link href="${context/@@plone_context_state/object_url}/search_rss?${request/QUERY_STRING}" | ||
rel="alternate" | ||
title="RSS 1.0" | ||
type="application/rss+xml" | ||
tal:condition="request/SearchableText|nothing" | ||
/> | ||
<link href="${view/navroot_url}" | ||
rel="home" | ||
title="Home" | ||
i18n:attributes="title" | ||
/> | ||
|
||
</metal:block> | ||
|
||
<metal:block fill-slot="top_slot" | ||
tal:define=" | ||
disable_column_one python:request.set('disable_plone.leftcolumn',1); | ||
disable_column_two python:request.set('disable_plone.rightcolumn',1); | ||
" | ||
/> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="content-core" | ||
metal:fill-slot="main" | ||
tal:define=" | ||
b_start python:0; | ||
b_start request/b_start | b_start; | ||
batch python: view.results(b_start=b_start); | ||
results batch; | ||
normalizeString nocall:context/@@plone/normalizeString; | ||
" | ||
> | ||
|
||
<form class="searchPage pat-formautofocus" | ||
id="searchform" | ||
action="@@search" | ||
name="searchform" | ||
role="search" | ||
tal:define=" | ||
portal context/@@plone_portal_state/portal; | ||
first_call not:request/advanced_search|nothing; | ||
st python:request.get('SearchableText', ''); | ||
DateTime python:modules['DateTime'].DateTime; | ||
navigation_root_url view/navroot_url; | ||
icons python:context.restrictedTraverse('@@iconresolver'); | ||
" | ||
> | ||
|
||
<input name="sort_on" | ||
type="hidden" | ||
value="" | ||
/> | ||
<input name="sort_order" | ||
type="hidden" | ||
value="" | ||
/> | ||
<input id="search-batch-start" | ||
name="b_start:int" | ||
type="hidden" | ||
value="${request/b_start|string:0}" | ||
/> | ||
<input id="advanced-search-input" | ||
name="advanced_search" | ||
type="hidden" | ||
value="${python: 'True' if view.show_advanced_search() else 'False'}" | ||
/> | ||
|
||
<div class="input-group"> | ||
<input class="searchPage form-control" | ||
name="SearchableText" | ||
size="25" | ||
title="Search Site" | ||
type="text" | ||
value="${st}" | ||
i18n:attributes="title title_search_title;" | ||
/> | ||
<span class="input-group-btn"> | ||
<input class="searchPage allowMultiSubmit btn btn-primary" | ||
type="submit" | ||
value="Search" | ||
i18n:attributes="value label_search;" | ||
/> | ||
</span> | ||
</div> | ||
|
||
<input name="created.range:record" | ||
type="hidden" | ||
value="min" | ||
/> | ||
|
||
<div class="mt-3"> | ||
<h1 id="search-term"> | ||
<span tal:condition="not:st" | ||
i18n:translate="" | ||
>Search results</span> | ||
<span tal:condition="st" | ||
i18n:translate="" | ||
> | ||
Search results for | ||
<span class="text-muted" | ||
tal:content="st" | ||
i18n:name="term" | ||
> | ||
Search Term | ||
</span> | ||
</span> | ||
</h1> | ||
</div> | ||
|
||
<div class="d-flex mb-2"> | ||
|
||
<div class="flex-fill"> | ||
<a class="nav-link active ps-2" | ||
aria-current="page" | ||
href="#" | ||
> | ||
<span class="d-flex" | ||
id="results-count" | ||
i18n:domain="plone" | ||
i18n:translate="batch_x_items_matching_your_criteria" | ||
> | ||
<span class="badge bg-primary me-2 d-flex justify-content-center align-items-center" | ||
id="search-results-number" | ||
tal:content="batch/sequence_length|string:0" | ||
i18n:name="number" | ||
>234</span> | ||
items matching your search terms. | ||
</span> | ||
</a> | ||
</div> | ||
|
||
<div class="nav-item dropdown" | ||
id="search-filter" | ||
> | ||
<a class="nav-link dropdown-toggle" | ||
id="search-filter-toggle" | ||
aria-expanded="false" | ||
href="#" | ||
role="button" | ||
data-bs-toggle="dropdown" | ||
i18n:translate="narrow_search_options" | ||
> | ||
Filter the results | ||
</a> | ||
<div class="dropdown-menu dropdown-menu-md-end"> | ||
<div class="d-flex text-nowrap"> | ||
<div class="mx-3"> | ||
<span class="fw-bold" | ||
i18n:translate="label_item_type" | ||
>Item type</span> | ||
<ul class="list-unstyled search-type-options" | ||
tal:define=" | ||
portal_types portal/portal_types; | ||
types_list view/types_list; | ||
all_checked python:(len(types_list) == len(request.get('portal_type', []))) or first_call; | ||
toggle_select_state python:all_checked and 'true' or 'false'; | ||
" | ||
> | ||
<li> | ||
<div class="form-check"> | ||
<input class="form-check-input" | ||
id="pt_toggle" | ||
checked="${python:'checked' if all_checked else ''}" | ||
name="pt_toggle" | ||
type="checkbox" | ||
value="#" | ||
/> | ||
<label class="form-check-label" | ||
for="pt_toggle" | ||
i18n:translate="label_toggle" | ||
>Select All/None</label> | ||
</div> | ||
</li> | ||
<li tal:repeat="type types_list"> | ||
<div class="form-check"> | ||
<input class="form-check-input" | ||
id="portal_type_${repeat/type/number}" | ||
checked="${python:'checked' if ((type in request.get('portal_type', [])) or first_call) else ''}" | ||
name="portal_type:list" | ||
type="checkbox" | ||
value="${type}" | ||
/> | ||
<label class="form-check-label" | ||
for="portal_type_${repeat/type/number}" | ||
tal:content="python: portal_types.getTypeInfo(type).Title()" | ||
i18n:translate="" | ||
></label> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="mx-3"> | ||
<span class="fw-bold" | ||
i18n:translate="label_new_items_since" | ||
>New items since</span> | ||
<ul class="list-unstyled" | ||
tal:define=" | ||
today python:DateTime().earliestTime(); | ||
yesterday python:(today-1).ISO(); | ||
lastweek python:(today-7).ISO(); | ||
lastmonth python:(today-31).ISO(); | ||
ever python:DateTime('1970-01-02').ISO(); | ||
checked python:request.get('created', {}).get('query', ever); | ||
" | ||
> | ||
<li> | ||
<div class="form-check"> | ||
<input class="form-check-input" | ||
id="query-date-yesterday" | ||
checked="${python:'checked' if checked==yesterday else ''}" | ||
name="created.query:record:date" | ||
type="radio" | ||
value="${yesterday}" | ||
/> | ||
<label class="form-check-label" | ||
for="query-date-yesterday" | ||
i18n:translate="time_yesterday" | ||
>Yesterday</label> | ||
</div> | ||
</li> | ||
<li> | ||
<div class="form-check"> | ||
<input class="form-check-input" | ||
id="query-date-lastweek" | ||
checked="${python:'checked' if checked==lastweek else ''}" | ||
name="created.query:record:date" | ||
type="radio" | ||
value="${lastweek}" | ||
/> | ||
<label class="form-check-label" | ||
for="query-date-lastweek" | ||
i18n:translate="time_last_week" | ||
>Last week</label> | ||
</div> | ||
</li> | ||
<li> | ||
<div class="form-check"> | ||
<input class="form-check-input" | ||
id="query-date-lastmonth" | ||
checked="${python:'checked' if checked==lastmonth else ''}" | ||
name="created.query:record:date" | ||
type="radio" | ||
value="${lastmonth}" | ||
/> | ||
<label class="form-check-label" | ||
for="query-date-lastmonth" | ||
i18n:translate="time_last_month" | ||
>Last month</label> | ||
</div> | ||
</li> | ||
<li> | ||
<div class="form-check"> | ||
<input class="form-check-input" | ||
id="query-date-ever" | ||
checked="${python:'checked' if checked==ever else ''}" | ||
name="created.query:record:date" | ||
type="radio" | ||
value="${ever}" | ||
/> | ||
<label class="form-check-label" | ||
for="query-date-ever" | ||
i18n:translate="time_ever" | ||
>Ever</label> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" | ||
aria-expanded="false" | ||
href="#" | ||
role="button" | ||
data-bs-toggle="dropdown" | ||
i18n:translate="sort_by" | ||
>Sort by</a> | ||
<ul class="dropdown-menu dropdown-menu-md-end" | ||
id="sorting-options" | ||
> | ||
<li tal:repeat="item view/sort_options"> | ||
<a class="dropdown-item" | ||
href="${item/url}" | ||
data-order="${python:'reverse' if item.reverse else ''}" | ||
data-sort="${item/sortkey}" | ||
tal:content="item/title" | ||
>sort option</a> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
</div> | ||
|
||
<div id="search-results-wrapper"> | ||
|
||
<metal:searchresults define-macro="search_results" | ||
use-macro="here/@@results-listing/macros/content-core" | ||
/> | ||
|
||
</div> | ||
|
||
<div class="my-3" | ||
id="rss-subscription" | ||
tal:condition="context/@@syndication-util/search_rss_enabled" | ||
i18n:domain="plone" | ||
> | ||
<a class="mx-2 text-decoration-none -flex align-items-center" | ||
href="${context/@@plone_context_state/object_url}/search_rss?${request/QUERY_STRING}" | ||
> | ||
<img tal:replace="structure python:icons.tag('rss-fill')" /> | ||
<span class="ms-1" | ||
i18n:translate="title_subscribe_rss_feed" | ||
> | ||
Subscribe to an always-updated RSS feed. | ||
</span> | ||
</a> | ||
</div> | ||
|
||
</form> | ||
</div> | ||
|
||
</body> | ||
</html> |