Sha256: f2809f2086c3303cb809ce95a89bcd52945edfe54a1219a1007a270abf9116ce

Contents?: true

Size: 780 Bytes

Versions: 12

Compression:

Stored size: 780 Bytes

Contents

module ViewMixins
  module Table
    def table_for(settings)
      #settings
      render :partial => '/helpers/build_table', :layout => false, :locals => {:settings => settings}
    end

    ##
    # Selected values from custom filter, it checks params and session
    ##
    def selected_values(form_id, path, default = [])
      par = params
      path.each do |p|
        break if par.blank?
        par = par[p.to_s]
      end
      selected = par unless par.blank?

      if selected.blank?
        par = session[form_id+"_params"]

        path.each do |p|
          break if par.blank?
          par = par[p.to_s] unless par[p.to_s].blank?
        end
        selected = par
      end
      selected = selected.blank? ? default : selected

      selected
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
it-logica-application-backbone-1.0.42 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.41 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.40 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.39 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.38 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.37 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.36 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.35 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.34 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.33 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.32 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.31 lib/view_mixins/table.rb