Module: ForestAdminDatasourceCustomizer::DSL::DatasourceHelpers
- Defined in:
- lib/forest_admin_datasource_customizer/dsl/helpers/datasource_helpers.rb
Overview
DatasourceHelpers provides Rails-like DSL methods for datasource-level customization These methods are included in DatasourceCustomizer to provide a more idiomatic Ruby API
Instance Method Summary collapse
-
#chart(name, &block) ⇒ Object
Add a chart at the datasource level with a cleaner syntax.
-
#collection(name, &block) ⇒ Object
Customize a collection with automatic conversion to string.
-
#hide_collections(*names) ⇒ Object
Hide/remove collections from Forest Admin.
Instance Method Details
#chart(name, &block) ⇒ Object
Add a chart at the datasource level with a cleaner syntax
26 27 28 29 30 31 |
# File 'lib/forest_admin_datasource_customizer/dsl/helpers/datasource_helpers.rb', line 26 def chart(name, &block) add_chart(name.to_s) do |context, result_builder| builder = ChartBuilder.new(context, result_builder) builder.instance_eval(&block) end end |
#collection(name, &block) ⇒ Object
Customize a collection with automatic conversion to string
42 43 44 |
# File 'lib/forest_admin_datasource_customizer/dsl/helpers/datasource_helpers.rb', line 42 def collection(name, &block) customize_collection(name.to_s, &block) end |
#hide_collections(*names) ⇒ Object
Hide/remove collections from Forest Admin
52 53 54 |
# File 'lib/forest_admin_datasource_customizer/dsl/helpers/datasource_helpers.rb', line 52 def hide_collections(*names) remove_collection(*names.map(&:to_s)) end |