-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
578 additions
and
238 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,2 +1,3 @@ | ||
recursive-include ckanext/privatedatasets/templates * | ||
recursive-include ckanext/privatedatasets/fanstatic * | ||
recursive-include ckanext/privatedatasets/templates_2.8 * | ||
recursive-include ckanext/privatedatasets/fanstatic * |
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -46,4 +46,4 @@ <h2 class="page-heading"> | |
{% endblock %} | ||
</div> | ||
</article> | ||
{% endblock %} | ||
{% 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
107 changes: 107 additions & 0 deletions
107
ckanext/privatedatasets/templates_2.8/package/snippets/package_basic_fields.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 |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{% ckan_extends %} | ||
|
||
{% block package_basic_fields_org %} | ||
|
||
{% resource 'privatedatasets/allowed_users.js' %} | ||
|
||
{# if we have a default group then this wants remembering #} | ||
{% if data.group_id %} | ||
<input type="hidden" name="groups__0__id" value="{{ data.group_id }}" /> | ||
{% endif %} | ||
|
||
{% set dataset_is_draft = data.get('state', 'draft').startswith('draft') or data.get('state', 'none') == 'none' %} | ||
{% set dataset_has_organization = data.owner_org or data.group_id %} | ||
{% set organizations_available = h.organizations_available('create_dataset') %} | ||
{% set user_is_sysadmin = h.check_access('sysadmin') %} | ||
{% set show_organizations_selector = organizations_available and (user_is_sysadmin or dataset_is_draft) %} | ||
{% set editing = 'id' in data %} | ||
|
||
{% if show_organizations_selector and show_visibility_selector %} | ||
<div> | ||
{% endif %} | ||
|
||
{% if show_organizations_selector %} | ||
{% set existing_org = data.owner_org or data.group_id %} | ||
<div class="control-group"> | ||
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label> | ||
<div class="controls"> | ||
<select id="field-organizations" name="owner_org" data-module="autocomplete"> | ||
{% if h.check_config_permission('create_unowned_dataset') %} | ||
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('No organization') }}</option> | ||
{% endif %} | ||
{% for organization in organizations_available %} | ||
{# get out first org from users list only if there is not an existing org #} | ||
{% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and not data.id and organization.id == organizations_available[0].id) %} | ||
<option value="{{ organization.id }}" {% if selected_org %} selected="selected" {% endif %}>{{ organization.name }}</option> | ||
{% endfor %} | ||
</select> | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% block package_metadata_fields_visibility %} | ||
<div class="control-group"> | ||
<label for="field-private" class="control-label">{{ _('Visibility') }}</label> | ||
<div class="controls"> | ||
<select id="field-private" name="private" data-module="allowed-users"> | ||
{% for option in [('True', _('Private')), ('False', _('Public'))] %} | ||
<option value="{{ option[0] }}" {% if option[0] == data.private|trim %}selected="selected"{% endif %}>{{ option[1] }}</option> | ||
{% endfor %} | ||
</select> | ||
<span class="info-block info-inline"> | ||
<i class="icon-info-sign fa fa-info-circle"></i> | ||
{% trans %} | ||
Private datasets can only be accessed by certain users, while public datasets can be accessed by anyone. | ||
{% endtrans %} | ||
</span> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block package_metadata_fields_protected %} | ||
<div class="control-group"> | ||
<label for="field-searchable" class="control-label">{{ _('Searchable') }}</label> | ||
<div class="controls"> | ||
<select id="field-searchable" name="searchable"> | ||
{% for option in [('True', _('True')), ('False', _('False'))] %} | ||
<option value="{{ option[0] }}" {% if option[0] == data.searchable|trim %}selected="selected"{% endif %}>{{ option[1] }}</option> | ||
{% endfor %} | ||
</select> | ||
<span class="info-block info-inline"> | ||
<i class="icon-info-sign fa fa-info-circle"></i> | ||
{% trans %} | ||
Searchable datasets can be searched by anyone, while not-searchable datasets can only be accessed by entering directly its URL. | ||
{% endtrans %} | ||
</span> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
|
||
{% if show_organizations_selector and show_visibility_selector %} | ||
</div> | ||
{% endif %} | ||
|
||
{% set users_attrs = {'data-module': 'autocomplete', 'data-module-tags': '', 'data-module-source': '/api/2/util/user/autocomplete?q=?'} %} | ||
{{ form.input('allowed_users_str', label=_('Allowed Users'), id='field-allowed_users_str', placeholder=_('Allowed Users'), value=h.get_allowed_users_str(data.allowed_users), error=errors.custom_text, classes=['control-full'], attrs=users_attrs) }} | ||
|
||
|
||
{% if editing and h.show_acquire_url_on_edit() or not editing and h.show_acquire_url_on_create() %} | ||
{{ form.input('acquire_url', label=_('Acquire URL'), id='field-acquire_url', placeholder=_('http://example.com/acquire/'), value=data.acquire_url, error=errors.custom_text, classes=['control-medium']) }} | ||
{% else %} | ||
<input type="hidden" name="acquire_url" id="acquire_url" value="{{ data.acquire_url }}" /> | ||
{% endif %} | ||
|
||
{% if data.id and h.check_access('package_delete', {'id': data.id}) and data.state != 'active' %} | ||
<div class="control-group"> | ||
<label for="field-state" class="control-label">{{ _('State') }}</label> | ||
<div class="controls"> | ||
<select id="field-state" name="state"> | ||
<option value="active" {% if data.get('state', 'none') == 'active' %} selected="selected" {% endif %}>{{ _('Active') }}</option> | ||
<option value="deleted" {% if data.get('state', 'none') == 'deleted' %} selected="selected" {% endif %}>{{ _('Deleted') }}</option> | ||
</select> | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% endblock %} |
15 changes: 15 additions & 0 deletions
15
ckanext/privatedatasets/templates_2.8/snippets/acquire_button.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{# | ||
|
||
Displays a Get Access button to request access to a private dataset. | ||
|
||
ulr_dest - target url | ||
|
||
Example: | ||
|
||
{% snippet 'snippets/acquire_button.html', url_dest=url %} | ||
|
||
#} | ||
<a href={{ url_dest }} class="btn btn-mini" target="_blank"> | ||
<i class="icon-shopping-cart fa fa-shopping-cart"></i> | ||
{{ _('Acquire') }} | ||
</a> |
82 changes: 82 additions & 0 deletions
82
ckanext/privatedatasets/templates_2.8/snippets/package_item.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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{# | ||
Displays a single of dataset. | ||
|
||
package - A package to display. | ||
item_class - The class name to use on the list item. | ||
hide_resources - If true hides the resources (default: false). | ||
banner - If true displays a popular banner (default: false). | ||
truncate - The length to trucate the description to (default: 180) | ||
truncate_title - The length to truncate the title to (default: 80). | ||
|
||
Example: | ||
|
||
{% snippet 'snippets/package_item.html', package=c.datasets[0] %} | ||
|
||
#} | ||
{% set truncate = truncate or 180 %} | ||
{% set truncate_title = truncate_title or 80 %} | ||
{% set title = package.title or package.name %} | ||
{% set notes = h.markdown_extract(package.notes, extract_length=truncate) %} | ||
{% set acquired = h.is_dataset_acquired(package) %} | ||
{% set owner = h.is_owner(package) %} | ||
|
||
{% resource 'privatedatasets/custom.css' %} | ||
|
||
<li class="{{ item_class or "dataset-item" }}"> | ||
{% block package_item_content %} | ||
<div class="dataset-content"> | ||
<h3 class="dataset-heading"> | ||
{% if package.private and not h.can_read(package) %} | ||
<span class="dataset-private label label-inverse"> | ||
<i class="icon-lock fa fa-lock"></i> | ||
{{ _('Private') }} | ||
</span> | ||
{% endif %} | ||
{% if acquired and not owner %} | ||
<span class="dataset-private label label-acquired"> | ||
<i class="icon-shopping-cart fa fa-shopping-cart"></i> | ||
{{ _('Acquired') }} | ||
</span> | ||
{% endif %} | ||
{% if owner %} | ||
<span class="dataset-private label label-owner"> | ||
<i class="icon-user fa fa-user"></i> | ||
{{ _('Owner') }} | ||
</span> | ||
{% endif %} | ||
|
||
<!-- Customizations Acquire Button --> | ||
{% if package.private and not h.can_read(package) %} | ||
{{ _(h.truncate(title, truncate_title)) }} | ||
<div class="divider"/> | ||
{{ h.acquire_button(package) }} | ||
{% else %} | ||
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }} | ||
{% endif %} | ||
<!-- End of customizations Acquire Button --> | ||
|
||
{% if package.get('state', '').startswith('draft') %} | ||
<span class="label label-info">{{ _('Draft') }}</span> | ||
{% elif package.get('state', '').startswith('deleted') %} | ||
<span class="label label-important">{{ _('Deleted') }}</span> | ||
{% endif %} | ||
{{ h.popular('recent views', package.tracking_summary.recent, min=10) if package.tracking_summary }} | ||
</h3> | ||
{% if banner %} | ||
<span class="banner">{{ _('Popular') }}</span> | ||
{% endif %} | ||
{% if notes %} | ||
<div>{{ notes|urlize }}</div> | ||
{% endif %} | ||
</div> | ||
{% if package.resources and not hide_resources %} | ||
<ul class="dataset-resources unstyled"> | ||
{% for resource in h.dict_list_reduce(package.resources, 'format') %} | ||
<li> | ||
<a href="{{ h.url_for(controller='package', action='read', id=package.name) }}" class="label" data-format="{{ resource.lower() }}">{{ resource }}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% endblock %} | ||
</li> |
Oops, something went wrong.