Sha256: 44ea170b7913ed3443ae9d81e51353417e2e0fd1a3bdd1345030eda69f63fe36

Contents?: true

Size: 1.18 KB

Versions: 16

Compression:

Stored size: 1.18 KB

Contents

<%= f.field_container save_to do %>
  <%= f.label save_to, Spree.t('admin.cms.link_to_product') %>
  <%= f.select save_to, options_from_collection_for_select([resource], save_to, save_to, resource.send(save_to) || nil), { include_blank: true },
                          id: "cms_section_#{save_to}",
                          data: { autocomplete_placeholder_value: Spree.t('admin.navigation.search_for_a_product'),
                                  autocomplete_clear_value: true,
                                  autocomplete_url_value: 'products_api_v2',
                                  autocomplete_return_attr_value: 'name',
                                  autocomplete_custom_return_id_value: 'slug' } %>

  <%= f.error_message_on :save_to %>
<% end %>

<% if resource.link_one.present? %>
  <script>
    populateSelectOptionsFromApi({
      targetElement: "#cms_section_<%= save_to %>",
      apiUrl: Spree.routes.products_api_v2 + "?filter[slug_matches]=<%= resource.send(save_to) %>",
      returnValueFromAttributes: 'slug',
      returnOptionText: 'name',

      <% if resource.send(save_to) %>
        selectedOption: "<%= resource.send(save_to) %>"
      <% end %>
    })
  </script>
<% end %>

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spree_backend-4.8.4 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.8.3 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.8.2 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.8.1 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.7.2 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.6.2 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.7.1 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.7.0 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.6.1 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.6.0 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.5.1 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.5.0 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.4.1 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.4.0 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.4.0.rc2 app/views/spree/admin/shared/cms/_spree_product.html.erb
spree_backend-4.4.0.rc1 app/views/spree/admin/shared/cms/_spree_product.html.erb