<%# locals: { f, field_label, field_id, field_name, multiple, classname, field_name, field_id, required, readonly, validation, ttip, example } %>
<% field_label = field_label || 'No label defined' %>
<% field_label = required ? "* #{field_label}" : field_label%>
<% field_value ||= default_value %>
<% unless multiple %>
  <div class="col-md-12">
    <%= f.label field_id, field_label, class: 'control-label' %>
  </div>
<% end %>
<div class="col-md-12 dynamic-field" data-toggle="tooltip" title="<%= ttip %>">
  <%= f.text_area field_name, 
            value: field_value, 
            multiple: multiple, 
            disabled: readonly,
            class: "form-control #{field_class} tinymce tinymce_answer",
            type: input_type,
            id: field_id %>
  <% if multiple && readonly == false%>
    <div class="actions">
      <span class="fa fa-plus-square add-record"></span>
      <% if index != 0 %>
        <span class="fa fa-minus-square remove-record"></span>
      <% else %>
        <span class="fa fa-minus-square remove-record" style="display:none"></span>
      <% end %>
    </div>
  <% end %>
  
  <%= render partial: "shared/dynamic_form/validation_indicator", locals: {
                validation: validation
      } unless validation == "none"
  %>
</div>

<% if example.present? %>
  <div class="col-md-12">
    <div class="panel panel-default example-answer">
      <span class="label label-default example-answer-link" 
            data-toggle="collapse" 
            data-target="<%= "#example-#{field_id}" %>">
        <%=_('Example')%>
        <i class="more-less fa fa-plus small"></i>
      </span>
      <div class="panel-body collapse" id="<%= "example-#{field_id}"  %>">
        <%= sanitize example %>
      </div>
    </div>
  </div>
<% end %>
