Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming groups to joint analysis #249

Merged
merged 1 commit into from
Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ckanext/knowledgehub/controllers/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def pager_url(q=None, page=None):

default_facet_titles = {
'organization': _('Organizations'),
'groups': _('Groups'),
'groups': _('Joint Analysis'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license_id': _('Licenses'),
Expand Down
43 changes: 43 additions & 0 deletions ckanext/knowledgehub/templates/group/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% extends "page.html" %}

{% block subtitle %}{{ _('Joint Analysis') }}{% endblock %}

{% block breadcrumb_content %}
<li class="active">{% link_for _('Joint Analysis'), controller='group', action='index', named_route=group_type + '_index' %}</li>
{% endblock %}

{% block page_header %}{% endblock %}

{% block page_primary_action %}
{% if h.check_access('group_create') %}
{% link_for _('Add Joint Analysis'), controller='group', action='new', class_='btn btn-primary', icon='plus-square', named_route=group_type + '_new' %}
{% endif %}
{% endblock %}

{% block primary_content_inner %}
<h1 class="hide-heading">{{ _('Joint Analysis') }}</h1>
{% block groups_search_form %}
{% snippet 'snippets/search_form.html', form_id='group-search-form', type='group', query=c.q, sorting_selected=c.sort_by_selected, count=c.page.item_count, placeholder=_('Search joint analysis...'), show_empty=request.params, no_bottom_border=true if c.page.items, sorting = [(_('Name Ascending'), 'title asc'), (_('Name Descending'), 'title desc')] %}
{% endblock %}
{% block groups_list %}
{% if c.page.items or request.params %}
{% if c.page.items %}
{% snippet "group/snippets/group_list.html", groups=c.page.items %}
{% endif %}
{% else %}
<p class="empty">
{{ _('There are currently no joint analysis for this site') }}.
{% if h.check_access('group_create') %}
{% link_for _('How about creating one?'), controller='group', action='new' %}</a>.
{% endif %}
</p>
{% endif %}
{% endblock %}
{% block page_pagination %}
{{ c.page.pager(q=c.q or '', sort=c.sort_by_selected or '') }}
{% endblock %}
{% endblock %}

{% block secondary_content %}
{% snippet "group/snippets/helper.html" %}
{% endblock %}
13 changes: 13 additions & 0 deletions ckanext/knowledgehub/templates/group/new.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "group/base_form_page.html" %}

{% block subtitle %}{{ _('Create a Joint Analysis') }}{% endblock %}

{% block breadcrumb_link %}{{ h.nav_link(_('Create a Joint Analysis'), controller='group', action='edit', id=c.group.name) }}{% endblock %}

{% block page_heading %}{{ _('Create a Joint Analysis') }}{% endblock %}

{% block page_header %}{% endblock %}

{% block secondary_content %}
{% snippet "group/snippets/helper.html" %}
{% endblock %}
25 changes: 25 additions & 0 deletions ckanext/knowledgehub/templates/group/new_group_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends "group/snippets/group_form.html" %}

{#
As the form is rendered as a seperate page we take advantage of this by
overriding the form blocks depending on the current context
#}
{% block dataset_fields %}
{% if action == "edit" %}{{ super() }}{% endif %}
{% endblock %}

{% block custom_fields %}
{% if action == "edit" %}{{ super() }}{% endif %}
{% endblock %}

{% block save_text %}
{%- if action == "edit" -%}
{{ _('Update Joint Analysis') }}
{%- else -%}
{{ _('Create Joint Analysis') }}
{%- endif -%}
{% endblock %}

{% block delete_button %}
{% if action == "edit" %}{{ super() }}{% endif %}
{% endblock %}
42 changes: 42 additions & 0 deletions ckanext/knowledgehub/templates/group/snippets/group_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% import 'macros/form.html' as form %}

<form id="group-edit" class="dataset-form" method="post" data-module="basic-form" enctype="multipart/form-data">
{% block error_summary %}
{{ form.errors(error_summary) }}
{% endblock %}

{% block basic_fields %}
{% set attrs = {'data-module': 'slug-preview-target', 'class': 'form-control'} %}
{{ form.input('title', label=_('Name'), id='field-name', placeholder=_('My Joint Analysis'), value=data.title, error=errors.title, classes=['control-full'], attrs=attrs) }}

{%- set prefix = h.url_for(group_type + '_read', id='') -%}
{%- set domain = h.url_for(group_type + '_read', id='', qualified=true) -%}
{% set domain = domain|replace("http://", "")|replace("https://", "") %}
{% set attrs = {'data-module': 'slug-preview-slug', 'class': 'form-control input-sm', 'data-module-prefix': domain, 'data-module-placeholder': '<' + group_type + '>'} %}

{{ form.prepend('name', label=_('URL'), prepend=prefix, id='field-url', placeholder=_('my-' + group_type), value=data.name, error=errors.name, attrs=attrs, is_required=true) }}

{{ form.markdown('description', label=_('Description'), id='field-description', placeholder=_('A little information about my joint analysis...'), value=data.description, error=errors.description) }}

{% set is_upload = data.image_url and not data.image_url.startswith('http') %}
{% set is_url = data.image_url and data.image_url.startswith('http') %}

{{ form.image_upload(data, errors, is_upload_enabled=h.uploads_enabled(), is_url=is_url, is_upload=is_upload) }}

{% endblock %}

