Skip to content

Commit

Permalink
Merge branch 'master' into 183-preview-banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb authored Jan 18, 2018
2 parents 94670e4 + f6cc9da commit 7a014b5
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Steps to installation:
* Create a virtual environment (note this application uses python3)
* Activate the virtual environment
* Install dependencies
* Apply migrations
* Run the development server

```
Expand All @@ -63,6 +64,7 @@ cd org-ids
virtualenv .ve --python=/usr/bin/python3
source .ve/bin/activate
pip install -r requirements_dev.txt
python manage.py migrate
python manage.py runserver
```

Expand Down
1 change: 1 addition & 0 deletions prefix_finder/frontend/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% trans "The code for this site is available on Github" %}: <a href="https://github.com/OpenDataServices/org-ids/">{%trans "org-ids" %}</a>.
{% trans "Licence" %}: <a href="https://www.gnu.org/licenses/agpl-3.0.html">{% trans "AGPLv3" %}</a>.
{% trans "Report/View issues" %}: <a href="https://github.com/OpenDataServices/org-ids/issues">{% trans "org-id issues" %}</a>.
{% trans "To contribute lists" %}: <a href="http://docs.org-id.guide/en/latest">{% trans "contributors handbook" %}</a>.
<a href="{% url 'terms' %}">{% trans "Terms &amp; Conditions" %}</a>.
{% blocktrans %}Running version {% endblocktrans %}<a href="https://github.com/OpenDataServices/org-ids/tree/{{ request.tag }}">{{ request.tag }}</a>.
</p>
Expand Down
35 changes: 29 additions & 6 deletions prefix_finder/frontend/templates/list.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% extends 'base.html' %}
{% load list_filters %}
{% load static %}


{% block main %}
<main class="main-wrapper" role="main">
{% include "sidebar.html" %}

<div class="main-content single-content">
<header class="single-content__header">
<a href="{{ org_list.url }}" class="button" target="_blank"><i class="material-icons">link</i></a>
<a href="{{ org_list.url }}" class="button" target="_blank"><i class="material-icons" title="Visit website for this list">launch</i></a>
<h1>{{ org_list.name.en }} <span>({{ org_list.code }})</span></h1>
</header>

Expand All @@ -20,13 +22,25 @@ <h1>{{ org_list.name.en }} <span>({{ org_list.code }})</span></h1>
</div>

<div class="single-sidebar__block single-sidebar--dark">
<h2>How to use</h2>
<p>The code for this list is <br/><code>{{ org_list.code }}</code>. When you have located the organization you wish to identify in this list, you should either:</p>
<p>Enter it in an identifier database field prefixed with <code>{{ org_list.code }}</code>.</p>
<h2>Example</h2>
<pre>
<code>{{ org_list.code }}-[ IDENTIFIER ]</code>
</pre>
<p>Or, use it within a two-part identifier, with <code>{{ org_list.code }}</code> as the 'scheme', and the identifier you have located as the 'identifier' field. </p>
{% if org_list.access.exampleIdentifiers|length >= 1 %}
{% if org_list.access.exampleIdentifiers|length = 1 %}
<h2>Example</h2>
{% else %}
<h2>Examples</h2>
{% endif %}
<pre>
{% for x in org_list.access.exampleIdentifiers|split_examples:","|slice:":3" %}
<code>{{ org_list.code }}-{{ x }}</code>
{% endfor %}
</pre>
{% endif %}
<p>Alternatively, use it within a two-part identifier, with <code>{{ org_list.code }}</code> as the 'scheme', and the identifier you have located as the 'identifier' field. </p>
</div>
</div>

Expand All @@ -40,7 +54,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 @@ -51,13 +65,22 @@ <h2>Description</h2>
</ul>

<div class="single-meta-info__instructions">
<h3>To find identifiers</h3>
<p>{{ org_list.access.guidanceOnLocatingIds|urlize|linebreaks}}</p>
<h3>Search options</h3>
{% if org_list.access.onlineAccessDetails %}
<p>{{ org_list.access.onlineAccessDetails|urlize|linebreaks }}</p>
{% endif %}
<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>

<div class="single-content__block single-suggest">
<p>You can suggest an edit to our information about this list by <a href="https://github.com/org-id/register/issues/new">posting an issue</a> or <a href="https://github.com/org-id/register">submitting a pull request</a>.</p>
<p>The <a href="http://docs.org-id.guide/en/latest/contribute/#proposing-a-correction-or-update" target="_blank">contributors handbook</a> details how to propose changes to an existing list, and how you can request or propose a new list.</p>
</div>
</div>
</div>
Expand Down
16 changes: 9 additions & 7 deletions prefix_finder/frontend/templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ <h4>Sectors</h4>
</div>

