[ckan-dev] Organization hierarchy

lucia.espona at wsl.ch lucia.espona at wsl.ch
Tue Aug 9 15:18:44 UTC 2016


 Hi Stefan

I started with the breadcrumb navigation. I decided not to make changes at the IRoutes interface so that the url's of the organizations are the same independently of the hierarchy. I made modifications only at display level by editing the breadcrumb_content block in the templates. 

I created this helper to get the parents:

def group_tree_parents(id_, type_='organization'):
     tree_node =  p.toolkit.get_action('organization_show')({},{'id':id_})
     if (tree_node['groups']):
         parent_id = tree_node['groups'][0]['name']
         parent_node =  p.toolkit.get_action('organization_show')({},{'id':parent_id})
         return group_tree_parents(parent_id) + [parent_node]
     else:
         return []

And displayed it with this:

{% block breadcrumb_content %}
  <li>{% link_for _('Organizations'), controller='organization', action='index' %}</li>
 {% set parent_list =  h.group_tree_parents(c.group_dict.name)  %}
 {% for parent_node in parent_list %}
  <li>{% link_for parent_node.title|truncate(35), controller='organization', action='read', id=parent_node.name %}</li>
 {% endfor %}
  <li class="active">{% link_for c.group_dict.display_name|truncate(35), controller='organization', action='read', id=c.group_dict.name %}</li>
{% endblock %}

It all works well, the links point to the proper locations. My problem is that the link_for I added for the upstream organizations generates a hiperlink in shown in bold, for example:
<a class=" active" href="/organization/lfi">LFI</a>
Is there a possibility to avoid thet the class "active" is added to the link? 

Thanks in advance, I will try now that with displaying the children in the organization "read" page.

Best,
Lucia

_________________________________________________________
Dr. Lucia Espona Pernas

Swiss Federal Institute for Forest, Snow and Landscape Research WSL
Hauptgebäaude Labortrakt (HL C21)
Zürcherstrasse 111
8903 Birmensdorf
Switzerland

+41 44 739 28 71 phone direct
+41 44 739 21 11 reception

www.wsl.ch

-----"ckan-dev" <ckan-dev-bounces at lists.okfn.org> wrote: -----
To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
From: Stefan Oderbolz 
Sent by: "ckan-dev" 
Date: 09.08.2016 13:32
Subject: Re: [ckan-dev] Organization hierarchy

Hi Lucia,


For example if a children organization moves to other parent, one should change the contents of that field in every dataset and re-index it, maybe this already happens automatically.

Yes this should probably happen, but depending on how important it is to have this change reflected right away, you could also defer that, and simply run the paster command "search-index rebuild" daily (or hourly) and have it updated then.
Just a thought, maybe a "proper" implementation is the better solution.
 In addition to the facets, I want that the organization hierarchy is shown in the breadcrumb navigation (ex. home/organizations/parent/child) and in the page of every organization if available, the children organizations and their datasets.

In order to do that, you'll need to implement the IRoutes interface (http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html#ckan.plugins.interfaces.IRoutes) and change the way the organization routes are handled by CKAN.

I hope it'll work I'm happy to help.

- Stefan


-- 
Liip AG  // Limmatstrasse 183 //  CH-8005 Zürich
Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch
  
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160809/5433987b/attachment-0003.html>


More information about the ckan-dev mailing list