Skip to content

Commit

Permalink
Reintroduce location prompts, reversing 200ae87
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Apr 22, 2016
1 parent a882d2f commit 0806a72
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hasjob/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
<h2>{{ location.use_title }}</h2>
{{ location.description }}
</div>
{%- elif location_prompts and not domain %}
<div class="flash info">
<p>In {{ location_prompts[0]['use_title'] }}? Filter this view:</p>
<p class="button-bar">
{%- for loc in location_prompts %}
<a class="btn btn-sm btn-default" data-geonameid="{{ loc['geonameid'] }}" href="{{ request.base_url + '?l=' + loc['name']|urlencode }}">{{ loc['picker_title'] }}</a>
{%- endfor %}
<a class="btn btn-sm btn-default" href="{{ request.base_url }}?anywhere=1">Anywhere</a>
</p>
</div>
{%- endif %}
{%- if domain %}
{{ org_profile(domain) }}
Expand Down
12 changes: 12 additions & 0 deletions hasjob/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@ def index(basequery=None, md5sum=None, tag=None, domain=None, location=None, tit
elif pinsandposts:
g.impressions = {post.id: (pinflag, post.id, is_bgroup) for pinflag, post, is_bgroup in pinsandposts}

# Test values for development:
# if not g.user_geonameids:
# g.user_geonameids = [1277333, 1277331, 1269750]
if not location and 'l' not in request.args and g.user_geonameids and (g.user or g.anon_user) and (
(not g.board.locations) if g.board else True):
# No location filters? Prompt the user
ldata = location_geodata(g.user_geonameids)
location_prompts = [ldata[geonameid] for geonameid in g.user_geonameids if geonameid in ldata]
else:
location_prompts = []

query_params = request.args.to_dict(flat=False)
if loadmore:
query_params.update({'startdate': loadmore.isoformat() + 'Z', 'ph': pinned_hashids})
Expand All @@ -363,6 +374,7 @@ def index(basequery=None, md5sum=None, tag=None, domain=None, location=None, tit
md5sum=md5sum, domain=domain, location=location, employer_name=employer_name,
showall=showall, is_index=is_index,
header_campaign=header_campaign, loadmore=loadmore,
location_prompts=location_prompts,
search_domains=search_domains, query_params=query_params,
is_siteadmin=is_siteadmin,
pay_graph_data=pay_graph_data, paginated=index_is_paginated(), template_vars=template_vars)
Expand Down

0 comments on commit 0806a72

Please sign in to comment.