Skip to content
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
1 change: 1 addition & 0 deletions changes/231.canada.changes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added template blocks to the Resource View template snippet for plugin extending capabilities, namely for iFrame Embedding.
27 changes: 15 additions & 12 deletions ckan/templates/package/snippets/resource_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
{% block resource_view %}
<div id="view-{{ resource_view['id'] }}" class="resource-view" data-id="{{ resource_view['id'] }}" data-title="{{ resource_view['title'] }}" data-description="{{ resource_view['descripion'] }}">
<div class="actions">
{# (canada fork only): rel='noopener noreferrer' #}
{# (canada fork only): non-qualified URIs #}
<a class="btn btn-default"
target="_blank"
rel="noopener noreferrer"
href="{{ h.url_for('resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id'], qualified=false) }}">
<i class="fa fa-arrows-alt"></i>
{{ _("Fullscreen") }}
</a>
{# (canada fork only): remove embed dur to X-Frame-Options:SAMEORIGIN #}
{# (canada fork only): jinja-block embed due to X-Frame-Options:SAMEORIGIN #}
{% block resource_view_actions %}
{# (canada fork only): rel='noopener noreferrer' #}
{# (canada fork only): non-qualified URIs #}
<a class="btn btn-default"
target="_blank"
rel="noopener noreferrer"
href="{{ h.url_for('resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id'], qualified=false) }}">
<i class="fa fa-arrows-alt"></i>
{{ _("Fullscreen") }}
</a>
{% endblock %}
</div>
{% block description %}
<p class="desc">{{ h.render_markdown(resource_view['description']) }}</p>
Expand Down Expand Up @@ -55,7 +57,7 @@
{% endif %}
{% else %}
{# When previewing we need to stick the whole resource_view as a param as there is no other way to pass to information on to the iframe #}
{# (canada fork only): non-qualified URIs #}
{# (canada fork only): non-qualified URIs #}
{% set src = h.url_for(package['type'] ~ '_resource.view', id=package['name'], resource_id=resource['id'], qualified=false) + '?' + h.urlencode({'resource_view': h.dump_json(resource_view)}) %}
{% endif %}
{# add lazy loading via data-viewer module (canada fork only) TODO: upstream contribution?? #}
Expand All @@ -64,6 +66,7 @@
</iframe>
{% endif %}
</div>
{# (canada fork only): remove embed dur to X-Frame-Options:SAMEORIGIN #}
{# (canada fork only): jinja-block embed due to X-Frame-Options:SAMEORIGIN #}
{% block resource_view_bottom %}{% endblock %}
</div>
{% endblock %}
Loading