Sha256: 8a4d8f96ad56769c81f7246be43378cbb527483180ec647f3adf0b85b4b8cecb

Contents?: true

Size: 1.95 KB

Versions: 14

Compression:

Stored size: 1.95 KB

Contents

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

    def initialize(core_config)
      super
      @text_search = self.class.text_search
      @human_conditions = self.class.human_conditions
    end

    # global level configuration
    # --------------------------
    # the ActionLink for this action
    cattr_reader :link
    @@link = ActiveScaffold::DataStructures::ActionLink.new('show_search', :label => :search, :type => :collection, :security_method => :search_authorized?, :ignore_method => :field_search_ignore?)

    # A flag for how the search should do full-text searching in the database:
    # * :full: LIKE %?%
    # * :start: LIKE ?%
    # * :end: LIKE %?
    # * false: LIKE ?
    # Default is :full
    cattr_accessor :text_search
    @@text_search = :full

    # human conditions
    # instead of just filtered you may show the user a humanized search condition statment
    cattr_accessor :human_conditions
    @@human_conditions = false

    # instance-level configuration
    # ----------------------------

    columns_accessor :columns do
      columns.exclude @core.columns.active_record_class.locking_column.to_sym
    end

    # A flag for how the search should do full-text searching in the database:
    # * :full: LIKE %?%
    # * :start: LIKE ?%
    # * :end: LIKE %?
    # * false: LIKE ?
    # Default is :full
    attr_accessor :text_search

    # the ActionLink for this action
    attr_accessor :link

    # rarely searched columns may be placed in a hidden subgroup
    def optional_columns=(optionals)
      @optional_columns = Array(optionals)
    end

    def optional_columns
      @optional_columns ||= []
    end

    # default search params
    # default_params = {:title => {"from"=>"test", "to"=>"", "opt"=>"%?%"}}
    attr_accessor :default_params

    # human conditions
    # instead of just filtered you may show the user a humanized search condition statment
    attr_accessor :human_conditions
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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