Skip to content

fallback link where no id guidance & country code abbreviations #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 18, 2018
4 changes: 3 additions & 1 deletion prefix_finder/frontend/templates/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h2>Description</h2>
<div class="single-content__block single-meta-info">
<ul class="single-meta-info__categories single-categories">
<li class="single-categories__item single-categories--coverage">
<p>Coverage: {% for x in org_list.coverage %}<span>{{ x }}{% if not forloop.last %},{% endif %} </span>{% endfor %}</p>
<p>Coverage: {% for code, title in org_list.coverage_codes_and_titles %}<span><abbr title="{{ title }}">{{ code }}</abbr>{% if not forloop.last %},{% endif %} </span>{% endfor %}</p>
</li>

{% if org_list.sector %}
Expand All @@ -70,6 +70,8 @@ <h3>Search options</h3>
<h3>Find and use identifiers</h3>
{% if org_list.access.guidanceOnLocatingIds %}
<p>{{ org_list.access.guidanceOnLocatingIds|urlize|linebreaks }}</p>
{% else %}
<p><a href="{{ org_list.url }}" target="_blank">Visit the website.</a></p>
{% endif %}
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion prefix_finder/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def add_titles(org_list):
coverage_codes = org_list.get('coverage')
if coverage_codes:
org_list['coverage_titles'] = [tup[1] for tup in lookups['coverage'] if tup[0] in coverage_codes]
org_list['coverage_codes_and_titles'] = [tup for tup in lookups['coverage'] if tup[0] in coverage_codes]
subnational_codes = org_list.get('subnationalCoverage')
if subnational_codes:
subnational_coverage = []
Expand Down Expand Up @@ -500,7 +501,7 @@ def list_details(request, prefix):

except KeyError:
raise Http404('Organization list {} does not exist'.format(prefix))
return render(request, 'list.html', context={'org_list': org_list, 'branch':use_branch})
return render(request, 'list.html', context={'org_list': org_list, 'lookups': lookups, 'branch':use_branch})


def _get_filename(use_branch='master'):
Expand Down