Sha256: 1e63b9a2c1eadd4cab402782426defe6bcd3dbe4bce4a3d047c45139247c7252

Contents?: true

Size: 1.58 KB

Versions: 4

Compression:

Stored size: 1.58 KB

Contents

module ActiveScaffold::Config
  class Create < ActiveScaffold::Config::Form
    self.crud_type = :create
    def initialize(*args)
      super
      self.persistent = self.class.persistent
      self.action_after_create = self.class.action_after_create
      self.refresh_list = self.class.refresh_list
    end

    # global level configuration
    # --------------------------
    # the ActionLink for this action
    def self.link
      @@link
    end
    def self.link=(val)
      @@link = val
    end
    @@link = ActiveScaffold::DataStructures::ActionLink.new('new', :label => :create_new, :type => :collection, :security_method => :create_authorized?, :ignore_method => :create_ignore?)

    # whether the form stays open after a create or not
    cattr_accessor :persistent
    @@persistent = false

    # whether update form is opened after a create or not
    cattr_accessor :action_after_create
    @@action_after_create = false

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

    # instance-level configuration
    # ----------------------------
    # the label= method already exists in the Form base class
    def label(model = nil)
      model ||= @core.label(:count => 1)
      @label ? as_(@label) : as_(:create_model, :model => model)
    end
    
    # whether the form stays open after a create or not
    attr_accessor :persistent

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

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

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
active_scaffold-3.0.26 lib/active_scaffold/config/create.rb
active_scaffold-3.0.25 lib/active_scaffold/config/create.rb
active_scaffold_clarity-3.0.24.2 lib/active_scaffold/config/create.rb
active_scaffold-3.0.24 lib/active_scaffold/config/create.rb