{% endblock %} - -{% block main_content %} -
-
- {% block form %} -

{{ _('Are you sure you want to delete related item - {name}?').format(name=c.related_dict.title) }}

-

-

- - -
-

- {% endblock %} -
-
-{% endblock %} diff --git a/ckan/templates/related/dashboard.html b/ckan/templates/related/dashboard.html deleted file mode 100644 index 841abe99d8b..00000000000 --- a/ckan/templates/related/dashboard.html +++ /dev/null @@ -1,94 +0,0 @@ -{% extends "page.html" %} - -{% set page = c.page %} -{% set item_count = c.page.item_count %} - -{% block subtitle %}{{ _('Apps & Ideas') }}{% endblock %} - -{% block breadcrumb_content %} -
  • {{ _('Apps & Ideas') }}
  • -{% endblock %} - -{% block primary_content %} -
    -
    -

    - {% block page_heading %}{{ _('Apps & Ideas') }}{% endblock %} -

    - - {% block related_items %} - {% if item_count %} - {% trans first=page.first_item, last=page.last_item, item_count=item_count %} -

    Showing items {{ first }} - {{ last }} of {{ item_count }} related items found

    - {% endtrans %} - {% elif c.filters.type %} - {% trans item_count=item_count %} -

    {{ item_count }} related items found

    - {% endtrans %} - {% else %} -

    {{ _('There have been no apps submitted yet.') }} - {% endif %} - {% endblock %} - - {% block related_list %} - {% if page.items %} - {% snippet "related/snippets/related_list.html", related_items=page.items %} - {% endif %} - {% endblock %} -

    - - {% block page_pagination %} - {{ page.pager() }} - {% endblock %} -
    -{% endblock %} - -{% block secondary_content %} -
    -

    {{ _('What are applications?') }}

    -
    - {% trans %} - These are applications built with the datasets as well as ideas for - things that could be done with them. - {% endtrans %} -
    -
    - -
    -

    {{ _('Filter Results') }}

    -
    - - -
    - - -
    - -
    - - -
    - -
    - -
    - -
    - -
    -
    -
    -{% endblock %} diff --git a/ckan/templates/related/edit.html b/ckan/templates/related/edit.html deleted file mode 100644 index 26c1e49b701..00000000000 --- a/ckan/templates/related/edit.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "related/base_form_page.html" %} - -{% block subtitle %}{{ _('Edit related item') }}{% endblock %} - -{# TODO: pass the same context in here so we can create links #} -{% block breadcrumb_item %}{{ h.nav_link(_('Edit Related'), controller='related', action='edit', id=c.id, related_id="") }}{% endblock %} - -{% block page_heading %}{{ _('Edit Related Item') }}{% endblock %} diff --git a/ckan/templates/related/edit_form.html b/ckan/templates/related/edit_form.html deleted file mode 100644 index 92cb16696e8..00000000000 --- a/ckan/templates/related/edit_form.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "related/snippets/related_form.html" %} - -{% block button_text %} - {% if data.id %} - {{ _('Update') }} - {% else %} - {{ _('Create') }} - {% endif %} -{% endblock %} - -{% block delete_button %} - {% if data.id %} - {{ super() }} - {% endif %} -{% endblock %} diff --git a/ckan/templates/related/new.html b/ckan/templates/related/new.html deleted file mode 100644 index 7fb3ce90633..00000000000 --- a/ckan/templates/related/new.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "related/base_form_page.html" %} - -{% block subtitle %}{{ _('Create a related item') }}{% endblock %} - -{% block breadcrumb_item %}{{ h.nav_link(_('Create Related'), controller='related', action='new', id=c.id) }}{% endblock %} - -{% block page_heading %}{{ _('Create Related Item') }}{% endblock %} diff --git a/ckan/templates/related/snippets/related_form.html b/ckan/templates/related/snippets/related_form.html deleted file mode 100644 index 23ab88c1c84..00000000000 --- a/ckan/templates/related/snippets/related_form.html +++ /dev/null @@ -1,35 +0,0 @@ -{% import 'macros/form.html' as form %} - -
    - {% block error_summary %} - {% if error_summary | count %} -
    -

    {{ _('The form contains invalid entries:') }}

    -
      - {% for key, error in error_summary.items() %} -
    • {{ key }}: {{ error }}
    • - {% endfor %} -
    -
    - {% endif %} - {% endblock %} - - {% block fields %} - {{ form.input('title', label=_('Title'), id='field-title', placeholder=_('My Related Item'), value=data.title, error=errors.title, classes=['control-full']) }} - {{ form.input('url', label=_('URL'), id='field-url', placeholder=_('http://example.com/'), value=data.url, error=errors.url, classes=['control-full']) }} - {{ form.input('image_url', label=_('Image URL'), id='field-image-url', placeholder=_('http://example.com/image.png'), value=data.image_url, error=errors.image_url, classes=['control-full']) }} - {{ form.markdown('description', label=_('Description'), id='field-description', placeholder=_('A little information about the item...'), value=data.description, error=errors.description) }} - {{ form.select('type', label=_('Type'), id='field-types', selected=data.type, options=c.types, error=errors.type) }} - {% endblock %} - -
    - {% block delete_button %} - {% if h.check_access('related_delete', {'id': data.id}) %} - {% set locale = h.dump_json({'content': _('Are you sure you want to delete this related item?')}) %} - {% block delete_button_text %}{{ _('Delete') }}{% endblock %} - {% endif %} - {% endblock %} - {{ h.nav_link(_('Cancel'), controller='related', action='list', id=c.id, class_='btn') }} - -
    -
    diff --git a/ckan/templates/related/snippets/related_item.html b/ckan/templates/related/snippets/related_item.html deleted file mode 100644 index 2053f7c0406..00000000000 --- a/ckan/templates/related/snippets/related_item.html +++ /dev/null @@ -1,41 +0,0 @@ -{# -Displays a single related item. - -related - The related item dict. -pkg_id - The id of the owner package. If present the edit button will be - displayed. - -Example: - - - -#} -{% set placeholder_map = { -'application': h.url_for_static('/base/images/placeholder-application.png') -} %} -{% set tooltip = _('Go to {related_item_type}').format(related_item_type=related.type|replace('_', ' ')|title) %} - -{% if position is divisibleby 3 %} -
  • -{% endif %} diff --git a/ckan/templates/related/snippets/related_list.html b/ckan/templates/related/snippets/related_list.html deleted file mode 100644 index 7256ba97dc3..00000000000 --- a/ckan/templates/related/snippets/related_list.html +++ /dev/null @@ -1,18 +0,0 @@ -{# -Renders a list of related item elements - -related_items - A list of related items. -pkg_id - A package id for the items used to determine if the edit button - should be displayed. - -Example: - - - {% snippet "related/snippets/related_list.html", related_items=c.pkg.related, pkg_id=c.pkg.name %} - -#} - diff --git a/ckan/tests/legacy/functional/test_related.py b/ckan/tests/legacy/functional/test_related.py index bb67323520f..aa636a8957d 100644 --- a/ckan/tests/legacy/functional/test_related.py +++ b/ckan/tests/legacy/functional/test_related.py @@ -10,57 +10,6 @@ import ckan.tests.legacy.functional.api.base as apibase -class TestRelatedUI(base.FunctionalTestCase): - @classmethod - def setup_class(self): - model.Session.remove() - tests.CreateTestData.create() - - @classmethod - def teardown_class(self): - model.repo.rebuild_db() - - def test_related_new(self): - offset = h.url_for(controller='related', - action='new', id='warandpeace') - res = self.app.get(offset, status=200, - extra_environ={"REMOTE_USER": "testsysadmin"}) - assert 'URL' in res, "URL missing in response text" - assert 'Title' in res, "Title missing in response text" - - data = { - "title": "testing_create", - "url": u"http://ckan.org/feed/", - } - res = self.app.post(offset, params=data, - status=[200,302], - extra_environ={"REMOTE_USER": "testsysadmin"}) - - def test_related_new_missing(self): - offset = h.url_for(controller='related', - action='new', id='non-existent dataset') - res = self.app.get(offset, status=404, - extra_environ={"REMOTE_USER": "testsysadmin"}) - - def test_related_new_fail(self): - offset = h.url_for(controller='related', - action='new', id='warandpeace') - print '@@@@', offset - res = self.app.get(offset, status=200, - extra_environ={"REMOTE_USER": "testsysadmin"}) - assert 'URL' in res, "URL missing in response text" - assert 'Title' in res, "Title missing in response text" - - data = { - "title": "testing_create", - } - res = self.app.post(offset, params=data, - status=[200,302], - extra_environ={"REMOTE_USER": "testsysadmin"}) - assert 'error' in res, res - - - class TestRelated: @classmethod @@ -357,7 +306,7 @@ def test_update_related_item_check_owner_status(self): } user = model.User.by_name('tester') admin = model.User.by_name('testsysadmin') - + #create related item context = dict(model=model, user=user.name, session=model.Session) data_dict = dict(title="testing_create",description="description",