Sha256: e88379cbf07051d82ff92cc1c759ba31af7845a6bc7310641a752e2692ec4148

Contents?: true

Size: 937 Bytes

Versions: 1

Compression:

Stored size: 937 Bytes

Contents

# frozen_string_literal: true

module ActiveFieldsHelper
  def render_array_field(form:, name:, value:, field_method:, field_opts: {})
    render partial: "shared/array_field", locals: {
      form: form,
      name: name,
      value: value,
      field_method: field_method,
      field_opts: field_opts,
    }
  end

  def render_active_field_form(active_field:)
    partial = active_field_form(active_field)

    render partial: partial, locals: { active_field: active_field }
  end

  def render_active_value_input(form:, active_value:)
    partial = active_value_input(active_value.active_field)

    render partial: partial, locals: { form: form, active_value: active_value, active_field: active_value.active_field }
  end

  def active_field_form(active_field)
    "active_fields/forms/#{active_field.type_name}"
  end

  def active_value_input(active_field)
    "active_fields/values/inputs/#{active_field.type_name}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_fields-1.1.0 lib/generators/active_fields/scaffold/templates/helpers/active_fields_helper.rb