Sha256: eb8f067af579fc5fc45f6913e601f592451133fc127ca3af1aba7984cb5ace4a

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

<%= content_tag :h3, t('.subscription_fields') %>
<%= fields_for :'subscription_line_item', SolidusSubscriptions::LineItem.new do |ff| %>
  <div>
    <%= ff.label :quantity, t('.quantity') %>
    <%= ff.number_field :quantity %>
    <%= ff.label :quantity, t('.quantity_suffix') %>
  </div>

  <div>
    <%= ff.label :interval_length, t('.interval_length') %>
    <%= ff.number_field :interval_length %>

    <%= ff.collection_radio_buttons :interval_units, SolidusSubscriptions::LineItem.interval_units.to_a, :first, :first %>
  </div>

  <%= ff.hidden_field :subscribable_id %>
<% end %>

<script>
  document.addEventListener("DOMContentLoaded", function(e) {
    var cartForm = document.querySelector('#cart-form form');
    cartForm.addEventListener('submit', function(e) {
      var quantityInput = e.target.querySelector('[name*="quantity"]');
      var subscriptionQuantityInput = e.target.querySelector('[name*="subscribable_id"]');

      subscriptionQuantityInput.value = quantityInput.value;
      return true;
    });
  });
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_subscriptions-alpha-0.0.4 app/views/spree/frontend/products/_subscription_line_item_fields.html.erb