sorting.haml 587 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
- if sort.fields|length > 0
  .sorting-block
    Order by :

      - for field, label in sort.fields.items
          - if sort.field == field
            {{ label }}
          - else
            %a{'href': '?={queries.urlencode}&sort_by=={field}'}<
              {{ label }}

          - if not forloop.last
            =" | "

      &ndash;

      - if sort.dir == 'asc'
        ascending |
        %a{'href': '?={queries.urlencode}&sort_dir=desc'}<
          descending
      - else
        %a{'href': '?={queries.urlencode}&sort_dir=asc'}<
          ascending
        ="| descending"