Skip to content

Commit ac19fdc

Browse files
authored
Merge pull request #175 from OpenDataServices/fallback-link
fallback link where no id guidance & country code abbreviations
2 parents 26723fb + dccdd3f commit ac19fdc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

prefix_finder/frontend/templates/list.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h2>Description</h2>
5252
<div class="single-content__block single-meta-info">
5353
<ul class="single-meta-info__categories single-categories">
5454
<li class="single-categories__item single-categories--coverage">
55-
<p>Coverage: {% for x in org_list.coverage %}<span>{{ x }}{% if not forloop.last %},{% endif %} </span>{% endfor %}</p>
55+
<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>
5656
</li>
5757

5858
{% if org_list.sector %}
@@ -70,6 +70,8 @@ <h3>Search options</h3>
7070
<h3>Find and use identifiers</h3>
7171
{% if org_list.access.guidanceOnLocatingIds %}
7272
<p>{{ org_list.access.guidanceOnLocatingIds|urlize|linebreaks }}</p>
73+
{% else %}
74+
<p><a href="{{ org_list.url }}" target="_blank">Visit the website.</a></p>
7375
{% endif %}
7476
</div>
7577
</div>

prefix_finder/frontend/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def add_titles(org_list):
158158
coverage_codes = org_list.get('coverage')
159159
if coverage_codes:
160160
org_list['coverage_titles'] = [tup[1] for tup in lookups['coverage'] if tup[0] in coverage_codes]
161+
org_list['coverage_codes_and_titles'] = [tup for tup in lookups['coverage'] if tup[0] in coverage_codes]
161162
subnational_codes = org_list.get('subnationalCoverage')
162163
if subnational_codes:
163164
subnational_coverage = []
@@ -500,7 +501,7 @@ def list_details(request, prefix):
500501

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

505506

506507
def _get_filename(use_branch='master'):

0 commit comments

Comments
 (0)