Skip to content

Commit

Permalink
Merge 8f4d0be into d874eb1
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbiscuit committed Jan 25, 2023
2 parents d874eb1 + 8f4d0be commit 1d90f40
Show file tree
Hide file tree
Showing 24 changed files with 64 additions and 42 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ Changelog
1.1.2 (unreleased)
------------------

- Refactor and simplify webcomponent props
[Julien]

- Fix search webcomponent in offcanvas
[Julien]

- Add option to display search result type depending of type assignation to city
[Julien]

- Replacement of hard coded urls for images
[thomlamb]

Expand Down
3 changes: 2 additions & 1 deletion src/imio/smartweb/core/browser/search/search.pt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<metal:main fill-slot="content-core">

<div class="">
<smartweb-search tal:attributes="query-url view/navroot_url">
<smartweb-search tal:attributes="query-url view/navroot_url;
result-option view/get_search_result_option">
</smartweb-search >
</div>

Expand Down
17 changes: 17 additions & 0 deletions src/imio/smartweb/core/browser/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from Products.CMFPlone.browser.search import Search
from Products.CMFPlone.utils import normalizeString

import json


class Search(Search):
valid_keys = ("sort_on", "sort_order", "sort_limit", "fq", "fl", "facet", "core")
Expand Down Expand Up @@ -50,3 +52,18 @@ def get_item_url(self, item):
id=item_id,
uid=item.UID,
)

def get_search_result_option(self):
directory_entity_uid = api.portal.get_registry_record(
"smartweb.directory_entity_uid"
)
events_entity_uid = api.portal.get_registry_record("smartweb.events_entity_uid")
news_entity_uid = api.portal.get_registry_record("smartweb.news_entity_uid")

response = {
"directory": bool(directory_entity_uid),
"events": bool(events_entity_uid),
"news": bool(news_entity_uid),
}

return json.dumps(response)
5 changes: 3 additions & 2 deletions src/imio/smartweb/core/viewlets/offcanvas.pt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
</div>
<div class="offcanvas-body">
<div class="search">
<smartweb-search tal:attributes="query-url view/navroot_url">
</smartweb-search >
<smartweb-search tal:attributes="query-url view/navroot_url;
result-option view/get_search_result_option">
</smartweb-search >
</div>
</div>
</div>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

0 comments on commit 1d90f40

Please sign in to comment.