johnsu01 (johnsu01) wrote,

Sorting in the Quills topic portlet

The topics list is now dynamically alphabetized. These things matter to me.

As promised, I made revisions to the Quills topics portlet to alphabetize the list of topics. Pretty simple again.

Here's the diff in portal_skins/Quills/portlet_topics:

<           <ul tal:define="parent python:here.quills_tool.getParentWeblog(here)">
<             <tal:loop repeat="topic parent/getAvailableTopics">
>           <ul tal:define="parent python:here.quills_tool.getParentWeblog(here);
>                           topics parent/getAvailableTopics;
>                           sort_on python:(('title','cmp', 'asc'),);
>                           sorted_topics python:sequence.sort(topics, sort_on);">
>             <tal:loop repeat="topic sorted_topics">

Works for me. Let me know if you see anything wrong with this one, or the other.

I guess it would also be cool to sort the topics list by the number of entries in each topic instead, but I think I prefer the alphabetical list.

Tags: plone, quills, tales, website, zope, zpt
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.