forked from datopian/ckanext-iaea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrates dataset view templates and snippets.
- Loading branch information
Showing
11 changed files
with
693 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class RestrictMiddleware(object): | ||
|
||
def __init__(self, app, app_config): | ||
self.app=app | ||
|
||
def __call__(self, environ, start_response): | ||
ui_path = environ.get('PATH_INFO') | ||
|
||
if ui_path == "/stats" and not 'repoze.who.identity' in environ: | ||
|
||
status = u'404 Not Found' | ||
location = u'/user/login' | ||
headers = [(u'Location',location), (u'Content-type', u'text/plain')] | ||
body='Not authorized to see this page' | ||
start_response (status, headers) | ||
return[body] | ||
else: | ||
return self.app(environ, start_response) |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{% extends "page.html" %} | ||
|
||
{% set pkg = c.pkg_dict or pkg_dict %} | ||
{% set current_url = h.full_current_url() %} | ||
|
||
{% block breadcrumb_content_selected %} class="active"{% endblock %} | ||
|
||
{% block subtitle %}{{ _('Datasets') }}{% endblock %} | ||
|
||
{% block breadcrumb_content %} | ||
{% if pkg %} | ||
{% set dataset = h.dataset_display_name(pkg) %} | ||
{% if pkg.organization %} | ||
{% set organization = h.get_translated(pkg.organization, 'title') or pkg.organization.name %} | ||
{% set group_type = pkg.organization.type %} | ||
<li>{% link_for _('Organizations'), controller='organization', action='index', named_route=group_type + '_index' %}</li> | ||
<li>{% link_for organization|truncate(30), controller='organization', action='read', id=pkg.organization.name, | ||
named_route=group_type + '_read' %}</li> | ||
{% else %} | ||
<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li> | ||
{% endif %} | ||
<li{{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), controller='dataset', action='read', | ||
id=pkg.name %}</li> | ||
{% else %} | ||
<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li> | ||
<li class="active"><a href="">{{ _('Create Dataset') }}</a></li> | ||
{% endif %} | ||
{% 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends "package/read_base.html" %} | ||
|
||
{% block primary_content_inner %} | ||
{% if package_views %} | ||
|
||
<form action="#" method="post"> | ||
<fieldset class="fields-feature-view form-group"> | ||
<p>Select a view that should be featured on the dataset page.</p> | ||
{% for resource in package_views %} | ||
<h3> {{ resource.resource_name }}</h3> | ||
{% for view in resource.views %} | ||
<div class="radio-groups"> | ||
{% set view_url = h.url_for(qualified=True, controller='dataset_resource', | ||
action='view', id=pkg['name'], | ||
resource_id=view.resource_id, | ||
view_id=view.id) %} | ||
{% if pkg['featured_view'] == view.id %} | ||
<input id="featured_view" name="featured_view" type="radio" class="radio" value="{{view.id}}" checked /> | ||
<span><a href="{{view_url}}" target="_blank">{{view.title}}</a></span> | ||
{% else %} | ||
<input id="featured_view" name="featured_view" type="radio" class="radio" value="{{view.id}}" /> | ||
<span><a href="{{view_url}}" target="_blank">{{view.title}}</a></span> | ||
{% endif %} | ||
</div> | ||
{% endfor %} | ||
{% endfor %} | ||
</fieldset> | ||
|
||
<div class="form-actions"> | ||
<input type="submit" class="btn btn-primary" name="submit" value="submit" /> | ||
<input type="submit" class="btn btn-danger" name="submit" value="clear" /> | ||
</div> | ||
</form> | ||
{% else %} | ||
<p>{{ _("There are no views created for this dataset yet.") }}</p> | ||
{% endif %} | ||
{% 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% extends "package/read_base.html" %} | ||
{# Reuse of activity template for additonal info#} | ||
|
||
{% block primary_content_inner %} | ||
{% snippet "package/snippets/additional_info.html", pkg_dict=pkg %} | ||
{% 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% ckan_extends %} | ||
|
||
{% block package_description %} | ||
{% endblock %} | ||
|
||
{% block package_resources %} | ||
{% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %} | ||
{% endblock %} | ||
|
||
{% block package_additional_info %} | ||
{% endblock %} |
Oops, something went wrong.