Sha256: 99891299c8864f810386304c9898203425e66cb3f2d9a756c11cbf5daa06143e

Contents?: true

Size: 1.04 KB

Versions: 43

Compression:

Stored size: 1.04 KB

Contents

module FlexaLib
  module Helpers
    module TableHelpers

    #TABLE_HELPERS
    def flexa_table_for(collection, *args, &proc)
      options = args.extract_options!
      options[:html]={:class=>'table table-striped table-bordered table-condensed'}
      table_for collection, options do |t|
        if options[:actions].present? && options[:actions].count > 0
          t.column :title=>"",:html => { :th => { :width => ((options[:actions].count.to_i*21)).to_s }, :td=>{:class=>"btn_actions"}} do |resource|
            options[:actions].each do |action|
              if [:show,:edit,:delete].include? action
                concat(send("flexa_grid_button_#{action}_to",resource))
              elsif [:select].include? action
                concat(send("flexa_grid_button_select_to",resource,params[:fill]))
              else
                send("#{action}",resource)
              end
            end
          end
        end
        begin
          t.instance_eval(&proc)
        rescue
          concat("")
        end
      end
    end

    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
flexa_lib-0.5.2 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.5.1 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.5.0 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.9 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.8 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.7 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.6 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.5 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.4 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.3 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.2 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.1 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.3.0 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.2.9 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.2.8 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.2.7 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.2.6 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.2.5 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.2.4 lib/flexa_lib/helpers/table_helpers.rb
flexa_lib-0.2.3 lib/flexa_lib/helpers/table_helpers.rb