<%# locals: { f, field_label, form_prefix, property_name, select_values, locale, value, parent_id, schema_id, field_class, required, readonly, validation, ttip, default_value, overridable } %> <% value ||= default_value %> <% include_blank = !value && !default_value %> <% field_name = defined?(form_prefix) ? "#{form_prefix}[#{property_name}]" : property_name %> <% query_id = Digest::MD5.hexdigest("#{parent_id}-#{property_name}") %> <% intermediate_message = overridable ? d_("dmpopidor", "Select a value from the list or type a new one.") : d_("dmpopidor", "Select a value from the list.")%> <div class="col-md-12"> <fieldset class="sub-fragment registry"> <legend class="sub-fragment registry"><%= field_label %></legend> <% unless value&.data.nil? || value.data.empty? %> <div class="col-md-12 fragment-display"> <%= render(partial: 'madmp_fragments/display', locals: { fragment: value, schema: value.madmp_schema, template_locale: locale })%> <span class="intermediate-label"><i><%= intermediate_message unless readonly %></i></span> </div> <% end %> <% unless readonly %> <div class="col-md-12 dynamic-field select-field single-select"> <div class="field-button-combo"> <%= select_tag "#{f.object_name}[#{field_name}]", options_for_select( select_values.map {|v| [ v.to_s(locale), select_value(v, locale) ] } ), data: { "tags" => overridable }, disabled: readonly, multiple: false, include_blank: true, "data-toggle": "tooltip", title: ttip, class: "form-control #{field_class}", id: field_id %> <% unless readonly %> <span class="remove-button fa fa-times"></span> <% end %> </div> <% if overridable %> <% style = 'display: none;' custom_value = nil if value.present? && value.additional_info["custom_value"].present? style = '' custom_value = value.additional_info["custom_value"] end %> <% other_field_name = defined?(form_prefix) ? "#{form_prefix}[#{property_name}_custom]" : "#{property_name}_custom" %> <div class="col-md-12 custom-value" style="<%= style %>"> <%= f.label other_field_name, d_("dmpopidor", "Custom value: "), class: 'control-label' %> <%= f.hidden_field other_field_name, value: custom_value, class: "form-control #{field_class}", id: field_id %> <span><%= custom_value %></span> </div> <% end %> </div> <% end %> </fieldset> </div>