cakephp/cakephp — pull request #2132 by dereuromark (2013-10-14 18:36:29+00:00)
Title: Ability to use PaginatorHelper::sort() with only one direction.

In the past we sometimes had to use a little bit of view overhead to make sort links for fields
in the paginated table sortable in one direction only (check via sortKey() and dynamically adjust the output).

This functionality makes sense for distance, price, etc (where you only need/want ASC sorting).

But instead of a view workaround of multiple lines, I suggest the following enhancement for the paginator's sort() method:

Add `sticky` option (default false) to restrict direction to only default one.

So:

echo $this->Paginator->sort('price', null,
array('direction'=>'asc', 'sticky' => true));

It will then also add the class "sticky" in case it is sorted by this field (`class="asc sticky"`).

One can then adjust the link via CSS:

a.asc.sticky {
color: grey;
}

And/or disable the click event via JS.

Other possible option keys: "fixed", "fixate", "freeze"?
As class name that is added we could also use "disabled": `class="asc disabled"`.

Speaking of: We could also use some kind of "disabled" modification here - similar to first/last page links transformed into non-clickable text. But this way we don't lose the default css styling of the pagination links (search arrow icon, marked as active) besides the link or don't have to necessarily add more styling.

CakePHP: 2.5 as feature
BC: yes, 100%