<footer class="card__controls">
<a href="{{ result.url }}" class="button" target="_blank"><i class="material-icons">link</i></a>
<a href="{{ result.url }}" class="button" target="_blank"><i class="material-icons" title="Visit the website for this list">launch</i></a>
<div class="card__list-code"><p>List Code <code>{{ result.code }}</code></p></div>
<a href="{% url "list" result.code %}" class="button"><i class="material-icons">zoom_out_map</i></a>
<a href="{% url "list" result.code %}" class="button"><i class="material-icons" title="More information about this list">info_outline</i></a>
</footer>
</article>
</div>
Expand All @@ -71,8 +71,10 @@ <h4>Sectors</h4>
<h1>Possible Lists</h1>
{% if all_results.recommended %}
<p>It's possible you will find the organization(s) you are looking for in one of the lists below…</p>
{% else %}
{% elif all_result.suggested %}
<p>No alternative results.</p>
{% else %}
<p>No alternative results. Think there should be a list here? You can make a request, read the <a href="http://docs.org-id.guide/en/latest/contribute/" target="_blank">contributors handbook</a> for details on how to request or propose a new list.</p>
{% endif %}
</header>

Expand Down Expand Up @@ -115,9 +117,9 @@ <h4>Sectors</h4>
</div>

<footer class="card__controls">
<a href="{{ result.url }}" class="button" target="_blank"><i class="material-icons">link</i></a>
<a href="{{ result.url }}" class="button" target="_blank"><i class="material-icons" title="Visit the website for this list">launch</i></a>
<div class="card__list-code"><p>List Code <code>{{ result.code }}</code></p></div>
<a href="{% url "list" result.code %}" class="button"><i class="material-icons">zoom_out_map</i></a>
<a href="{% url "list" result.code %}" class="button"><i class="material-icons" title="More information about this list">info_outline</i></a>
</footer>
</article>
</div>
Expand Down Expand Up @@ -174,9 +176,9 @@ <h4>Sectors</h4>
</div>

<footer class="card__controls">
<a href="{{ result.url }}" class="button" target="_blank"><i class="material-icons">link</i></a>
<a href="{{ result.url }}" class="button" target="_blank"><i class="material-icons" title="Visit the website for this list">launch</i></a>
<div class="card__list-code"><p>List Code <code>{{ result.code }}</code></p></div>
<a href="{% url "list" result.code %}" class="button"><i class="material-icons">zoom_out_map</i></a>
<a href="{% url "list" result.code %}" class="button"><i class="material-icons" title="More information about this list">info_outline</i></a>
</footer>
</article>
</div>
Expand Down
8 changes: 8 additions & 0 deletions prefix_finder/frontend/templatetags/list_filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django import template

register = template.Library()


@register.filter(name='split_examples')
def split_examples(value, arg):
return value.replace(" ","").split(arg)
16 changes: 14 additions & 2 deletions 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 @@ -503,7 +504,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 Expand Up @@ -564,7 +565,18 @@ def make_xml_codelist(use_branch="master"):
root = ET.Element("codelist")
meta = ET.SubElement(root, "metadata")
ET.SubElement(ET.SubElement(meta, "name"),"narrative").text = "Organization Identifier Lists"
ET.SubElement(ET.SubElement(meta, "description"),"narrative").text = "Organization identifier lists and their code. These can be used as the prefix for an organization identifier. For general guidance about constructing Organization Identifiers, please see http://iatistandard.org/organization-identifiers/ This list was formerly maintained by the IATI Secretariat as the Organization Registration Agency codelist. This version is maintained by the Identify-Org project, of which IATI is a member. New code requests should be made via Identify-org.net"
ET.SubElement(ET.SubElement(meta, "description"),"narrative").text = """
Organization identifier lists and their code. These can be used as the
prefix for an organization identifier. For general guidance about
constructing Organization Identifiers, please see
http://iatistandard.org/202/guidance/how-to-publish/iati-organisation-identifiers/
This list was formerly maintained by the IATI Secretariat as the
Organization Registration Agency codelist. This version is maintained
by the org-id.guide project, of which IATI is a member. New code
requests should be made via
http://docs.org-id.guide/en/latest/contribute/
"""
items = ET.SubElement(root, "codelist-items")

for entry in org_id_dict[use_branch].values():
Expand Down

0 comments on commit 7a014b5

Please sign in to comment.