podlove/podlove-publisher — pull request #434 by pommes (2014-06-19 14:43:03+00:00)
Title: Templates: Availability of ordering episode contributions by position or comment

Makes it possible to order the episode contributors by their position or comment.
Using comparators because *sql order by* would be a lot of change since the method `accessorEpisodeContributors` is using generic `find_all_by` from the `Base` model.
I added the static comperator methods to the EpisodeContribution class because I thought this is the right place.

Added 3 methodes and calling them from an existing one.
I did test the change with ordering of both attributes and ASC and DESC.
I did **not** test it with roles and groups of contributors since I do not have any groups and roles.

I would be **very** happy if the change would be accepted. I badly need ordering of my episode contributors by their comments. :)

This change needs the documentation of fetching `episode.contributors` to be changed:
- **order:** Designates the ascending or descending order of the 'orderby' parameter. Defaults to 'DESC'.
- 'ASC' - ascending order from lowest to highest values (1, 2, 3; a, b, c).
- 'DESC' - descending order from highest to lowest values (3, 2, 1; c, b, a).
- **orderby:** Sort contributors by parameter. Defaults to 'name'.
- 'position' - Order by the contributors position in the episode.
- 'comment' - Order by the contributors comment in the episode.

Example:
```php
{% for contributor in episode.contributors({orderby: "comment", order: "DESC"}) %}

{% include '@contributors/avatar.twig' with {'avatar': contributor.avatar, 'size': 20} only %}

{{ contributor.comment }}

{% if not loop.last %}
{% endif %}
{% endfor %}
```
Example here: http://zahlensender.net/archiv-neu/