Sha256: 9c6b3550f99d690ae1a69883ded346e6e79bd3ca23cc64b891073456b3ee76e5

Contents?: true

Size: 842 Bytes

Versions: 5

Compression:

Stored size: 842 Bytes

Contents

module ActiveAdminAddons
  module InputHtmlHelpers
    include InputMethods

    def prefixed_method
      "#{model_name}_#{valid_method}"
    end

    def method_to_input_name
      "#{model_name}[#{valid_method}]"
    end

    def method_to_input_array_name
      "#{method_to_input_name}[]"
    end

    def method_to_input_id(id)
      raise "invalid input id" if id.blank?

      "#{prefixed_method}_#{id}"
    end

    def selected_values_id
      "#{prefixed_method}_selected_values"
    end

    def empty_input_id
      "#{prefixed_method}_empty"
    end

    def build_separator
      template.content_tag(:span, "-", class: "separator")
    end

    def build_hidden_control(id, name, value = nil)
      builder.hidden_field(
        valid_method,
        id: id,
        name: name,
        value: value
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activeadmin_addons-1.10.2 lib/activeadmin_addons/support/input_helpers/input_html_helpers.rb
activeadmin_addons-1.10.1 lib/activeadmin_addons/support/input_helpers/input_html_helpers.rb
activeadmin_addons-2.0.0.beta.0 lib/activeadmin_addons/support/input_helpers/input_html_helpers.rb
activeadmin_addons-1.10.0 lib/activeadmin_addons/support/input_helpers/input_html_helpers.rb
activeadmin_addons-1.9.0 lib/activeadmin_addons/support/input_helpers/input_html_helpers.rb