{% block custom_fields %}
{% snippet 'snippets/custom_form_fields.html', extras=data.extras, errors=errors, limit=3 %}
{% endblock %}

{{ form.required_message() }}

<div class="form-actions">
{% block delete_button %}
{% if h.check_access('group_delete', {'id': data.id}) %}
<a class="btn btn-danger pull-left" href="{% url_for controller='group', action='delete', id=data.id %}" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this Joint Analysis?') }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
{% endif %}
{% endblock %}
<button class="btn btn-primary" name="save" type="submit">{% block save_text %}{{ _('Save Joint Analysis') }}{% endblock %}</button>
</div>
</form>
16 changes: 16 additions & 0 deletions ckanext/knowledgehub/templates/group/snippets/helper.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="fa fa-info-circle"></i>
{{ _('What are Joint Analysis?') }}
</h2>
<div class="module-content">
<p>
{% trans %}
You can use joint analysis to create and manage collections of datasets.
This could be to catalogue datasets for a particular project or team,
or on a particular theme, or as a very simple way to help people find
and search your own published datasets.
{% endtrans %}
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion ckanext/knowledgehub/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{{ h.build_nav_main(
('search', _('Datasets')),
('organizations_index', _('Organizations')),
('group_index', _('Groups')),
('group_index', _('Joint Analysis')),
('datarequests_index', _('Data Requests') + h.get_open_datarequests_badge()),
('dashboards.index', _('Dashboards')),
('home.about', _('About'))
Expand Down
7 changes: 7 additions & 0 deletions ckanext/knowledgehub/templates/package/read_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% ckan_extends %}
{% block content_primary_nav %}
{{ h.build_nav_icon('dataset_read', _('Dataset'), id=pkg.name) }}
{{ h.build_nav_icon('dataset_groups', _('Joint Analysis'), id=pkg.name) }}
{{ h.build_nav_icon('dataset_activity', _('Activity Stream'), id=pkg.name) }}
{% endblock %}
{{ super() }}
59 changes: 59 additions & 0 deletions ckanext/knowledgehub/templates/snippets/search_result_text.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{#

Displays a test for results of a search.

query - The text that was searched for
count - The number of results for the search
type - Search result type (dataset, group, organization)

Example:

{% snippet 'snippets/search_result_text.html', query=query, count=count, type='dataset' %}

#}
{% if type == 'dataset' %}
{% set text_query = ungettext('{number} dataset found for "{query}"', '{number} datasets found for "{query}"', count) %}
{% set text_query_none = _('No datasets found for "{query}"') %}
{% set text_no_query = ungettext('{number} dataset found', '{number} datasets found', count) %}
{% set text_no_query_none = _('No datasets found') %}

{% elif type == 'group' %}
{% set text_query = ungettext('{number} joint analysis found for "{query}"', '{number} joint analysis found for "{query}"', count) %}
{% set text_query_none = _('No joint analysis found for "{query}"') %}
{% set text_no_query = ungettext('{number} joint analysis found', '{number} joint analysis found', count) %}
{% set text_no_query_none = _('No joint analysis found') %}

{% elif type == 'organization' %}
{% set text_query = ungettext('{number} organization found for "{query}"', '{number} organizations found for "{query}"', count) %}
{% set text_query_none = _('No organizations found for "{query}"') %}
{% set text_no_query = ungettext('{number} organization found', '{number} organizations found', count) %}
{% set text_no_query_none = _('No organizations found') %}

{% else %}
{% set text_query_singular = '{number} ' + type + ' found for "{query}"' %}
{% set text_query_plural = '{number} ' + type + 's found for "{query}"' %}
{% set text_query_none_plural = 'No ' + type + 's found for "{query}"' %}
{% set text_no_query_singular = '{number} ' + type + ' found' %}
{% set text_no_query_plural = '{number} ' + type + 's found' %}
{% set text_no_query_none_plural = 'No ' + type + 's found' %}

{% set text_query = ungettext(text_query_singular, text_query_plural, count) %}
{% set text_query_none = _(text_query_none_plural) %}
{% set text_no_query = ungettext(text_no_query_singular, text_no_query_plural, count) %}
{% set text_no_query_none = _(text_no_query_none_plural) %}
{%- endif -%}

{% if query %}
{%- if count -%}
{{ text_query.format(number=h.localised_number(count), query=query, type=type) }}
{%- else -%}
{{ text_query_none.format(query=query, type=type) }}
{%- endif -%}
{%- else -%}
{%- if count -%}
{{ text_no_query.format(number=h.localised_number(count), type=type) }}
{%- else -%}
{{ text_no_query_none.format(type=type) }}
{%- endif -%}
{%- endif -%}

17 changes: 17 additions & 0 deletions ckanext/knowledgehub/templates/user/dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% ckan_extends %}

{% block page_header %}
<header class="module-content page-header hug">
<div class="content_action">
{% link_for _('Edit settings'), named_route='user.edit', id=user.name, class_='btn btn-default', icon='cog' %}
</div>
<ul class="nav nav-tabs">
{{ h.build_nav_icon('dashboard.index', _('News feed')) }}
{{ h.build_nav_icon('dashboard.datasets', _('My Datasets')) }}
{{ h.build_nav_icon('dashboard.organizations', _('My Organizations')) }}
{{ h.build_nav_icon('dashboard.groups', _('My Joint Analysis')) }}
</ul>
</header>
{% endblock %}

{{ super() }}