Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1251] Updates to the resource view admin pages
- Loading branch information
1 parent
c78ff4a
commit 679f8c8
Showing
9 changed files
with
174 additions
and
97 deletions.
There are no files selected for viewing
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
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,23 +1,24 @@ | ||
{% extends "package/view_edit_base.html" %} | ||
|
||
{% block subtitle %}{{ _('Add View') }} - {{ h.resource_display_name(c.resource) }}{% endblock %} | ||
{% block form_title %}{{ _('Add view') }}{% endblock %} | ||
{% block subtitle %}{{ _('Edit view') }} - {{ h.resource_display_name(c.resource) }}{% endblock %} | ||
{% block form_title %}{{ _('Edit view') }}{% endblock %} | ||
|
||
{% block breadcrumb_content %} | ||
<li class="active"><a href="#">{{ _('Edit View') }}</a></li> | ||
{{ super() }} | ||
<li class="active"><a href="#">{{ _('Edit view') }}</a></li> | ||
{% endblock %} | ||
|
||
{% block content_primary_nav %} | ||
<li class="active"><a href="#"><i class="icon-edit"></i> {{ _('Edit view') }}</a></li> | ||
{% endblock %} | ||
|
||
{% block form %} | ||
<form class="dataset-form dataset-resource-form form-horizontal" method="post" data-module="basic-form resource-form"> | ||
{% include 'package/snippets/view_form.html' %} | ||
<div class="form-actions"> | ||
<form class="dataset-form dataset-resource-form form-horizontal" method="post" data-module="basic-form resource-form"> | ||
{% include 'package/snippets/view_form.html' %} | ||
<div class="form-actions"> | ||
<button class="btn btn-danger pull-left" name="delete" value="Delete"> {{ _('Delete') }} </button> | ||
<button class="btn btn-primary" name="preview" value="True" type="submit">{{ _('Preview Update') }}</button> | ||
<button class="btn" name="preview" value="True" type="submit">{{ _('Preview') }}</button> | ||
<button class="btn btn-primary" name="save" value="Save" type="submit">{{ _('Update') }}</button> | ||
</div> | ||
</form> | ||
{% endblock %} | ||
|
||
{% block content_primary_nav %} | ||
<li class="active"><a href="#"><i class="icon-edit"></i> {{ _('Edit View') }}</a></li> | ||
</div> | ||
</form> | ||
{% endblock %} |
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,22 +1,23 @@ | ||
{% extends "package/view_edit_base.html" %} | ||
|
||
{% block subtitle %}{{ _('Add View') }} - {{ h.resource_display_name(c.resource) }}{% endblock %} | ||
{% block subtitle %}{{ _('Add view') }} - {{ h.resource_display_name(c.resource) }}{% endblock %} | ||
{% block form_title %}{{ _('Add view') }}{% endblock %} | ||
|
||
{% block breadcrumb_content %} | ||
<li class="active"><a href="#">{{ _('Add New View') }}</a></li> | ||
{{ super() }} | ||
<li class="active"><a href="#">{{ _('Add view') }}</a></li> | ||
{% endblock %} | ||
|
||
{% block form %} | ||
<form class="dataset-form dataset-resource-form form-horizontal" method="post" data-module="basic-form resource-form"> | ||
{% include 'package/snippets/view_form.html' %} | ||
<div class="form-actions"> | ||
<button class="btn btn-primary" name="preview" value="True" type="submit">{{ _('Preview') }}</button> | ||
<button class="btn btn-primary" name="save" value="Save" type="submit">{% block save_button_text %}{{ _('Add') }}{% endblock %}</button> | ||
</div> | ||
</form> | ||
{% block content_primary_nav %} | ||
<li class="active"><a href="#"><i class="icon-edit"></i> {{ _('Add view') }}</a></li> | ||
{% endblock %} | ||
|
||
{% block content_primary_nav %} | ||
<li class="active"><a href="#"><i class="icon-edit"></i> {{ _('New View') }}</a></li> | ||
{% endblock %} | ||
{% block form %} | ||
<form class="dataset-form dataset-resource-form form-horizontal" method="post" data-module="basic-form resource-form"> | ||
{% include 'package/snippets/view_form.html' %} | ||
<div class="form-actions"> | ||
<button class="btn" name="preview" value="True" type="submit">{{ _('Preview') }}</button> | ||
<button class="btn btn-primary" name="save" value="Save" type="submit">{% block save_button_text %}{{ _('Add') }}{% endblock %}</button> | ||
</div> | ||
</form> | ||
{% endblock %} |
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
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
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
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,34 +1,35 @@ | ||
<h1 class="resource-view-title">{{resource_view['title']}}</h1> | ||
<div class="resource-view-description">{{resource_view['description']}}</div> | ||
|
||
<div class="module-content ckanext-datapreview"> | ||
{% 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 src = h.url(controller='package', action='resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id']) %} | ||
<div class="resource-view" data-title="{{ resource_view['title'] }}" data-description="{{ resource_view['descripion'] }}"> | ||
<h1>{{ resource_view['title'] }}</h1> | ||
<p class="desc">{{ resource_view['description'] }}</p> | ||
<div class="ckanext-datapreview"> | ||
{% if not h.resource_view_is_iframed(resource_view) %} | ||
{{ h.rendered_resource_view(resource_view, resource, package) }} | ||
{% else %} | ||
{# When previewing we neet 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(controller='package', action='resource_view', id=package['name'], resource_id=resource['id']) + '?' + h.urlencode({'resource_view': h.dump_json(resource_view)}) %} | ||
<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 src = h.url(controller='package', action='resource_view', id=package['name'], resource_id=resource['id'], view_id=resource_view['id']) %} | ||
{% else %} | ||
{# When previewing we neet 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(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"> | ||
<p>{{ _('Your browser does not support iframes.') }}</p> | ||
</iframe> | ||
{% endif %} | ||
<iframe src="{{ src }}" frameborder="0" width="100%" data-module="data-viewer"> | ||
<p>{{ _('Your browser does not support iframes.') }}</p> | ||
</iframe> | ||
{% endif %} | ||
</div> | ||
</div> |
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
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,32 +1,39 @@ | ||
{% extends "package/base.html" %} | ||
{% extends "package/resource_edit_base.html" %} | ||
|
||
{% set logged_in = true if c.userobj else false %} | ||
{% set res = c.resource %} | ||
|
||
{% block breadcrumb_content_selected %}{% endblock %} | ||
|
||
{% block breadcrumb_content %} | ||
{{ super() }} | ||
{% endblock %} | ||
{% block breadcrumb_edit_selected %}{% endblock %} | ||
|
||
{% block content_action %} | ||
{% link_for _('All Views'), controller='package', action='resource_views', id=pkg.name, resource_id=res.id, class_='btn', icon='arrow-left' %} | ||
{% link_for _('All views'), controller='package', action='resource_views', id=pkg.name, resource_id=res.id, class_='btn', icon='arrow-left' %} | ||
{% if res %} | ||
{% link_for _('View view'), controller='package', action='resource_read', id=pkg.name, resource_id=res.id, class_='btn', icon='eye-open' %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block content_primary_nav %} | ||
{% endblock %} | ||
{% block content_primary_nav %}{% endblock %} | ||
|
||
{% block primary_content_inner %} | ||
{% block form %}{% endblock %} | ||
{% endblock %} | ||
|
||
{% block main_content %} | ||
{{ super() }} | ||
{% if to_preview %} | ||
{% snippet 'package/snippets/resource_view.html', resource_view=resource_view, resource=resource, package=package, to_preview=True %} | ||
<div class="wrapper no-nav"> | ||
<section class="module module-narrow module-shallow"> | ||
<h2 class="module-heading"> | ||
<i class="icon-picture"></i> {{ _('View preview') }} | ||
</h2> | ||
<div class="module-content"> | ||
{% snippet 'package/snippets/resource_view.html', resource_view=resource_view, resource=resource, package=package, to_preview=True %} | ||
</div> | ||
</section> | ||
</div> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block secondary_content %} | ||
{% snippet 'package/snippets/view_help.html' %} | ||
{% endblock %} | ||
|
||
{% block scripts %} | ||
{{ super() }} | ||
{% endblock %} |