Files
openfoodnetwork/app/views/admin/producer_properties/index.html.haml

41 lines
1.5 KiB
Plaintext

- content_for :page_title do
= "#{@enterprise.name}:"
Producer Properties
- content_for :page_actions do
%ul.tollbar.inline-menu
%li
= link_to_add_fields 'Add Producer Property', 'tbody#producer_properties', class: 'icon-plus button'
= render 'spree/shared/error_messages', target: @enterprise
= form_for @enterprise, url: main_app.admin_enterprise_path(@enterprise), method: :put do |f|
%fieldset.no-border-top
.add_producer_properties{"data-hook" => "add_producer_properties"}
= image_tag 'spinner.gif', :plugin => 'spree', :style => 'display:none;', :id => 'busy_indicator'
%table.index.sortable{"data-hook" => "", "data-sortable-link" => main_app.update_positions_admin_enterprise_producer_properties_url(@enterprise)}
%thead
%tr{"data-hook" => "producer_properties_header"}
%th{colspan: "2"} Property
%th Value
%th.actions
%tbody#producer_properties{"data-hook" => ""}
= f.fields_for :producer_properties do |pp_form|
= render 'producer_property_fields', f: pp_form
= render 'spree/admin/shared/edit_resource_links', collection_url: main_app.admin_enterprise_producer_properties_path(@enterprise)
= hidden_field_tag 'clear_producer_properties', 'true'
:javascript
var properties = #{raw(@properties.to_json)};
$("#producer_properties input.autocomplete").live("keydown", function() {
already_auto_completed = $(this).is('ac_input');
if (!already_auto_completed) {
$(this).autocomplete({source: properties});
$(this).focus();
}
});