Sha256: a82e0dbed5e87977f7784b765764209ab226dd6fff927e2b13e8fff4a46f3116

Contents?: true

Size: 924 Bytes

Versions: 23

Compression:

Stored size: 924 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?
        unless par[p.to_s].blank?
          par = par[p.to_s]
        else
          par = nil
        end
      end
      selected = par unless par.blank?

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

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

      selected
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
it-logica-application-backbone-1.1.8 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.7 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.6 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.5 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.4 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.3 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.2 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.1 lib/view_mixins/table.rb
it-logica-application-backbone-1.1.0 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.56 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.55 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.54 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.53 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.52 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.51 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.50 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.49 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.48 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.47 lib/view_mixins/table.rb
it-logica-application-backbone-1.0.46 lib/view_mixins/table.rb