Sha256: e4edea9a6cc53402149076cf64d10d5f989824cf71dfda0e535ada14ab661a2c

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 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('.product-page__info 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

5 entries across 5 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 lib/generators/solidus_subscriptions/install/templates/app/views/cart_line_items/_subscription_fields.html.erb
solidus_subscriptions-2.0.1 lib/generators/solidus_subscriptions/install/templates/app/views/cart_line_items/_subscription_fields.html.erb
solidus_subscriptions-2.0.0 lib/generators/solidus_subscriptions/install/templates/app/views/cart_line_items/_subscription_fields.html.erb
solidus_subscriptions-1.1.0 lib/generators/solidus_subscriptions/install/templates/app/views/cart_line_items/_subscription_fields.html.erb
solidus_subscriptions-1.0.1 lib/generators/solidus_subscriptions/install/templates/app/views/cart_line_items/_subscription_fields.html.erb