Sha256: 67aa62c885df35a7aeb4292f351e1866df4fbe8b4b599c6d648c1dcdf09a712a

Contents?: true

Size: 1.7 KB

Versions: 6

Compression:

Stored size: 1.7 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, instance_accessor: false

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

    # whether we should refresh list after update or not
    class_attribute :refresh_list, instance_accessor: false
    @@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

    columns_accessor :columns do
      columns.exclude :created_on, :created_at, :updated_on, :updated_at, :as_marked
      columns.exclude(*@core.columns.collect { |c| c.name if c.association.try(:polymorphic?) }.compact)
    end

    # whether the form should be multipart
    attr_writer :multipart
    def multipart?
      @multipart ? true : false
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_scaffold-3.5.5 lib/active_scaffold/config/form.rb
active_scaffold-3.5.4 lib/active_scaffold/config/form.rb
active_scaffold-3.5.3 lib/active_scaffold/config/form.rb
active_scaffold-3.5.2 lib/active_scaffold/config/form.rb
active_scaffold-3.5.1 lib/active_scaffold/config/form.rb
active_scaffold-3.5.0 lib/active_scaffold/config/form.rb