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
10
11
12
# File 'app/models/effective/effective_datatable/dsl.rb', line 7

def bulk_actions(&block)
  define_method('initialize_bulk_actions') do 
    actions = dsl_tool.instance_exec(&block)
    dsl_tool.bulk_actions_col if actions.present?
  end
end

#charts(&block) ⇒ Object



14
15
16
# File 'app/models/effective/effective_datatable/dsl.rb', line 14

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

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



18
19
20
21
22
23
24
25
# File 'app/models/effective/effective_datatable/dsl.rb', line 18

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



27
28
29
30
31
32
33
34
35
# File 'app/models/effective/effective_datatable/dsl.rb', line 27

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



37
38
39
# File 'app/models/effective/effective_datatable/dsl.rb', line 37

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