Sha256: 8d8b39dd27f2d249f155a4d3640de76a65b2282bc495e76e6454be796c8ff10f

Contents?: true

Size: 1.81 KB

Versions: 15

Compression:

Stored size: 1.81 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
        columns.exclude :created_on, :created_at, :updated_on, :updated_at, :as_marked
        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

15 entries across 15 versions & 1 rubygems

Version Path
active_scaffold-3.4.30 lib/active_scaffold/config/form.rb
active_scaffold-3.4.29 lib/active_scaffold/config/form.rb
active_scaffold-3.4.28 lib/active_scaffold/config/form.rb
active_scaffold-3.4.27 lib/active_scaffold/config/form.rb
active_scaffold-3.4.26 lib/active_scaffold/config/form.rb
active_scaffold-3.4.25 lib/active_scaffold/config/form.rb
active_scaffold-3.4.24 lib/active_scaffold/config/form.rb
active_scaffold-3.4.23 lib/active_scaffold/config/form.rb
active_scaffold-3.4.22 lib/active_scaffold/config/form.rb
active_scaffold-3.4.21.1 lib/active_scaffold/config/form.rb
active_scaffold-3.4.21 lib/active_scaffold/config/form.rb
active_scaffold-3.4.20 lib/active_scaffold/config/form.rb
active_scaffold-3.4.19 lib/active_scaffold/config/form.rb
active_scaffold-3.4.18.1 lib/active_scaffold/config/form.rb
active_scaffold-3.4.18 lib/active_scaffold/config/form.rb