Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
[#853] Entry details pages link for Index
Browse files Browse the repository at this point in the history
Entry pages use `/place/...` as the base url path, not `/entry/...`.
  • Loading branch information
brew committed Jan 26, 2017
1 parent 881e2fc commit 311548f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
7 changes: 6 additions & 1 deletion census/views/includes/dataviews/table_slice_place.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@
</tr>
</thead>
<tbody>
{% if is_index %}
{% set entryBaseUrl = 'place' %}
{% else %}
{% set entryBaseUrl = 'entry' %}
{% endif %}
{% for dataset in datasets %}
{% set entry = entries|find({'dataset': dataset.id, 'place': place.id}) %}
{% set submissions = pending|where({'dataset': dataset.id, 'place': place.id, 'year': year}) %}
<tr id="{{ dataset.id }}" class="entry" data-rank="{{ entry.rank }}" data-score="{{ entry.computedScore }}" data-place="{{ place.id }}" data-name="{{ place.name }}">
<td>
{% if entry -%}<a href="/entry/{{place.id}}/{{dataset.id}}{{ urlContext }}">{%- endif %}
{% if entry -%}<a href="/{{ entryBaseUrl }}/{{ place.id }}/{{ dataset.id }}{{ urlContext }}">{%- endif %}
{{ dataset.name }}
{% if entry -%}</a>{%- endif %}
</td>
Expand Down
14 changes: 10 additions & 4 deletions census/views/macros/popovers.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@
<p>{{ entry.details|truncate(100) }}</p>
{%- endif %}

{% if is_index != "true" -%}
{% if is_index %}
{% set entryBaseUrl = 'place' %}
{% else %}
{% set entryBaseUrl = 'entry' %}
{% endif %}

{% if not is_index -%}
<div class='btn-group'>
{% endif %}
<a class="btn btn-primary" href="/entry/{{ place.id }}/{{ dataset.id }}/">{{ gettext("Read more &raquo;") }}</a>
{% if is_index != "true" and submissionsAllowed %}
<a class="btn btn-primary" href="/{{ entryBaseUrl }}/{{ place.id }}/{{ dataset.id }}/">{{ gettext("Read more &raquo;") }}</a>
{% if not is_index and submissionsAllowed %}
<a class='btn btn-{{actionClass}}' href='{{actionUrl}}'>{{actionText}}</a>
{%- endif %}
{% if is_index != "true" -%}
{% if not is_index -%}
</div>
{%- endif %}

Expand Down
14 changes: 10 additions & 4 deletions index/metalsmith-godi-updatedatafiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ const debug = require('debug')('metalsmith-godi-updatedatafiles');
module.exports = plugin;

/**
* GODI Metalsmith plugin that takes the results of json-to-files and updates
* the file data structures to what is expected by the templates.
* GODI Metalsmith plugin that takes the upstream results of godi-getdata and
* json-to-files, and updates the file data structures to what is expected by
* the templates.
*
* json-to-files puts its source data on a 'data' key. We want to be more
* specific.
* json-to-files puts its source data on a 'data' key in file metadata. Move
* it to the specific entity name instead.
*
* Move metadata such as `stats` from `data` to top-level file metadata.
*
* For entries, find the specific entry `place` and `dataset` and add them as
* file metadata.
*
* @return {Function}
*/
Expand Down

0 comments on commit 311548f

Please sign in to comment.