diff --git a/ckanext/odsh/templates/datarequests/base.html b/ckanext/odsh/templates/datarequests/base.html deleted file mode 100644 index 5722356efbd3f3694eac9923b5566e5206a4495c..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/base.html +++ /dev/null @@ -1,55 +0,0 @@ -{% extends "page.html" %} - -{% block styles %} - {{ super() }} - <link rel="stylesheet" href="/datarequests.css" /> -{% endblock %} - -{% block subtitle %} -{% endblock %} - -{% block breadcrumb_content %} - <li class="active">{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> -{% endblock %} - - {% block main_content %} - - {% block flash %} - {{ super() }} - {% endblock %} - - {% block toolbar %} - {{ super() }} - {% endblock %} - - <div class="datarequest row wrapper{% block wrapper_class %}{% endblock %}{% if self.secondary()|trim == '' %} no-nav{% endif %} is-table-row"> - {# - The pre_primary block can be used to add content to before the - rendering of the main content columns of the page. - #} - {% block pre_primary %} - {% endblock %} - - - {% block primary %} - <div class="primary span9"> - {% block primary_content %} - {{ super() }} - {% endblock %} - </div> - {% endblock %} - - {% block secondary %} - <aside class="secondary span3"> - {% block secondary_content %} - {{ super() }} - {% endblock %} - </aside> - {% endblock %} - - </div> - {% block pre_wrap %} - {% endblock %} - {% endblock %} - </div> -</div> diff --git a/ckanext/odsh/templates/datarequests/close.html b/ckanext/odsh/templates/datarequests/close.html deleted file mode 100644 index 0b3e115cbf58638e539abd37db0ecf5c9f55b6d1..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/close.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "datarequests/base.html" %} - -{% block subtitle %}{{ _('Close Data Proposal') }}{% endblock %} - -{% block breadcrumb_content %} - <li>{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> - <li>{% link_for c.datarequest.get('title')|truncate(30), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.show', id=c.datarequest.get('id') %}</li> - <li class="active"><a href="">{{ _('Close Data Proposal') }}</a></li> -{% endblock %} - -{% block primary_content_inner %} - <h1 class="{% block page_heading_class %}page-heading{% endblock %}">{% block page_heading %}{{ _('Close Data Proposal') }}{% endblock %}</h1> - {% snippet "datarequests/snippets/close_datarequest_form.html", datarequest=c.datarequest, datasets=c.datasets, errors=c.errors, errors_summary=c.errors_summary %} -{% endblock %} - -{% block page_header %}{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/comment.html b/ckanext/odsh/templates/datarequests/comment.html deleted file mode 100644 index 8551f1939cefa841ed26ea97180a3cdf65ec093e..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/comment.html +++ /dev/null @@ -1,85 +0,0 @@ -{% extends "datarequests/show.html" %} - -{% block breadcrumb_content %} - {{ super() }} -{% endblock %} - -{% block content_action %} -{% endblock %} - -{% block content_primary_nav %} -{% endblock %} - -{% block subtitle %} -{% endblock %} - -{% block primary_content_inner %} - {% if h.check_access('update_datarequest', {'id':datarequest_id }) %} - {% link_for _('Manage'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.update', id=datarequest_id, class_='btn btn-default', icon='wrench' %} - {% endif %} - - {% if h.check_access('close_datarequest', {'id':datarequest_id }) and not c.datarequest.closed %} - {% link_for _('Close'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.close', id=datarequest_id, class_='btn btn-danger', icon='lock' %} - {% endif %} - -<h2 class="page-heading"> - {% block page_heading %} - {{c.datarequest.title}} - {% endblock %} -</h2> - -<div class='datarequest-primary'> -{{ h.render_markdown(h.get_translated(c.datarequest, 'description')) }} - - {% snippet "datarequests/snippets/comments.html", comments=c.comments, datarequest=c.datarequest, errors=c.errors, errors_summary=c.errors_summary, updated_comment=c.updated_comment %} - - {% if h.check_access('comment_datarequest', {'id':c.datarequest.id }) %} - <h2 class='comments-heading'>{{_('Add New Comment')}}:</h2> - <div > - - {% set create_comment_error = c.updated_comment is defined and c.updated_comment.id == '' %} - - {% if create_comment_error %} - <a name="comment_focus"></a> - {% endif %} - - {% snippet "datarequests/snippets/comment_form.html", datarequest=c.datarequest, errors=c.errors, errors_summary=c.errors_summary, offering=c.offering, initial_text=c.updated_comment.comment if create_comment_error, focus=create_comment_error, current_user=c.userobj %} - </div> - {% endif %} -</div> - -<section class="additional-info"> - {% block package_additional_info %} - <div>{{ _('Released') }}: {{ h.odsh_render_datetime(c.datarequest.open_time) }}</div> - <div>{{ _('Suggester') }}: {{ c.datarequest.user['display_name'] if c.datarequest.user else _('None') }}</div> - {#<td class="dataset-details" title="{{ c.datarequest.close_time }}">{{ h.time_ago_from_timestamp(c.datarequest.close_time) if c.datarequest.close_time else _('Not closed yet') }}</td>#} - <div >{{ _('Status') }}: - <div class="dataset-details"> - {% if c.datarequest.get('closed', False) %} - <div class="badge label-closed"> - {% trans %}Done{% endtrans %} - </div> - {% else %} - <div class="badge label-open"> - {% trans %}Open{% endtrans %} - </div> - {% endif %} - </div> - {#{% if c.datarequest.closed %} - <tr> - <th scope="row" class="dataset-label">{{ _('Accepted Dataset') }}</th> - <td class="dataset-details"> - {% if c.datarequest.accepted_dataset %} - {% link_for c.datarequest.accepted_dataset['title'], named_route='dataset.read', id=c.datarequest.accepted_dataset.get('id') %} - {% else %} - {{ _('None') }} - {% endif %} - </td> - </tr> - {% endif %} - #} - <div class='comment-count-wrapper'><i class="icon-comment fa fa-comment"></i> {{ h.get_comments_number(c.datarequest.get('id', '')) }}</span> </div> - {% endblock %} -</section> - -{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/edit.html b/ckanext/odsh/templates/datarequests/edit.html deleted file mode 100644 index ae3013703449b03a41d4687384428d435650967d..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/edit.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "datarequests/base.html" %} - -{% block subtitle %}{{ _('Edit Data Proposal') }}{% endblock %} - -{% block breadcrumb_content %} - <li>{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> - <li>{% link_for c.original_title|truncate(30), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.show', id=c.datarequest.get('id') %}</li> - <li class="active"><a href="">{{ _('Edit Data Proposal') }}</a></li> -{% endblock %} - -{% block primary_content_inner %} - <h1 class="{% block page_heading_class %}page-heading{% endblock %}">{% block page_heading %}{{ _('Edit Data Proposal') }}{% endblock %}</h1> - {% snippet "datarequests/snippets/edit_datarequest_form.html", data=c.datarequest, errors=c.errors, errors_summary=c.errors_summary, offering=c.offering %} -{% endblock %} - -{% block page_header %}{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/index.html b/ckanext/odsh/templates/datarequests/index.html deleted file mode 100644 index d44ea2180a4c6d2e3803d0a26c76d6ce65a6b2ed..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/index.html +++ /dev/null @@ -1,32 +0,0 @@ -{% extends "datarequests/base.html" %} - -{% block primary_content %} - <section class="module"> - <div class="module-content"> - {% block page_primary_action %} - <form id='datarequest-search-form' method="get" data-module="select-switch"> - {% snippet 'snippets/custom_search_form.html', form_id='datarequest-search-form', query=c.q, fields=(('organization', c.organization), ('state', c.state)), sorting=c.filters, sorting_selected=c.sort, placeholder=_('Search Data Requests...'), no_bottom_border=false, count=c.datarequest_count, no_title=True, type='datarequest' %} - {{ h.snippet('datarequests/snippets/datarequest_list.html', datarequest_count=c.datarequest_count, datarequests=c.datarequests, page=c.page, q=c.q)}} - {% if h.check_access('create_datarequest') %} - <div class="add_request_container"> - {% link_for _('Add Request'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.new', class_='btn btn-primary', icon=h.get_plus_icon() %} - </div> - {% endif %} - {% endblock %} - </div> - </section> -{% endblock %} - -{% block secondary%} -{% endblock %} - -{#{% block secondary_content %} - {{ super() }} - {% for facet in c.facet_titles %} - {{ h.snippet('snippets/facet_list.html', title=c.facet_titles[facet], name=facet) }} - {% endfor %} -{% endblock %}#} - -{% block pre_wrap %} -</form> -{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/new.html b/ckanext/odsh/templates/datarequests/new.html deleted file mode 100644 index 1cf63c2e0c15eaecc5cb421a741dde40f846957b..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/new.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "datarequests/base.html" %} - -{% block subtitle %}{{ _('Create Data Request') }}{% endblock %} - -{% block breadcrumb_content %} - <li>{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> - <li class="active"><a href="">{{ _('Create Data Proposal') }}</a></li> -{% endblock %} - -{% block primary_content_inner %} - <h1 class="{% block page_heading_class %}page-heading{% endblock %}">{% block page_heading %}{{ _('Create New Data Request') }}{% endblock %}</h1> - {% snippet "datarequests/snippets/new_datarequest_form.html", data=c.datarequest, errors=c.errors, errors_summary=c.errors_summary, offering=c.offering %} -{% endblock %} - -{% block secondary %} -{% endblock %} - -{% block page_header %}{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/show.html b/ckanext/odsh/templates/datarequests/show.html deleted file mode 100644 index 82c3983b08b6bf5180da5d13365d0c7e612ffc95..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/show.html +++ /dev/null @@ -1,68 +0,0 @@ -{% extends "datarequests/base.html" %} - -{% block title %}{{_('Data Request')}} {{c.datarequest.get('title', '')}}{% endblock %} - -{% set datarequest_id = c.datarequest.get('id') %} - -{% block breadcrumb_content %} - <li>{% link_for _('Data Requests'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> - <li>{% link_for c.datarequest.get('title'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.show', id=datarequest_id %}</li> -{% endblock %} - -{% block content_action %} - - {% if h.check_access('update_datarequest', {'id':datarequest_id }) %} - {% link_for _('Manage'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.update', id=datarequest_id, class_='btn btn-default', icon='wrench' %} - {% endif %} - - {% if h.check_access('close_datarequest', {'id':datarequest_id }) and not c.datarequest.closed %} - {% link_for _('Close'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.close', id=datarequest_id, class_='btn btn-danger', icon='lock' %} - {% endif %} - -{% endblock %} - -{% block content_primary_nav %} - {{ h.build_nav_icon('show_datarequest', _('Data Request'), id=datarequest_id) }} -{% endblock %} - -{% block secondary %} -{% endblock %} - -{% block primary_content_inner %} - {% if c.datarequest.closed %} - <span class="uppercase badge label-closed pull-right"> - <i class="icon-lock fa fa-lock"></i> - {{ _('Closed') }} - </span> - {% else %} - <span class="uppercase badge label-open pull-right"> - <i class="icon-unlock fa fa-unlock"></i> - {{ _('Open') }} - </span> - {% endif %} - - <h1 class="{% block page_heading_class %}page-heading{% endblock %}">{% block page_heading %}{{ c.datarequest.get('title') }}{% endblock %}</h1> - - {% block datarequest_description %} - {% if c.datarequest.get('description') %} - <div class="notes embedded-content"> - {{ h.render_markdown(c.datarequest.get('description')) }} - </div> - {% endif %} - {% endblock %} - - {% block datarequest_additional_info %} - {% snippet "datarequests/snippets/additional_info.html", datarequest=c.datarequest %} - {% endblock %} - -{% if c.comments %} -{% for comment in c.comments %} -{% snippet "datarequests/snippets/comment_item.html", comment=c.comment, datarequest=c.datarequest, errors=c.errors, errors_summary=c.errors_summary, updated_comment=c.updated_comment %} -{% endfor %} -{% else %} -<p class="empty"> -{{ _('This data request has not been commented yet') }} -</p> -{% endif %} - -{% endblock %} diff --git a/ckanext/odsh/templates/datarequests/snippets/comment_form.html b/ckanext/odsh/templates/datarequests/snippets/comment_form.html deleted file mode 100644 index b768f40b43e9091911211c1a516b177ed9a299ee..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/snippets/comment_form.html +++ /dev/null @@ -1,28 +0,0 @@ -{% import 'macros/form.html' as form %} - -<form class="dataset-form {{ 'comment-edit-form' if comment_id else 'odsh-comment-wrapper' }} {{ 'hide' if comment_id and not (focus and errors) }} form-horizontal" id="comment-form{{ '-' + comment_id if comment_id }}" method="post" data-module="basic-form" action enctype="multipart/form-data"> - - - {% if focus %} - {% block errors %}{{ form.errors(errors_summary) }}{% endblock %} - {% endif %} - - - <input type="hidden" name="datarequest-id" value="{{ datarequest.get('id', '') }}" /> - <input type="hidden" name="comment-id" value="{{ comment_id if comment_id }}" /> - - <div class="controls control-full control-large control-group {{ 'error' if errors and errors.get('Comment') and focus }} editor"> - {% set markdown_tooltip = "<pre><p>__Bold text__ or _italic text_</p><p># title<br>## secondary title<br>### etc</p><p>* list<br>* of<br>* items</p><p>http://auto.link.ed/</p></pre><p><b><a href='http://daringfireball.net/projects/markdown/syntax' target='_blank'>Full markdown syntax</a></b></p><p class='muted'><b>Please note:</b> HTML tags are stripped out for security reasons</p>" %} - <textarea name="comment" cols="20" rows="9" placeholder="{{ _('Add a new Comment') if not comment_id }}">{{ initial_text }}</textarea> - </div> - - <div class="comment-form-actions"> - {% if comment_id %} - <button id="comment-discard-{{ comment_id }}" class="btn btn-danger" name="discard">{{ _('Cancel') }}</button> - <button class="btn btn-primary" type="submit" name="update">{{ _('Update Comment') }}</button> - {% else %} - <button class="btn btn-primary btn-arrow-right" type="submit" name="add">{{ _('Add New Comment') }}</button> - {% endif %} - </div> - -</form> diff --git a/ckanext/odsh/templates/datarequests/snippets/comment_item.html b/ckanext/odsh/templates/datarequests/snippets/comment_item.html deleted file mode 100644 index 625676a83b2940b6d1874ef2642c2cf3bdc90dd3..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/snippets/comment_item.html +++ /dev/null @@ -1,47 +0,0 @@ -{% set focus = updated_comment is not none and updated_comment.id == comment.id %} -{% set can_update = h.check_access('update_datarequest_comment', {'id':comment.id }) %} - -{% if focus %} - <a name="comment_focus"></a> -{% endif %} - -<div class="odsh-comment-wrapper"> - {# <a href="{{ h.url_for('user.read', id=comment.user.get('name')) }}" - class="comment-avatar"> - {{ h.gravatar(comment.user.get('email_hash'), 48) }} - </a> - #} - <div class=""> - <div class="odsh-comment-header"> - <div class="comment-actions"> - {# - {% if h.check_access('delete_datarequest_comment', {'id':comment.id }) %} - <div class="comment-action"> - {% set locale = h.dump_json({'content': _('Are you sure you want to delete this comment?')}) %} - <a class="subtle-btn" id="delete-comment-{{ comment.id }}" href="{% url_for 'ckanext.datarequests.controllers.ui_controller:DataRequestsUI.delete_comment', datarequest_id=datarequest.id, comment_id=comment.id %}" data-module="confirm-action" data-module-i18n="{{ locale }}"><i class="icon-remove fa fa-times"></i></a> - </div> - {% endif %} - {% if can_update %} - <div class="comment-action" id="edit-button"> - <button class="subtle-btn" id="update-comment-{{ comment.id }}" href=""><i class="icon-pencil fa fa-pencil"></i></button> - </div> - {% endif %} - #} - <div class="comment-header-text"> - <i class="icon-comment fa fa-comment"></i> - <a href="{{ h.url_for('user.read', id=comment.user.get('name')) }}" class="comment-author">{{ comment.user.get('display_name') }}</a> - <span class='comment-date' title="{{comment.time}}">{{ h.odsh_render_datetime(comment.time).lower() }}</span> - </div> - </div> - </div> - - <div class="odsh-comment-content {{ 'hide' if focus and errors }}" id="comment-{{ comment.id }}"> - {{ h.render_markdown(comment.comment|safe) }} - </div> - - {% if can_update %} - {% snippet "datarequests/snippets/comment_form.html", comment_id=comment.id, datarequest=datarequest, errors=errors, errors_summary=errors_summary, initial_text=updated_comment.comment if focus else comment.comment, focus=focus %} - {% endif %} - - </div> -</div> \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/snippets/comments.html b/ckanext/odsh/templates/datarequests/snippets/comments.html deleted file mode 100644 index 56f89e815b14940618571adcb93340ba1fe756ac..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/snippets/comments.html +++ /dev/null @@ -1,14 +0,0 @@ - - -<h2 class='comments-heading'>{{_('Comments')}}:</h2> - -{% if comments %} - {% for comment in comments %} - {% snippet "datarequests/snippets/comment_item.html", comment=comment, datarequest=datarequest, errors=errors, errors_summary=errors_summary, updated_comment=updated_comment %} - {% endfor %} -{% else %} - <p class="empty"> - {{ _('This data request has not been commented yet') }} - </p> -{% endif %} - diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html deleted file mode 100644 index a92d25aeb592e15a7493dd3363a2af33b1f4be07..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html +++ /dev/null @@ -1,37 +0,0 @@ -{% import 'macros/form.html' as form %} - -{% set title = data.get('title', '') %} -{% set description = data.get('description', '') %} -{% set organization_id = data.get('organization_id', h.get_request_param('organization')) %} -{% set organizations_available = h.organizations_available('read') %} - -{# This provides a full page that renders a form for publishing a dataset. It can -then itself be extended to add/remove blocks of functionality. #} -<form class="dataset-form" method="post" data-module="basic-form" action enctype="multipart/form-data"> - - <input type="hidden" id="id" name="id" value="{{ data.get('id', '') }}" /> - - {% block errors %}{{ form.errors(errors_summary) }}{% endblock %} - - {% block offering_title %} - {{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. Data Request Name'), value=title, error=errors['Title'], classes=['control-full'], is_required=true) }} - {% endblock %} - - {% block offering_description %} - {{ form.markdown('description', id='field-description', label=_('Description'), placeholder=_('eg. Data Request description'), value=description, error=errors['Description'], is_required=true) }} - {% endblock %} - - - {% block form_actions %} - <div class="form-actions"> - {% block delete_button %} - {% if h.check_access('delete_datarequest', {'id': data.get('id', '')}) and not data.state == 'deleted' %} - {% set locale = h.dump_json({'content': _('Are you sure you want to delete this data request?')}) %} - <a class="btn btn-danger pull-left" href="{% url_for 'ckanext.datarequests.controllers.ui_controller:DataRequestsUI.delete', id=data.get('id') %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a> - {% endif %} - {% endblock %} - <button class="btn btn-primary btn-arrow-right" type="submit" name="save">{% block save_button_text %}{{ _('Create Data Request') }}{% endblock %}</button> - </div> - {% endblock %} - -</form> \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_item.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_item.html deleted file mode 100644 index bc01f6b01e25ca639c3c2fb6f423d67a8390f3f9..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/snippets/datarequest_item.html +++ /dev/null @@ -1,42 +0,0 @@ -{% set truncate = truncate or 180 %} -{% set truncate_title = truncate_title or 80 %} -{% set title = datarequest.get('title', '') %} -{% set description = h.markdown_extract(datarequest.get('description', ''), extract_length=truncate) %} - -<div class="container-fluid odsh-dataset-item"> - {% block package_item_content %} - <div class="dataset-content"> - <div class="dataset-heading "> - <div class="span1"> - {% if datarequest.get('closed', False) %} - <div class="badge label-closed"> - {% trans %}Done{% endtrans %} - </div> - {% else %} - <div class="badge label-open"> - {% trans %}Open{% endtrans %} - </div> - {% endif %} - </div> - <div class='span9'> - <div class='datarequest-subtitle'> - <span class="datarequest-item-open-time">{{h.odsh_render_datetime(datarequest.open_time)}}</span> - <span class="datarequest-item-autor-name">{{datarequest.user['display_name']}}</span> - </div> - {{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='show', id=datarequest.get('id', ''))) }} - </div> - </div> - {% if description %} - <div>{{ description }}</div> - {% endif %} - {% if h.show_comments_tab() %} - <i class="icon-comment fa fa-comment"></i> {{ h.get_comments_number(datarequest.get('id', '')) }}</span> - {% endif %} - </div> - <div class="dataset-meta"> - {% if h.show_comments_tab() %} - {% link_for _('Add New Comment'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='comment', id=datarequest.get('id',''), class_='btn btn-primary btn-arrow-right' %} - {% endif %} - </div> - {% endblock %} -</div> \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html deleted file mode 100644 index c2ef8dac56cfa3121bc8f3eb1bd836bc3133fb3f..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html +++ /dev/null @@ -1,20 +0,0 @@ - -{% block datarequest_search_results_list %} - {% if datarequests %} - <div class="dataset-list unstyled"> - {% for datarequest in datarequests %} - {{ h.snippet('datarequests/snippets/datarequest_item.html', datarequest=datarequest, facet_titles=facet_titles) }} - {% endfor %} - </div> - {% else %} - <p class="empty"> - {{ _('No Data Requests found with the given criteria') }}. - {% if h.check_access('create_datarequest') %} - {% link_for _('How about creating one?'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.new' %}</a> - {% endif %} - </p> - {% endif %} -{% endblock %} -{% block page_pagination %} - {{ page.pager(q=q) }} -{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/datarequests/snippets/new_datarequest_form.html b/ckanext/odsh/templates/datarequests/snippets/new_datarequest_form.html deleted file mode 100644 index df537f6656c1e515ac0805153f740726e40f32e4..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/datarequests/snippets/new_datarequest_form.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "datarequests/snippets/datarequest_form.html" %} - -{% block delete_button %} -{% endblock %} - -{% block save_button_text %} - {{ _('Suggest New Data Request') }} -{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/snippets/search_form.html b/ckanext/odsh/templates/snippets/search_form.html index 78269118494ef5de1419b634c7d8a5aa739cb76f..99d17fe8e4b79b8751a0e8b1ea08f53d8a191a37 100644 --- a/ckanext/odsh/templates/snippets/search_form.html +++ b/ckanext/odsh/templates/snippets/search_form.html @@ -3,22 +3,20 @@ {% set placeholder = placeholder if placeholder else _('Search datasets...') %} {% set sorting_label_prefix = _('Order by') %} {% if type=='organization' %} -{% set sorting = sorting if sorting else [(_('Name Ascending'), 'name asc'), (_('Name Descending'), 'name desc')] %} -{% elif type=='datarequest' %} -{% set sorting = [(_('Date Ascending'), 'asc'), (_('Date Descending'), 'desc')] %} + {% set sorting = sorting if sorting else [(_('Name Ascending'), 'name asc'), (_('Name Descending'), 'name desc')] %} {% else %} -{% set sorting = [ - (_('Relevance'), 'score desc, metadata_modified desc'), - (_('Name Ascending'), 'title_string asc'), - (_('Name Descending'), 'title_string desc'), - (_('Issued Ascending'), 'extras_issued asc'), - (_('Issued Descending'), 'extras_issued desc'), - (_('Start Date Ascending'), 'temporal_start asc'), - (_('Start Date Descending'), 'temporal_start desc'), - (_('End Date Ascending'), 'temporal_end asc'), - (_('End Date Descending'), 'temporal_end desc'), - (_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ] - %} + {% set sorting = [ + (_('Relevance'), 'score desc, metadata_modified desc'), + (_('Name Ascending'), 'title_string asc'), + (_('Name Descending'), 'title_string desc'), + (_('Issued Ascending'), 'extras_issued asc'), + (_('Issued Descending'), 'extras_issued desc'), + (_('Start Date Ascending'), 'temporal_start asc'), + (_('Start Date Descending'), 'temporal_start desc'), + (_('End Date Ascending'), 'temporal_end asc'), + (_('End Date Descending'), 'temporal_end desc'), + (_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ] + %} {% endif %} {% set search_class = search_class if search_class else 'search-giant' %} {% set no_bottom_border = no_bottom_border if no_bottom_border else false %} @@ -26,176 +24,176 @@ <form {% if form_id %}id="{{ form_id }}" {% endif %}class="search-form{% if no_bottom_border %} no-bottom-border{% endif %}" method="get" data-module="select-switch"> - {% block search_input %} - {% endblock %} + {% block search_input %} + {% endblock %} - {% block search_search_fields %} + {% block search_search_fields %} {% if fields -%} - <span>{{ form.hidden_from_list(fields=fields) }}</span> + <span>{{ form.hidden_from_list(fields=fields) }}</span> {%- endif %} - {% endblock %} + {% endblock %} - {% block search_title %} + {% block search_title %} {% if not error %} - {% if force_title %} - <h2>{{force_title }}</h2> + {% if force_title %} + <h2>{{force_title }}</h2> + {% else %} + <h2>{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}</h2> + {% if type == 'dataset' %} + <a aria-label="{{ _('rss feeds') }}" href={{h.remove_url_param([''], controller='feeds', action='custom') }}> + <i aria-hidden="true" class="fa fa-solid fa-rss"></i> + </a> + {%- endif -%} + {% endif %} {% else %} - <h2>{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}</h2> - {% if type == 'dataset' %} - <a aria-label="{{ _('rss feeds') }}" href={{h.remove_url_param([''], controller='feeds', action='custom') }}> - <i aria-hidden="true" class="fa fa-solid fa-rss"></i> - </a> - {%- endif -%} + <h2>{{ _('Error') }}</h2> {% endif %} - {% else %} - <h2>Error</h2> - {% endif %} - {% endblock %} + {% endblock %} - {% block search_sortby %} + {% block search_sortby %} {% if sorting %} - <div class="form-group control-order-by"> + <div class="form-group control-order-by"> <select id="field-order-by" name="sort" aria-label="{{ sorting_label_prefix }} …"> - {% for label, value in sorting %} + {% for label, value in sorting %} {% if label and value %} - <option value="{{ value }}"{% if sorting_selected==value %} selected="selected" {% endif %}> + <option value="{{ value }}"{% if sorting_selected==value %} selected="selected" {% endif %}> {{ sorting_label_prefix }} {{ label }}</option> {% endif %} - {% endfor %} + {% endfor %} </select> {% block search_sortby_button %} - <button class="btn btn-default js-hide" type="submit">{{ _('Go') }}</button> + <button class="btn btn-default js-hide" type="submit">{{ _('Go') }}</button> {% endblock %} - </div> + </div> {% endif %} - {% endblock %} + {% endblock %} - {% block search_facets %} + {% block search_facets %} {% if facets and facets.search %} - <p class="filter-list"> + <p class="filter-list"> {% for field in facets.fields %} - {% set search_facets_items = facets.search.get(field)['items'] %} - {% for value in facets.fields[field] %} - <span class="filtered pill"> + {% set search_facets_items = facets.search.get(field)['items'] %} + {% for value in facets.fields[field] %} + <span class="filtered pill"> {% if(field=='openness')%} - {{_(value)}} + {{_(value)}} {%- else -%} - {%- if facets.translated_fields and facets.translated_fields.has_key((field,value)) -%} + {%- if facets.translated_fields and facets.translated_fields.has_key((field,value)) -%} {{ facets.translated_fields[(field,value)] }} - {%- else -%} + {%- else -%} {{ h.list_dict_filter(search_facets_items, 'name', 'display_name', value) }} {#{{_(value)}}#} - {%- endif %} - {%- endif %} - <a - href="{{ facets.remove_field(field, value) }}" - class="remove" - aria-label="{{ _('Remove filters') }}" - title="{{ _('Remove filters') }}" - > - <i class="fa fa-times" aria-hidden="true"></i> - </a> - </span> - {% endfor %} + {%- endif %} + {%- endif %} + <a + href="{{ facets.remove_field(field, value) }}" + class="remove" + aria-label="{{ _('Remove filters') }}" + title="{{ _('Remove filters') }}" + > + <i class="fa fa-times" aria-hidden="true"></i> + </a> + </span> + {% endfor %} {% endfor %} - </p> - <!-- <a class="show-filters btn">{{ _('Filter Results') }}</a> --> - {% else%} - {% if always_show_filter_list%} - <p class="filter-list"></p> - {% endif %} - {% endif %} - <div id="datesearch-filter"> + </p> + <!-- <a class="show-filters btn">{{ _('Filter Results') }}</a> --> + {% else%} + {% if always_show_filter_list%} + <p class="filter-list"></p> + {% endif %} + {% endif %} + <div id="datesearch-filter"> {%set start_date=h.odsh_render_datetime(request.args.get('ext_startdate'), False)%} {%set end_date=h.odsh_render_datetime(request.args.get('ext_enddate'), False)%} {%- set start_error = start_date == '' and request.args.get('ext_startdate')-%} {%- set end_error = end_date == '' and request.args.get('ext_enddate')-%} {% if start_date or end_date or start_error or end_error%} <p class="filter-list"> - {% if start_date and not start_error%} + {% if start_date and not start_error%} <span class="filtered pill"> - {{_('daterange')}}: {{_('from')}} {{ start_date}} - <a - href="{{ h.remove_url_param('ext_startdate') }}" - class="remove" - aria-label="{{ _('Remove filters') }}" - title="{{ _('Remove filters') }}" - > + {{_('daterange')}}: {{_('from')}} {{ start_date}} + <a + href="{{ h.remove_url_param('ext_startdate') }}" + class="remove" + aria-label="{{ _('Remove filters') }}" + title="{{ _('Remove filters') }}" + > <i class="fa fa-times" aria-hidden="true"></i> - </a> + </a> </span> - {% endif %} - {% if start_error %} + {% endif %} + {% if start_error %} <span class="filtered pill error"> {{_('daterange')}}: {{_('wrong_start_date_for_search')}} <a - href="{{ h.remove_url_param('ext_startdate') }}" - class="remove" - aria-label="{{ _('Remove filters') }}" - title="{{ _('Remove filters') }}" + href="{{ h.remove_url_param('ext_startdate') }}" + class="remove" + aria-label="{{ _('Remove filters') }}" + title="{{ _('Remove filters') }}" > - <i class="fa fa-times" aria-hidden="true"></i> + <i class="fa fa-times" aria-hidden="true"></i> </a> </span> - {% endif %} + {% endif %} - {% if end_date and not end_error%} - <span class="filtered pill"> - {{_('daterange')}}: {{_('to')}} {{ end_date}} - <a - href="{{ h.remove_url_param('ext_enddate') }}" - class="remove" - aria-label="{{ _('Remove filters') }}" - title="{{ _('Remove filters') }}" - > - <i class="fa fa-times" aria-hidden="true"></i> + {% if end_date and not end_error%} + <span class="filtered pill"> + {{_('daterange')}}: {{_('to')}} {{ end_date}} + <a + href="{{ h.remove_url_param('ext_enddate') }}" + class="remove" + aria-label="{{ _('Remove filters') }}" + title="{{ _('Remove filters') }}" + > + <i class="fa fa-times" aria-hidden="true"></i> </a> - </span> - {% endif %} - {% if end_error %} - <span class="filtered pill error"> - {{_('daterange')}}: {{_('wrong_end_date_for_search')}} - <a - href="{{ h.remove_url_param('ext_enddate') }}" - class="remove" - aria-label="{{ _('Remove filters') }}" - title="{{ _('Remove filters') }}" - > - <i class="fa fa-times" aria-hidden="true"></i> - </a> - </span> - {% endif %} - </p> + </span> {% endif %} - </div> - <div > - {%set ext_bbox=request.args.get('ext_bbox')%} - {%set ext_prev_extent=request.args.get('ext_prev_extent')%} - {%set ext_location=request.args.get('ext_location')%} - {% if ext_bbox %} - <p class="filter-list"> - <span class="filtered pill"> - {{_('map search active')}} - <a - href="{{ h.remove_url_param(['ext_bbox','ext_prev_extent', 'ext_location'])}}" - class="remove" - aria-label="{{ _('Remove filters') }}" - title="{{ _('Remove filters') }}" - > - <i class="fa fa-times" aria-hidden="true"></i> + {% if end_error %} + <span class="filtered pill error"> + {{_('daterange')}}: {{_('wrong_end_date_for_search')}} + <a + href="{{ h.remove_url_param('ext_enddate') }}" + class="remove" + aria-label="{{ _('Remove filters') }}" + title="{{ _('Remove filters') }}" + > + <i class="fa fa-times" aria-hidden="true"></i> </a> - </span> - </p> + </span> {% endif %} - </div> - {% endblock %} + </p> + {% endif %} + </div> + <div > + {%set ext_bbox=request.args.get('ext_bbox')%} + {%set ext_prev_extent=request.args.get('ext_prev_extent')%} + {%set ext_location=request.args.get('ext_location')%} + {% if ext_bbox %} + <p class="filter-list"> + <span class="filtered pill"> + {{_('map search active')}} + <a + href="{{ h.remove_url_param(['ext_bbox','ext_prev_extent', 'ext_location'])}}" + class="remove" + aria-label="{{ _('Remove filters') }}" + title="{{ _('Remove filters') }}" + > + <i class="fa fa-times" aria-hidden="true"></i> + </a> + </span> + </p> + {% endif %} + </div> +{% endblock %} - </form> +</form> {% if show_empty and count == 0 and not error %} -<p class="extra">{{ _("Please try another search.") }}</p> + <p class="extra">{{ _("Please try another search.") }}</p> {% endif %} {% if error %} -<p id="search-error"><strong>{{ _("There was an error while searching.") }}</strong> {{ _("Please try again.") }}</p> + <p id="search-error"><strong>{{ _("There was an error while searching.") }}</strong> {{ _("Please try again.") }}</p> {% endif %} diff --git a/ckanext/odsh/tests_wip/test_datarequest.py b/ckanext/odsh/tests_wip/test_datarequest.py deleted file mode 100644 index f8c656c2b38288640922a21d271efb4448e4adf5..0000000000000000000000000000000000000000 --- a/ckanext/odsh/tests_wip/test_datarequest.py +++ /dev/null @@ -1,101 +0,0 @@ - -from ckanext.odsh.tests_wip.test_helpers import AppProxy -import ckanext.odsh.tests_wip.test_helpers as testhelpers -import ckan.tests.factories as factories -import uuid -import pdb -from ckanext.odsh.tests_wip.harvest_sever_mock import HarvestServerMock -import ckanext.odsh.tests_wip.harvest_sever_mock as harvest_sever_mock -import subprocess -import re - -markdown = \ - """ -Lorem markdownum supplex iniquis, nec nostram nam conde tympana, deae Mutinae -regna sepulcro; morae arces quae, pia? Rates Circe, quandoquidem Ausoniae, me, -cacumine apta, saevus abductas navigiis. Sacri ostendit *ad anas* amores nostras -[currebam celeres], milia gaudet eripitur superest circumque auras, [nec]. Si -haurit geminis agendum profana lacertis infamis? - -> Dedit potuit perenni nesciet flumine. Et sui **ibis** mihi supponat, flamina -> mihi rogos, deus manum ora tenebras. Acta nec dominus aenum, haud de ripa -> instabilemque amnis erat nam Patraeque parabat quod membra quamquam. -""" - - -class TestDatarequest: - - def test_nologin_cannot_create_request(self): - pass - - def _create_request(self): - guid = str(uuid.uuid4()) - self._get_app().login() - response = self.app.get('/datarequest/new') - form = response.forms[0] - title = 'datarequest_' + guid - form['title'] = title - form['description'] = markdown - final_response = self.app.submit_form(form) - - - id = re.search( - '/datarequest/edit/([a-zA-Z0-9\-]*)">', final_response.body).group(1) - return id - - def test_create_datarequest(self): - # Act - id = self._create_request() - - # Assert - response = self.app.get('/datarequest') - assert id in response - - def test_edit_datarequest(self): - # Arrange - id = self._create_request() - - # Act - response = self.app.get('/datarequest/edit/'+id) - form = response.forms[0] - form['title'] = id+'edit_title' - form['description'] = id+'edit_desc' - final_response = self.app.submit_form(form) - - # Assert - response = self.app.get('/datarequest/'+id) - assert id+'edit_title' in response - assert id+'edit_desc' in response - - def test_comment_datarequest(self): - # Arrange - id = self._create_request() - guid = str(uuid.uuid4()) - - # Act - response = self.app.get('/datarequest/comment/'+id) - form = response.forms[0] - form['comment'] = markdown + guid - final_response = self.app.submit_form(form) - - # Assert - assert guid in final_response - - def test_close_datarequest(self): - # Arrange - id = self._create_request() - - # Act - response = self.app.get('/datarequest/close/'+id) - form = response.forms[0] - final_response = self.app.submit_form(form) - - # Assert - response = self.app.get('/datarequest/'+id) - assert 'label-closed' in response - - def _get_app(self): - if not hasattr(self, 'app'): - app = AppProxy() - self.app = app - return self.app