Sha256: 319887f9ceede34a6d377fbee148ad1ef052e1127a37ee7eee4f712f7ff9bb27

Contents?: true

Size: 1.55 KB

Versions: 17

Compression:

Stored size: 1.55 KB

Contents

<% if @prototype.option_types.present? %>
  <h2><%= plural_resource_name(Spree::Variant) %></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

17 entries across 17 versions & 2 rubygems

Version Path
solidus_prototypes-1.4.0 app/views/spree/admin/prototypes/show.html.erb
solidus_prototypes-1.3.0 app/views/spree/admin/prototypes/show.html.erb
solidus_prototypes-1.2.0 app/views/spree/admin/prototypes/show.html.erb
solidus_prototypes-1.1.1 app/views/spree/admin/prototypes/show.html.erb
solidus_prototypes-1.1.0 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-2.0.3 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-1.4.2 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-2.0.2 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-1.4.1 app/views/spree/admin/prototypes/show.html.erb
solidus_prototypes-1.0.0 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-2.0.1 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-2.0.0 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-1.4.0 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-2.0.0.rc1 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-1.4.0.rc1 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-2.0.0.beta1 app/views/spree/admin/prototypes/show.html.erb
solidus_backend-1.4.0.beta1 app/views/spree/admin/prototypes/show.html.erb