Sha256: e7767537f59ee10b10baf1238f346e883388e0b9628bac9c01150f30f40a06ec

Contents?: true

Size: 1.5 KB

Versions: 98

Compression:

Stored size: 1.5 KB

Contents

<% if @prototype.option_types.present? %>
  <h2><%= Spree.t(:variants) %></h2>

  <ul class="product-prototype-options">
    <% @prototype.option_types.each do |ot| %>
      <li class="option-type-field">
        <b>
          <%= check_box_tag "option_types[]", ot.id, (params[:option_types] || []).include?(ot.id.to_s), id: "option_type_#{ot.id}", class: "option-type" %>
          <%= label_tag "option_type_#{ot.id}", ot.presentation %>
        </b>
        <ul class="option-type-values">
          <% ot.option_values.each do |ov| %>
          <li>
            <%= check_box_tag "product[option_values_hash[#{ot.id}]][]", ov.id, params[:product] && (params[:product][:option_values_hash] || {}).values.flatten.include?(ov.id.to_s), id: "option_value_#{ov.id}", class: "option-value" %>
            <%= label_tag "option_value_#{ov.id}", ov.presentation %>
          </li>
          <% end %>
        </ul>
      </li>
    <% end %>
  </ul>

  <script type="text/javascript">
  //<![CDATA[
  (function($){
    $("input.option-type").change(function() {
      $(this).parents("li").find("input.option-value").prop("checked", this.checked);
    });
    $("input.option-value").change(function() {
      var any_checked = false;
      $(this).parents(".option-type-values").find("input.option-value").each(function(i, el) {
        any_checked = any_checked || el.checked;
      });
      $(this).parents(".option-type-field").find("input.option-type").prop("checked", any_checked);
    });
  })(jQuery);
  //]]>
  </script>
<% end %>

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
spree_backend-4.0.9 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.15 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.14 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.0.8 app/views/spree/admin/prototypes/show.html.erb
spree_backend-3.7.14.1 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.13.1 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.0.7.1 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.0.7 app/views/spree/admin/prototypes/show.html.erb
spree_backend-3.7.14 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.13 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.0.6 app/views/spree/admin/prototypes/show.html.erb
spree_backend-3.7.13 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.0.5 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.12 app/views/spree/admin/prototypes/show.html.erb
spree_backend-3.7.12 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.0.4 app/views/spree/admin/prototypes/show.html.erb
spree_backend-3.7.11 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.11 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.10 app/views/spree/admin/prototypes/show.html.erb
spree_backend-4.1.9 app/views/spree/admin/prototypes/show.html.erb