Skip to content

Commit

Permalink
Merge branch 'release/6.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
moh-moola committed Sep 7, 2018
2 parents ee0359e + 47ae3bc commit a97190e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
@@ -1,5 +1,10 @@
CHANGE LOG
==========
6.1.2
-----

- Add keyword, category and country filtering to service-directory api

6.1.1
-----

Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
6.1.1
6.1.2
4 changes: 4 additions & 0 deletions molo/servicedirectory/context_processors.py
Expand Up @@ -13,6 +13,9 @@ def enable_service_directory_context(request):
site_settings.default_service_directory_radius
)

multi_category_select = site_settings.\
enable_multi_category_service_directory_search

options = getattr(
settings,
'SERVICE_DIRECTORY_RADIUS_OPTIONS', (
Expand All @@ -26,6 +29,7 @@ def enable_service_directory_context(request):
ctx.update({
'SERVICE_DIRECTORY_RADIUS_OPTIONS': options,
'SERVICE_DIRECTORY_RADIUS': int(radius) if radius else None,
'SERVICE_DIRECTORY_MULTI_CATEGORY_SELECT': multi_category_select,
})

return ctx
18 changes: 18 additions & 0 deletions molo/servicedirectory/templates/servicedirectory/home.html
Expand Up @@ -6,8 +6,24 @@
<label class="heading heading--service-dir-subtitle">Search by typing something, or choose a category below:</label>
<input type="text" name="search" placeholder="I'm looking for..." />
</fieldset>

{% if SERVICE_DIRECTORY_MULTI_CATEGORY_SELECT %}
<fieldset>
<div>Select Service Categories</div>
{% for category in categories_keywords %}
<label class="">
{{ category.name|title }}
<input type="checkbox" name="categories[]" value="{{ category.pk }}" />
</label>
{% endfor %}
</fieldset>
{% endif %}

<input type="submit" value="Search" />
</form>

{% if not SERVICE_DIRECTORY_MULTI_CATEGORY_SELECT %}

<div class="service-directory__listings">
{% for category in categories_keywords %}
<a class="service-directory__title" href="{% url 'molo.servicedirectory:location-search' %}?search={{ category.name }}">{{ category.name }}</a>
Expand All @@ -24,4 +40,6 @@
</li>
{% endfor %}
</div>

{% endif %}
{% endblock %}
2 changes: 2 additions & 0 deletions molo/servicedirectory/tests/test_context_processors.py
Expand Up @@ -18,6 +18,7 @@ def test_enable_service_directory_context(self):
site=site,
enable_service_directory=True,
default_service_directory_radius=25,
enable_multi_category_service_directory_search=True,
)
request = RequestFactory()
request.GET = {'search': 'test'}
Expand All @@ -29,6 +30,7 @@ def test_enable_service_directory_context(self):
'SERVICE_DIRECTORY_RADIUS':
site_setting.default_service_directory_radius,
'ENABLE_SERVICE_DIRECTORY': True,
'SERVICE_DIRECTORY_MULTI_CATEGORY_SELECT': True,
'SERVICE_DIRECTORY_RADIUS_OPTIONS': (
(5, '5 KM'), (10, '10 KM'), (15, '15 KM'),
(20, '20 KM'), (25, '25 KM'), (30, '30 KM'),
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,2 +1,2 @@
molo.core>=6.9.11,<7.0.0
molo.core>=6.9.15,<7.0.0
six>=1,<2

0 comments on commit a97190e

Please sign in to comment.