<%- if content.settings[:display_as] == "checkbox" -%>
<%= check_box_tag(
content.form_field_name,
"1",
content.ingredient == "1",
:onclick => "Alchemy.handleEssenceCheckbox(this)"
) %>
<%- elsif content.settings[:display_as] == "select" -%>
<%- if options[:select_values].nil? -%>
<%= warning('options[:select_values] is nil', "No select values given. Please provide :select_values as argument to render_essence_editor_by_name() helper inside this element editor view.") %>
<%- else -%>
<%- if options[:select_values].is_a?(Hash)
options_method = grouped_options_for_select(
options[:select_values],
content.ingredient,
''
)
else
options_method = options_for_select(
options[:select_values],
content.ingredient
)
end
%>
<%= select_tag(
content.form_field_name,
options_method,
{
:class => "essence_editor_select"
}
) %>
<%- end -%>
<%- else -%>
<%= text_field_tag(
content.form_field_name,
content.ingredient,
:class => "thin_border #{content.settings[:linkable] ? ' text_with_icon' : ''}"
) %>
<%- if content.settings[:linkable] -%>
<%= hidden_field_tag content.form_field_name(:link), content.essence.link %>
<%= hidden_field_tag content.form_field_name(:link_title), content.essence.link_title %>
<%= hidden_field_tag content.form_field_name(:link_class_name), content.essence.link_class_name %>
<%= hidden_field_tag content.form_field_name(:link_target), content.essence.link_target %>
<%- end -%>
<%- end -%>
<%- end -%>