Module: Effective::EffectiveDatatable::Dsl

Included in:
Datatable
Defined in:
app/models/effective/effective_datatable/dsl.rb,
app/models/effective/effective_datatable/dsl/charts.rb,
app/models/effective/effective_datatable/dsl/filters.rb,
app/models/effective/effective_datatable/dsl/datatable.rb,
app/models/effective/effective_datatable/dsl/bulk_actions.rb

Defined Under Namespace

Modules: BulkActions, Charts, Datatable, Filters

Instance Method Summary collapse

Instance Method Details

#bulk_actions(&block) ⇒ Object



7
8
9
# File 'app/models/effective/effective_datatable/dsl.rb', line 7

def bulk_actions(&block)
  define_method('initialize_bulk_actions') { dsl_tool.instance_exec(&block); dsl_tool.bulk_actions_col }
end

#charts(&block) ⇒ Object



11
12
13
# File 'app/models/effective/effective_datatable/dsl.rb', line 11

def charts(&block)
  define_method('initialize_charts') { dsl_tool.instance_exec(&block) }
end

#collection(apply_belongs_to: true, apply_scope: true, &block) ⇒ Object



15
16
17
18
19
20
21
22
# File 'app/models/effective/effective_datatable/dsl.rb', line 15

def collection(apply_belongs_to: true, apply_scope: true, &block)
  define_method('initialize_collection') {
    self._collection_apply_belongs_to = apply_belongs_to
    self._collection_apply_scope = apply_scope

    self._collection = dsl_tool.instance_exec(&block)
  }
end

#datatable(&block) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'app/models/effective/effective_datatable/dsl.rb', line 24

def datatable(&block)
  define_method('initialize_datatable') do
    dsl_tool.in_datatables_do_block = true
    dsl_tool.instance_exec(&block)
    dsl_tool.in_datatables_do_block = false

    self.source_location = block.source_location.first if block.respond_to?(:source_location)
  end
end

#filters(&block) ⇒ Object



34
35
36
# File 'app/models/effective/effective_datatable/dsl.rb', line 34

def filters(&block)
  define_method('initialize_filters') { dsl_tool.instance_exec(&block) }
end