Skip to content
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

Block for extra content in area/postcode info #284

Merged
merged 1 commit into from
Feb 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions mapit/templates/mapit/area.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ <h2>{{ area.name }} <em class="area_id">ID {{ area.id }}</em></h2>
{% if area.children.count %}
<li><a href="{% url "mapit_index" %}area/{{ area.id }}/children.html">{% trans "Children" %}</a></li>
{% endif %}
{% with area.id|slugify as area_id %}
<li>{% blocktrans with json_url=index_url|add:"area/"|add:area_id %}Get <a href="{{ json_url }}">this data as JSON</a>{% endblocktrans %}</li>
{% endwith %}
</ul>
{% with area.id|slugify as area_id %}
<p>{% blocktrans with json_url=index_url|add:"area/"|add:area_id %}Get <a href="{{ json_url }}">this data as JSON</a>{% endblocktrans %}</p>
{% endwith %}

{% block area_info_extra %}{% endblock %}
</header>

{% if area.polygons.count %}
Expand Down
27 changes: 14 additions & 13 deletions mapit/templates/mapit/postcode.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@
<header class="area_info">
<h2>{{ postcode.postcode }}</h2>
<ul>
{% if postcode.coordsyst %}
<li>{% ifequal postcode.coordsyst "G" %}OSGB{% else %}IRE65{% endifequal %}
E/N: {{ postcode.easting }}, {{ postcode.northing }}
{% endif %}
{% if postcode.wgs84_lat or postcode.wgs84_lon %}
<li>{% trans "WGS84 lat/lon" %}: <a href="https://tools.wmflabs.org/geohack/geohack.php?params={{ postcode.wgs84_lat|floatformat }};{{ postcode.wgs84_lon }}">{{ postcode.wgs84_lat }}, {{ postcode.wgs84_lon }}</a>
{% else %}
<li>{% blocktrans trimmed %}
{% if postcode.coordsyst %}
<li>{% ifequal postcode.coordsyst "G" %}OSGB{% else %}IRE65{% endifequal %}
E/N: {{ postcode.easting }}, {{ postcode.northing }}
{% endif %}
{% if postcode.wgs84_lat or postcode.wgs84_lon %}
<li>{% trans "WGS84 lat/lon" %}: <a href="https://tools.wmflabs.org/geohack/geohack.php?params={{ postcode.wgs84_lat|floatformat }};{{ postcode.wgs84_lon }}">{{ postcode.wgs84_lat }}, {{ postcode.wgs84_lon }}</a>
{% else %}
<li>{% blocktrans trimmed %}
No location information. Note this <em>is</em> a valid postcode (otherwise you would have got a 404), just one for which we don&rsquo;t know the location.
{% endblocktrans %}</li>

{% endif %}
{% endblocktrans %}</li>
{% endif %}
{% url json_view postcode=postcode.postcode as json_url %}
<li>{% blocktrans %}Get <a href="{{ json_url }}">this data as JSON</a>{% endblocktrans %}</li>
</ul>
{% url json_view postcode=postcode.postcode as json_url %}
<p>{% blocktrans %}Get <a href="{{ json_url }}">this data as JSON</a>{% endblocktrans %}</p>

{% block area_info_extra %}{% endblock %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be postcode_info_extra?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered it, but then the HTML element it appears in is called area_info (even on the postcode page) – so I stuck with area_info_extra because it's extra content to go in the .area_info element.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed that after (and merged+deployed as you see) :)

</header>

{% if postcode.wgs84_lat or postcode.wgs84_lon %}
Expand Down