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

Version Path
brainsome_typus-4.0.0.beta13 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta12 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta11 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta10 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta9 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta8 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta7 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta6 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta5 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta4 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta3 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta2 app/helpers/admin/resources/data_types/position_helper.rb
brainsome_typus-4.0.0.beta1 app/helpers/admin/resources/data_types/position_helper.rb
typus-3.1.10 app/helpers/admin/resources/data_types/position_helper.rb
typus-3.1.9 app/helpers/admin/resources/data_types/position_helper.rb
typus-3.1.8 app/helpers/admin/resources/data_types/position_helper.rb
typus-3.1.7 app/helpers/admin/resources/data_types/position_helper.rb
typus-3.1.6 app/helpers/admin/resources/data_types/position_helper.rb