Sha256: 4467f2a127eb864101247d17e0daf0be19fac4b41775f5ec7e0767bfb07a8bb1

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

module Effective
  module EffectiveDatatable
    module Dsl

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

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

      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

      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

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

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
effective_datatables-4.10.0 app/models/effective/effective_datatable/dsl.rb
effective_datatables-4.9.4 app/models/effective/effective_datatable/dsl.rb
effective_datatables-4.9.3 app/models/effective/effective_datatable/dsl.rb