From caca97e90000ad7f8e563ee1cd7b60405f036592 Mon Sep 17 00:00:00 2001 From: Viktor Fonic Date: Mon, 20 Feb 2017 14:23:52 +0700 Subject: [PATCH] Update code styles for /cart * Use ruby 1.9 hash style * Don't use @ instance variable in partial * Replace `order_form.object` with `order` * Replace `render :partial => '...', :locals => { ... }` with `render '...', { ... }` --- frontend/app/views/spree/orders/_form.html.erb | 13 +++++++------ frontend/app/views/spree/orders/edit.html.erb | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/app/views/spree/orders/_form.html.erb b/frontend/app/views/spree/orders/_form.html.erb index ff1adcea405..dfa894cac89 100644 --- a/frontend/app/views/spree/orders/_form.html.erb +++ b/frontend/app/views/spree/orders/_form.html.erb @@ -1,4 +1,5 @@ -<%= render partial: 'spree/shared/error_messages', locals: { target: @order } %> +<% order = order_form.object %> +<%= render 'spree/shared/error_messages', target: order %> @@ -10,19 +11,19 @@ - <%= render partial: 'spree/orders/line_item', collection: order_form.object.line_items, locals: {order_form: order_form} %> + <%= render partial: 'spree/orders/line_item', collection: order.line_items, locals: { order_form: order_form } %> - <% if @order.adjustments.nonzero.exists? || @order.line_item_adjustments.nonzero.exists? || @order.shipment_adjustments.nonzero.exists? || @order.shipments.any? %> + <% if order.adjustments.nonzero.exists? || order.line_item_adjustments.nonzero.exists? || order.shipment_adjustments.nonzero.exists? || order.shipments.any? %> - + <%= render "spree/orders/adjustments" %> <% end %> +
<%= Spree.t(:cart_subtotal, count: @order.line_items.sum(:quantity)) %>
-
<%= order_form.object.display_item_total %>
<%= Spree.t(:cart_subtotal, count: order.line_items.sum(:quantity)) %>
+
<%= order.display_item_total %>
<%= Spree.t(:total) %>
-
<%= order_form.object.display_total %>
<%= order.display_total %>
diff --git a/frontend/app/views/spree/orders/edit.html.erb b/frontend/app/views/spree/orders/edit.html.erb index a7e4da0a082..b00eb05c8b7 100644 --- a/frontend/app/views/spree/orders/edit.html.erb +++ b/frontend/app/views/spree/orders/edit.html.erb @@ -16,7 +16,7 @@
- <%= render partial: 'form', locals: { order_form: order_form } %> + <%= render 'form', order_form: order_form %>