Sha256: 9036d08f1a1881802e3d86eba22ca790b1ed15a607dfb13b62133190a049f911

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 Bytes

Contents

# Very simple plugin that we end up using to manage column ordering a bit on our crazier active scaffolds

module AsMoveColumnsUnder
  def move_column_under(col_targ,col_under)
    if @set.include? col_under
      @set.delete col_targ.to_sym
      @set.insert( (col_under.nil?) ? 0 : (@set.index(col_under)+1), col_targ )
    end
  end
end

# NOTE: Really, we want to extend ActiveScaffold::DataStructures::ActionColumns, however, for reasons I don't understand,
#       if we try to make the slightest adjustment to this class, we end up with weirdo errors. So, sending this to 
#       ActiveScaffold::Configurable does the same thing. (Though this is sloppy b/c a lot of stuff that doesnt need this
#       is getting sent this...

ActiveScaffold::Configurable.send :include, AsMoveColumnsUnder

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brisk-bills-0.8.2 vendor/plugins/active_scaffold_move_column_under/init.rb
brisk-bills-0.8.1 vendor/plugins/active_scaffold_move_column_under/init.rb
brisk-bills-0.7.0 vendor/plugins/active_scaffold_move_column_under/init.rb
brisk-bills-0.6.0 vendor/plugins/active_scaffold_move_column_under/init.rb