Sha256: 512b4850794b8e89276ab085dd12b8beda0f20c26d26a8d6e2125576225378ec

Contents?: true

Size: 951 Bytes

Versions: 35

Compression:

Stored size: 951 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)
      @core = core_config
      @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.names_without_auth_check unless @core.list.columns.include? :as_marked
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
active_scaffold-3.5.5 lib/active_scaffold/config/mark.rb
active_scaffold-3.5.4 lib/active_scaffold/config/mark.rb
active_scaffold-3.5.3 lib/active_scaffold/config/mark.rb
active_scaffold-3.5.2 lib/active_scaffold/config/mark.rb
active_scaffold-3.5.1 lib/active_scaffold/config/mark.rb
active_scaffold-3.5.0 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.43 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.42 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.41.1 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.41 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.40 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.39 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.38 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.37 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.36 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.35 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.34 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.33 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.32 lib/active_scaffold/config/mark.rb
active_scaffold-3.4.31 lib/active_scaffold/config/mark.rb