Sha256: 983c1702196f87a0bac1469da89526964db5b4f4c702cd11fccae92a6742e251

Contents?: true

Size: 1.83 KB

Versions: 17

Compression:

Stored size: 1.83 KB

Contents

module ActiveScaffold::Config
  class Form < Base
    def initialize(core_config)
      super
      @show_unauthorized_columns = self.class.show_unauthorized_columns
      @refresh_list = self.class.refresh_list
      @persistent = self.class.persistent

      # no global setting here because multipart should only be set for specific forms
      @multipart = false
    end

    # global level configuration
    # --------------------------
    # show value of unauthorized columns instead of skip them
    class_attribute :show_unauthorized_columns

    # whether the form stays open after an update or not
    cattr_accessor :persistent
    @@persistent = false

    # whether we should refresh list after update or not
    cattr_accessor :refresh_list
    @@refresh_list = false

    # instance-level configuration
    # ----------------------------

    # show value of unauthorized columns instead of skip them
    attr_accessor :show_unauthorized_columns
    
    # the ActionLink for this action
    attr_accessor :link

    # the label for this Form action. used for the header.
    attr_writer :label

    # whether the form stays open after a create or not
    attr_accessor :persistent

    # whether we should refresh list after create or not
    attr_accessor :refresh_list

    # provides access to the list of columns specifically meant for the Form to use
    def columns
      unless @columns # lazy evaluation
        self.columns = @core.columns._inheritable
        self.columns.exclude :created_on, :created_at, :updated_on, :updated_at, :as_marked
        self.columns.exclude *@core.columns.collect{|c| c.name if c.polymorphic_association?}.compact
      end
      @columns
    end
    
    public :columns=
    
    # whether the form should be multipart
    attr_writer :multipart
    def multipart?
      @multipart ? true : false
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
active_scaffold-3.4.17 lib/active_scaffold/config/form.rb
active_scaffold-3.4.16 lib/active_scaffold/config/form.rb
active_scaffold-3.4.14 lib/active_scaffold/config/form.rb
active_scaffold-3.4.13 lib/active_scaffold/config/form.rb
active_scaffold-3.4.12 lib/active_scaffold/config/form.rb
active_scaffold-3.4.11 lib/active_scaffold/config/form.rb
active_scaffold-3.4.10 lib/active_scaffold/config/form.rb
active_scaffold-3.4.9 lib/active_scaffold/config/form.rb
active_scaffold-3.4.8 lib/active_scaffold/config/form.rb
active_scaffold-3.4.7 lib/active_scaffold/config/form.rb
active_scaffold-3.4.5 lib/active_scaffold/config/form.rb
active_scaffold-3.4.4 lib/active_scaffold/config/form.rb
active_scaffold-3.4.3 lib/active_scaffold/config/form.rb
active_scaffold-3.4.2 lib/active_scaffold/config/form.rb
active_scaffold-3.4.1 lib/active_scaffold/config/form.rb
active_scaffold-3.4.0.1 lib/active_scaffold/config/form.rb
active_scaffold-3.4.0 lib/active_scaffold/config/form.rb