notebook/app/views/attribute_fields/_modal.html.erb
2016-11-01 21:51:57 +01:00

43 lines
1.3 KiB
Plaintext

<div id="attribute-field-modal" class="modal">
<%= form_for AttributeField.new do |f| %>
<%= hidden_field_tag :entity_type, content.class.content_name %>
<div class="modal-content">
<h4>New attribute field</h4>
<div class="row">
<div class="input-field">
<%= f.label :attribute_category, 'Category' %><br />
<%= f.text_area :attribute_category, class: "materialize-textarea autocomplete" %>
</div>
</div>
<div class="row">
<%= f.text_area :label, class: "materialize-textarea", placeholder: "Field Name" %>
</div>
<p class="row">
Please save any changes before adding a field. It will refresh the page and any changes in your form
will be lost.
</p>
</div>
<div class="modal-footer">
<%= f.submit "Create field", class: "btn waves-effect waves-green" %>
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">close</a>
</div>
<% end %>
<script type="text/javascript">
$(function() {
$('#attribute_field_attribute_category').autocomplete({
data: {
<% current_user.attribute_categories.where(entity_type: content.class.content_name).each do |category| %>
"<%= category.label %>": null,
<% end %>
}
});
});
</script>
</div>