75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/e9_rails/controllers/orderable.rb', line 75
def orderable_column_link(column, override_name = nil)
link_text = %Q[<span class="text">#{resource_class.human_attribute_name(override_name || column)}</span>].html_safe
column = column.join(',') if column.is_a?(Array)
co, lo = if params[:order] == column.to_s
params[:sort] =~ /^desc$/i ? %w(DESC ASC) : %w(ASC DESC)
else
[nil, default_ordered_dir.presence || 'DESC']
end
css_classes = ["order-gfx", co, "h-#{lo}"].compact.join(' ').downcase
link_text.safe_concat tag(:span, :class => css_classes)
content_tag(:div, :class => 'ordered-column') do
link_to(link_text, :order => column, :sort => lo)
end
end
|