Feature #18735

Issues list : css tags to get sort orders [sort 2 and 3]

Added by Jérôme BATAILLE almost 8 years ago. Updated over 3 years ago.

Status:Needs feedbackStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:-
Resolution:

Description

Hi is it possible to have css tags for the sort 2 and 3 ?

Thanks a lot !

RM_18735_Issues_list_css_tags_to_get_sort_orders_sort_2_and_3_V2.6.0.diff Magnifier (1.64 KB) Jérôme BATAILLE, 2015-01-02 19:10

redmine_3_sorts.png (8.59 KB) Jérôme BATAILLE, 2016-03-21 00:14

sort2_asc.png (497 Bytes) Jérôme BATAILLE, 2016-03-21 00:17

sort2_desc.png (475 Bytes) Jérôme BATAILLE, 2016-03-21 00:17

sort3_asc.png (556 Bytes) Jérôme BATAILLE, 2016-03-21 00:17

sort3_desc.png (561 Bytes) Jérôme BATAILLE, 2016-03-21 00:17

History

#1 Updated by Jérôme BATAILLE almost 8 years ago

An enhancement to #17993

#3 Updated by Toshi MARUYAMA almost 8 years ago

  • Category set to UI

#4 Updated by Jérôme BATAILLE over 6 years ago

Hi, is it possible to examine this patch ?

second and third sort are very useful, and they can not be explicitly showed with css without this patch.

#5 Updated by Jean-Philippe Lang over 6 years ago

  • Status changed from New to Needs feedback

This would define a lot of CSS classes, how would you use them?
Can you provide an example to see what you want to achieve?

#6 Updated by Jérôme BATAILLE over 6 years ago

This adds the same tag on the second and third sort on the table tag, but in fact it's not the more important part.

I omitted the way to explicit / change the second and third link :

          def sort_link(column, caption, default_order)
            css, order = nil, default_order

            if column.to_s == @sort_criteria.first_key
              if @sort_criteria.first_asc?
                css = 'sort asc'
                order = 'desc'
              else
                css = 'sort desc'
                order = 'asc'
              end
            end

            # Smile specific : #149968 Display sort icons for second and third sort column
            # Smile specific : second sort column
            if @sort_criteria.size >= 2 && column.to_s == @sort_criteria.second_key
              if @sort_criteria.second_asc?
                css = 'sort2 asc'
              else
                css = 'sort2 desc'
              end
            end

            # Smile specific : third sort column
            if @sort_criteria.size >= 3 && column.to_s == @sort_criteria.third_key
              if @sort_criteria.third_asc?
                css = 'sort3 asc'
              else
                css = 'sort3 desc'
              end
            end
            # END -- Smile specific : #149968 Display sort icons for second and third sort column
            caption = column.to_s.humanize unless caption

            sort_options = { :sort => @sort_criteria.add(column.to_s, order).to_param }
            url_options = params.merge(sort_options)

             # Add project_id to url_options
            url_options = url_options.merge(:project_id => params[:project_id]) if params.has_key?(:project_id)

            # Smile specific : #149968 Display sort icons for second and third sort column
            # Smile specific : Sort link on a second line
            link_to_content_update(h(caption), url_options) +
              '<br/>'.html_safe +
              link_to_content_update('&nbsp;&nbsp;&nbsp;&nbsp;'.html_safe, url_options, :class => css)
            # END -- Smile specific : #149968 Display sort icons for second and third sort column
          end

#7 Updated by Jérôme BATAILLE over 6 years ago

Sorry for the Smile specific tags and for the missing tests.

As you can see the sort links are put on a second line of the th cells.

By the way there no mean to remove a sort.

#8 Updated by Jérôme BATAILLE over 6 years ago

Here is a screen capture of what it gives :

here is the css that I have added to get the sort icons :

a.sort2 { padding-right: 16px; background-position: 100% 50%; background-repeat: no-repeat; }
a.sort2.asc  { background-image: url(../images/sort2_asc.png); }
a.sort2.desc { background-image: url(../images/sort2_desc.png); }

a.sort3 { padding-right: 16px; background-position: 100% 50%; background-repeat: no-repeat; }
a.sort3.asc  { background-image: url(../images/sort3_asc.png); }
a.sort3.desc { background-image: url(../images/sort3_desc.png); }

I have joined the 4 new icons

#9 Updated by Jérôme BATAILLE over 3 years ago

Hi,

This issue can be closed, I have developed a plugin for this feature :
http://www.redmine.org/plugins/redmine_smile_three_sortings

Also available in: Atom PDF