Module: LcpRuby::DialogHelper

Defined in:
app/helpers/lcp_ruby/dialog_helper.rb

Instance Method Summary collapse

Instance Method Details

#resolve_dialog_defaults(defaults, record:) ⇒ Object

Resolves a dialog action’s ‘defaults:` hash for inclusion in the dialog URL query string. `:`-prefixed values route through DynamicReferences::Resolver — same grammar as page `scope_context:`, workflow `set_fields:`, etc. — so `:record.id`, `:current_user.id`, `:current_date` all work. Anything else passes through as a literal.



8
9
10
11
12
13
14
# File 'app/helpers/lcp_ruby/dialog_helper.rb', line 8

def resolve_dialog_defaults(defaults, record:)
  return {} unless defaults.is_a?(Hash)

  defaults.transform_values do |value|
    resolve_dialog_default_value(value, record: record)
  end
end