Sha256: 1b8c16c803d8de0e606dc8ca0919d504fd3ffe63cdfa38a2316cbe5c6a6928f9
Contents?: true
Size: 930 Bytes
Versions: 18
Compression:
Stored size: 930 Bytes
Contents
module Admin::Resources::DataTypes::PositionHelper def table_position_field(attribute, item, connector = " / ") locals = { :html_position => [], :connector => connector, :item => item } positions = { :move_to_top => "Top", :move_higher => "Up", :move_lower => "Down", :move_to_bottom => "Bottom" } positions.each do |key, value| first_item = item.respond_to?(:first?) && ([:move_higher, :move_to_top].include?(key) && item.first?) last_item = item.respond_to?(:last?) && ([:move_lower, :move_to_bottom].include?(key) && item.last?) unless first_item || last_item options = { :controller => "/admin/#{item.class.to_resource}", :action => "position", :id => item.id, :go => key } locals[:html_position] << link_to(Typus::I18n.t(value), params.merge(options), { :class => Typus::I18n.t(value).downcase }) end end render "admin/templates/position", locals end end
Version data entries
18 entries across 18 versions & 2 rubygems