Sha256: 2942d390ad6c8a1f424012a0bd82bbb5fa87c6ca5e09425733f2a316a6c24dba

Contents?: true

Size: 1.61 KB

Versions: 14

Compression:

Stored size: 1.61 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

    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.polymorphic_association? }.compact
    end

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active_scaffold-3.4.43 lib/active_scaffold/config/form.rb
active_scaffold-3.4.42 lib/active_scaffold/config/form.rb
active_scaffold-3.4.41.1 lib/active_scaffold/config/form.rb
active_scaffold-3.4.41 lib/active_scaffold/config/form.rb
active_scaffold-3.4.40 lib/active_scaffold/config/form.rb
active_scaffold-3.4.39 lib/active_scaffold/config/form.rb
active_scaffold-3.4.38 lib/active_scaffold/config/form.rb
active_scaffold-3.4.37 lib/active_scaffold/config/form.rb
active_scaffold-3.4.36 lib/active_scaffold/config/form.rb
active_scaffold-3.4.35 lib/active_scaffold/config/form.rb
active_scaffold-3.4.34 lib/active_scaffold/config/form.rb
active_scaffold-3.4.33 lib/active_scaffold/config/form.rb
active_scaffold-3.4.32 lib/active_scaffold/config/form.rb
active_scaffold-3.4.31 lib/active_scaffold/config/form.rb