Sha256: e6b97ed4edd8dfb72dae798da9e594db2f724a182f577600d91af5c43e2c7194
Contents?: true
Size: 774 Bytes
Versions: 2
Compression:
Stored size: 774 Bytes
Contents
module PhiltreRails # Used by order_by helper to generate ordering links. class OrderLink # expr is a Sequel::SQL::OrderedExpression def initialize( expr, active: false ) @expr = expr @active = active end attr_reader :expr, :active # appended to the label def icon if active expr.descending ? '▼' : '▲' end end # class of the generated <a...> def css_class if active expr.descending ? 'descending' : 'ascending' end end # this value ends up in the order array of the parameter hash def name if active expr.descending ? "#{expr.expression}_desc" : "#{expr.expression}_asc" else expr.expression end.to_s end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
philtre-rails-0.1.0 | lib/philtre-rails/order_link.rb |
philtre-rails-0.0.1 | lib/philtre-rails/order_link.rb |