Skip to content

Commit

Permalink
make radio in place of checkbox, and force only search in 3 type of OG
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Diaz committed Jun 22, 2018
1 parent 468af9c commit 978b0ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 3 additions & 3 deletions genweb/organs/search.pt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
<fieldset class="noborder">
<h4 i18n:translate="" i18n:domain="genweb.organs">Organ de govern</h4>
<div class="field">
<input type="checkbox"
<input type="radio"
class="noborder"
id="path-og"
name="path"
Expand All @@ -209,15 +209,15 @@
tal:attributes="value string:$root_path/ca/consell-de-govern/consell-de-govern/" />
<label>Consell de Govern</label>
<br/>
<input type="checkbox"
<input type="radio"
class="noborder"
id="path-og"
name="path"
value=""
tal:attributes="value string:$root_path/ca/cs/ple-del-consell-social/" />
<label>Consell Social</label>
<br/>
<input type="checkbox"
<input type="radio"
class="noborder"
id="path-og"
name="path"
Expand Down
15 changes: 13 additions & 2 deletions genweb/organs/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def results(self, query=None, batch=True, b_size=50, b_start=0):
root_path = '/'.join(api.portal.get().getPhysicalPath()) # /998/govern
lt = getToolByName(self, 'portal_languages')
lang = lt.getPreferredLanguage()

if query['latest_session']:
if query['path'] == root_path + '/' + lang:
query['path'] = [
Expand Down Expand Up @@ -333,8 +334,16 @@ def filter_query(self, query):
query['show_inactive'] = False
# respect navigation root
if 'path' not in query:
query['path'] = getNavigationRoot(self.context)

# Added /Plone/ca
# query['path'] = getNavigationRoot(self.context)
# Added all defaults folders:
root_path = '/'.join(api.portal.get().getPhysicalPath()) # /998/govern
lt = getToolByName(self, 'portal_languages')
lang = lt.getPreferredLanguage()
query['path'] = [
root_path + '/' + lang + '/consell-de-govern/consell-de-govern/',
root_path + '/' + lang + '/cs/ple-del-consell-social/',
root_path + '/' + lang + '/claustre-universitari/claustre-universitari/']
return query

def filter_types(self, types):
Expand Down Expand Up @@ -421,6 +430,8 @@ def breadcrumbs(self, item):
view = getMultiAdapter((obj, self.request), name='breadcrumbs_view')
# cut off the item itself
breadcrumbs = list(view.breadcrumbs())[:-1]
# Fixed to Remove Unit OG Folder Name
breadcrumbs = breadcrumbs[1:]
if len(breadcrumbs) == 0:
# don't show breadcrumbs if we only have a single element
return None
Expand Down

0 comments on commit 978b0ee

Please sign in to comment.