Sha256: c085c93df49da26e3c43a078f4a95a866cb45fd4843fa72aff708d4f771ae799

Contents?: true

Size: 954 Bytes

Versions: 35

Compression:

Stored size: 954 Bytes

Contents

module ActiveScaffold::Config
  class Mark < Base
    self.crud_type = :read

    # What kind of mark all mode to use:
    # * :search: de-/mark all records using current search conditions
    # * :page: de-/mark all records on current page
    cattr_accessor :mark_all_mode
    @@mark_all_mode = :search

    attr_accessor :mark_all_mode

    def initialize(core_config)
      super
      @mark_all_mode = self.class.mark_all_mode
      @core.model.send(:include, ActiveScaffold::MarkedModel) unless @core.model < ActiveScaffold::MarkedModel
      add_mark_column
    end

    protected

    def add_mark_column
      @core.columns.add :as_marked
      @core.columns[:as_marked].label = 'M'
      @core.columns[:as_marked].list_ui = :marked
      @core.columns[:as_marked].sort = false
      @core.list.columns = [:as_marked] + @core.list.columns.to_a unless @core.list.columns.include? :as_marked
    end

    undef_method :new_user_settings
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
active_scaffold-4.0.0 lib/active_scaffold/config/mark.rb
active_scaffold-4.0.0.rc3 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.11 lib/active_scaffold/config/mark.rb
active_scaffold-4.0.0.rc2 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.10 lib/active_scaffold/config/mark.rb
active_scaffold-4.0.0.rc1 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.8 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.7 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.6 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.5 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.2 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.1 lib/active_scaffold/config/mark.rb
active_scaffold-3.7.0 lib/active_scaffold/config/mark.rb
active_scaffold-3.6.20 lib/active_scaffold/config/mark.rb
active_scaffold-3.6.19 lib/active_scaffold/config/mark.rb
active_scaffold-3.6.17 lib/active_scaffold/config/mark.rb
active_scaffold-3.6.15 lib/active_scaffold/config/mark.rb
active_scaffold-3.6.14 lib/active_scaffold/config/mark.rb
active_scaffold-3.6.13 lib/active_scaffold/config/mark.rb
active_scaffold-3.6.12 lib/active_scaffold/config/mark.rb