This repository has been archived by the owner on Nov 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from bcgov/revert-38-372-add-pdf-view-req
Revert "372 add pdf view req"
- Loading branch information
Showing
1 changed file
with
73 additions
and
78 deletions.
There are no files selected for viewing
151 changes: 73 additions & 78 deletions
151
ckanext/openapi/templates/package/snippets/resource_view.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,82 @@ | ||
{% import 'macros/form.html' as form %} | ||
{# | ||
This h.can_view_resource helper function is defined in ckanext-bcgov/ckanext/bcgov/util/util. Thus ckanext-bcgov is required for this extension to function dependencie | ||
#} | ||
{% if h.can_view_resource(resource) %} | ||
<div id="view-{{ resource_view['id'] }}" class="resource-view" data-id="{{ resource_view['id'] }}" data-title="{{ resource_view['title'] }}" data-description="{{ resource_view['descripion'] }}"> | ||
|
||
<a class="btn pull-right" | ||
href="{{ h.url('resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id'], qualified=True) }}" target="_blank"> | ||
{% trans %}Open in new tab{% endtrans %} | ||
</a> | ||
<a class="btn pull-right" | ||
href="#embed-{{ resource_view['id'] }}" | ||
data-module="resource-view-embed" | ||
data-module-id="{{ resource_view['id'] }}" | ||
data-module-url="{{ h.url('resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id'], qualified=True) }}"> | ||
<i class="icon-code"></i> | ||
{{ _("Embed") }} | ||
</a> | ||
<p class="desc">{{ resource_view['description'] }}</p> | ||
<div class="m-top ckanext-datapreview"> | ||
{% if not to_preview and h.resource_view_is_filterable(resource_view) %} | ||
{% snippet 'package/snippets/resource_view_filters.html', resource=resource %} | ||
{% endif %} | ||
{% if not h.resource_view_is_iframed(resource_view) %} | ||
{{ h.rendered_resource_view(resource_view, 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 not to_preview %} | ||
{% set current_filters = request.str_GET.get('filters') %} | ||
{% if current_filters %} | ||
{% set src = h.url(qualified=true, controller='package', | ||
action='resource_view', id=package['name'], | ||
resource_id=resource['id'], | ||
view_id=resource_view['id'], | ||
filters=current_filters) %} | ||
{% else %} | ||
{% set src = h.url(qualified=true, controller='package', | ||
action='resource_view', id=package['name'], | ||
resource_id=resource['id'], | ||
view_id=resource_view['id']) %} | ||
{% endif %} | ||
|
||
<div id="view-{{ resource_view['id'] }}" class="resource-view" data-id="{{ resource_view['id'] }}" data-title="{{ resource_view['title'] }}" data-description="{{ resource_view['descripion'] }}"> | ||
|
||
<a class="btn pull-right" | ||
href="{{ h.url('resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id'], qualified=True) }}" target="_blank"> | ||
{% trans %}Open in new tab{% endtrans %} | ||
</a> | ||
<a class="btn pull-right" | ||
href="#embed-{{ resource_view['id'] }}" | ||
data-module="resource-view-embed" | ||
data-module-id="{{ resource_view['id'] }}" | ||
data-module-url="{{ h.url('resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id'], qualified=True) }}"> | ||
<i class="icon-code"></i> | ||
{{ _("Embed") }} | ||
</a> | ||
<p class="desc">{{ resource_view['description'] }}</p> | ||
<div class="m-top ckanext-datapreview"> | ||
{% if not to_preview and h.resource_view_is_filterable(resource_view) %} | ||
{% snippet 'package/snippets/resource_view_filters.html', resource=resource %} | ||
{% endif %} | ||
{% if not h.resource_view_is_iframed(resource_view) %} | ||
{{ h.rendered_resource_view(resource_view, 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 not to_preview %} | ||
{% set current_filters = request.str_GET.get('filters') %} | ||
{% if current_filters %} | ||
{% set src = h.url(qualified=true, controller='package', | ||
action='resource_view', id=package['name'], | ||
resource_id=resource['id'], | ||
view_id=resource_view['id'], | ||
filters=current_filters) %} | ||
{% 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 #} | ||
{% set src = h.url(qualified=true, controller='package', action='resource_view', id=package['name'], resource_id=resource['id']) + '?' + h.urlencode({'resource_view': h.dump_json(resource_view)}) %} | ||
{% set src = h.url(qualified=true, controller='package', | ||
action='resource_view', id=package['name'], | ||
resource_id=resource['id'], | ||
view_id=resource_view['id']) %} | ||
{% endif %} | ||
<iframe src="{{ src }}" frameborder="0" width="100%" data-module="data-viewer" allowfullscreen> | ||
<p>{{ _('Your browser does not support iframes.') }}</p> | ||
</iframe> | ||
{% 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 #} | ||
{% set src = h.url(qualified=true, controller='package', action='resource_view', id=package['name'], resource_id=resource['id']) + '?' + h.urlencode({'resource_view': h.dump_json(resource_view)}) %} | ||
{% endif %} | ||
<iframe src="{{ src }}" frameborder="0" width="100%" data-module="data-viewer" allowfullscreen> | ||
<p>{{ _('Your browser does not support iframes.') }}</p> | ||
</iframe> | ||
{% endif %} | ||
</div> | ||
<div id="embed-{{ resource_view['id'] }}" class="modal resource-view-embed hide"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal">×</button> | ||
<h3>{{ _("Embed resource view") }}</h3> | ||
</div> | ||
<div id="embed-{{ resource_view['id'] }}" class="modal resource-view-embed hide"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal">×</button> | ||
<h3>{{ _("Embed resource view") }}</h3> | ||
</div> | ||
<div class="modal-body"> | ||
<p class="embed-content">{{ _("You can copy and paste the embed code into a CMS or blog software that supports raw HTML") }}</p> | ||
<div class="row-fluid"> | ||
<div class="span6"> | ||
{{ form.input("width", label=_("Width"), value=700, classes=["control-full"]) }} | ||
</div> | ||
<div class="span6"> | ||
{{ form.input("height", label=_("Height"), value=400, classes=["control-full"]) }} | ||
</div> | ||
<div class="modal-body"> | ||
<p class="embed-content">{{ _("You can copy and paste the embed code into a CMS or blog software that supports raw HTML") }}</p> | ||
<div class="row-fluid"> | ||
<div class="span6"> | ||
{{ form.input("width", label=_("Width"), value=700, classes=["control-full"]) }} | ||
</div> | ||
<div class="span6"> | ||
{{ form.input("height", label=_("Height"), value=400, classes=["control-full"]) }} | ||
</div> | ||
{{ form.textarea("code", label=_("Code"), value="", classes=["pre"], rows=3) }} | ||
</div> | ||
{{ form.textarea("code", label=_("Code"), value="", classes=["pre"], rows=3) }} | ||
</div> | ||
</div> | ||
|
||
{% endif %} | ||
</div> |