From 0c6f2bdd1a73ba3ac179cbc88860ca9c50392c23 Mon Sep 17 00:00:00 2001 From: Elia Bellavista Date: Mon, 29 Jul 2024 19:23:26 +0200 Subject: [PATCH] added tags and groups pages and routes --- ROADMAP.md | 2 +- .../ckanext/d4science_theme/helpers.py | 2 + .../ckanext/d4science_theme/plugin.py | 12 ++++- .../templates/home/layout1.html | 2 - .../templates/home/snippets/popular_tags.html | 7 ++- .../d4science_theme/templates/tag/index.html | 43 +++++++++++---- .../templates/tag/snippets/helper.html | 13 +++++ .../templates/tag/snippets/tag_form.html | 52 +++++++++++++++++++ .../templates/tag/snippets/tag_list.html | 9 ++++ .../d4science_theme/templates/type/index.html | 44 +++++++++++++++- 10 files changed, 166 insertions(+), 20 deletions(-) create mode 100644 compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/templates/tag/snippets/helper.html create mode 100644 compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/templates/tag/snippets/tag_form.html create mode 100644 compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/templates/tag/snippets/tag_list.html diff --git a/ROADMAP.md b/ROADMAP.md index c608c70..d50994f 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,6 +1,6 @@ # Roadmap - [ ] Fix Filters in search pages -- [ ] fix tags page and popular tags section in homepage +- [ ] fix tags page(home sees tags, but "all tags" does not) - [ ] check if all requested plugins are working - [ ] \ No newline at end of file diff --git a/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/helpers.py b/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/helpers.py index 401c4c8..28b22df 100644 --- a/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/helpers.py +++ b/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/helpers.py @@ -495,6 +495,8 @@ def get_list_of_groups(limit=10, sort='package_count'): ordered_groups = [] ordered_groups = logic.get_action('group_list')({}, data) + log.debug("group_list: "+ ", ".join(ordered_groups)) + for group in ordered_groups: # print "\n\ngroup %s" %group try: diff --git a/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/plugin.py b/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/plugin.py index 7c27310..5143a72 100644 --- a/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/plugin.py +++ b/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/plugin.py @@ -406,11 +406,21 @@ class D4Science_ThemePlugin(plugins.SingletonPlugin, toolkit.DefaultDatasetForm) d4sHC = d4SHomeController() d4sTC = d4STypeController() d4sOC = OrganizationVREController() + blueprint = Blueprint('d4s', self.__module__) + + def tags(): + return render_template('tag/index.html') + + def groups(): + return render_template('group/index.html') + rules = [ ('/', 'index', d4sHC.index), - ('/type', 'type', d4sTC.index), + ('/types', 'types', d4sTC.index), ('/organization_vre', 'organization_vre', d4sOC.index), + ('/tags', 'tags', tags), + ('/groups', 'groups', groups), ] for rule in rules: blueprint.add_url_rule(*rule) diff --git a/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/templates/home/layout1.html b/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/templates/home/layout1.html index c9b9be2..840f03a 100644 --- a/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/templates/home/layout1.html +++ b/compose/2.10/src/ckanext-d4science_theme/ckanext/d4science_theme/templates/home/layout1.html @@ -76,8 +76,6 @@ #} - -