Class: Glib::JsonUi::ActionBuilder::Logics::Set

Inherits:
Action show all
Defined in:
app/helpers/glib/json_ui/action_builder/logics.rb

Overview

The canonical setter action. Prefer this over the deprecated components_set: it supports plain static data as well as conditionalData (JsonLogic), targetIds, variables and cacheData.

Instance Attribute Summary

Attributes inherited from JsonUiElement

#json, #page

Instance Method Summary collapse

Methods inherited from JsonUiElement

action, any, array, badgeable, bool, color, component_name, date, date_time, enum, float, hash, icon, #initialize, int, length, menu, panels_builder, #props, required, singleton_array, string, text, url, views

Constructor Details

This class inherits a constructor from Glib::JsonUi::JsonUiElement

Instance Method Details

#conditionalData(value) ⇒ Object



19
20
21
22
# File 'app/helpers/glib/json_ui/action_builder/logics.rb', line 19

def conditionalData(value)
  Glib::JsonUi::JsonLogicLint.validate!(value) unless Rails.env.production?
  conditionalData_without_lint(value)
end

#conditionalData_without_lintObject

Wrap the generated setter to lint the JsonLogic rules at render time (see JsonLogicLint). The rules are hashes keyed by target prop.



18
# File 'app/helpers/glib/json_ui/action_builder/logics.rb', line 18

alias_method :conditionalData_without_lint, :conditionalData

#dataBuilder(block) ⇒ Object



24
25
26
27
28
# File 'app/helpers/glib/json_ui/action_builder/logics.rb', line 24

def dataBuilder(block)
  json.data do
    block.call(page.sview_builder)
  end
end