Skip to content

Commit

Permalink
Merge branch 'wagtail-inventory' of github.com:mozilla/foundation.moz…
Browse files Browse the repository at this point in the history
…illa.org into wagtail-inventory
  • Loading branch information
Pomax committed Jul 18, 2018
2 parents 77c0c5c + 2437b65 commit 6c561af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
11 changes: 0 additions & 11 deletions network-api/networkapi/wagtailpages/customblocks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re

from wagtail.core import blocks
from wagtail.images.blocks import ImageChooserBlock

Expand Down Expand Up @@ -252,15 +250,6 @@ class Meta:


class PulseProjectQueryValue(blocks.StructValue):
@property
def query(self):
# Replace any combination of spaces and commas with a single +
# because despite instructions to use spaces, someone, at some
# point, will accidentally use a comma, and that should be fine.
search_terms = self['search_terms'].strip()
query = re.sub(r'[\s,]+', '+', search_terms)
return query

@property
def size(self):
max_number_of_results = self['max_number_of_results']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
data-help="{{ value.help }}"
data-issues="{{ value.issues }}"
data-max="{{ value.size }}"
data-query="{{ value.query }}"
data-reversed="{{ value.newest_first }}" />
data-query="{{ value.search_terms }}"
data-reversed="{{ value.newest_first }}"></div>
4 changes: 2 additions & 2 deletions network-api/networkapi/wagtailpages/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def get_descendants(node, list, authenticated=False, depth=0, max_depth=2):

nextset = node.get_children().in_menu()

# Do not show draft pages to users who are
# Do not show draft/private pages to users who are
# not logged into the CMS itself.
if authenticated is False:
nextset = nextset.live()
nextset = nextset.live().public()

for child in nextset:
get_descendants(child, list, authenticated, depth + 1)
Expand Down

0 comments on commit 6c561af

Please sign in to comment.