-
Notifications
You must be signed in to change notification settings - Fork 2k
/
resource_view.html
35 lines (34 loc) · 1.66 KB
/
resource_view.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<h1 class="resource-view-title">{{data['title']}}</h1>
<div class="resource-view-description">{{data['description']}}</div>
<div class="module-content ckanext-datapreview">
{% if not h.resource_view_is_iframed(data) %}
{{ h.rendered_resource_view(data, resource, package) }}
{% else %}
<div class="data-viewer-error js-hide">
<p class="text-error">
<i class="icon-info-sign"></i>
{{ _('This resource view is not available at the moment.') }}
<a href="#" data-toggle="collapse" data-target="#data-view-error">
{{ _('Click here for more information.') }}
</a>
</p>
<p id="data-view-error" class="collapse"></p>
<p>
<a href="{{ raw_resource_url }}" class="btn btn-large resource-url-analytics" target="_blank">
<i class="icon-large icon-download"></i>
{{ _('Download resource') }}
</a>
</p>
</div>
{% if data.get('id') %}
{% set src = h.url(controller='package', action='resource_view', id=package['name'], resource_id=resource['id'], view_id=data['id']) %}
{% else %}
{# When creating a new view no view_id exists, but we still want to preview it, so we stick the whole resource_view as a param as there is no other way to pass to information on to
the iframe #}
{% set src = h.url(controller='package', action='resource_view', id=package['name'], resource_id=resource['id']) + '?' + h.urlencode({'resource_view': h.dump_json(data)}) %}
{% endif %}
<iframe src="{{ src }}" frameborder="0" width="100%" data-module="data-viewer">
<p>{{ _('Your browser does not support iframes.') }}</p>
</iframe>
{% endif %}
</div>