mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Reorganising darkswarm order views into partials
This commit is contained in:
@@ -21,18 +21,7 @@
|
||||
= render :partial => 'line_item', :locals => { :variant => item_form.object.variant, :line_item => item_form.object, :item_form => item_form }
|
||||
|
||||
%tfoot#edit-cart
|
||||
%tr
|
||||
%td{colspan:"2"}
|
||||
%td
|
||||
= button_tag :class => 'secondary radius expand small', :id => 'update-button' do
|
||||
%i.ofn-i_023-refresh
|
||||
= t(:update)
|
||||
%td
|
||||
%td#empty-cart.text-center
|
||||
%span#clear_cart_link{"data-hook" => ""}
|
||||
= link_to t(:orders_form_empty_cart), empty_cart_path, method: :put, :class => 'not-bold small'
|
||||
-#= form_tag empty_cart_path, :method => :put do
|
||||
-#= submit_tag t(:empty_cart), :class => 'button alert expand small'
|
||||
= render 'spree/orders/form/cart_actions_row'
|
||||
|
||||
/ This is the fees row which we want to replace with the pop-over
|
||||
-# - unless @order.adjustments.eligible.blank?
|
||||
|
||||
65
app/views/spree/orders/_summary.html.haml
Normal file
65
app/views/spree/orders/_summary.html.haml
Normal file
@@ -0,0 +1,65 @@
|
||||
%table#line-items{"data-hook" => "order_details"}
|
||||
%col{valign: "middle"}/
|
||||
%col{halign: "center", valign: "middle", width: "5%"}/
|
||||
%col{halign: "center", valign: "middle", width: "5%"}/
|
||||
%col{halign: "center", valign: "middle", width: "5%"}/
|
||||
%thead{"data-hook" => ""}
|
||||
%tr{"data-hook" => "order_details_line_items_headers"}
|
||||
%th= t(:item)
|
||||
%th.price= t(:price)
|
||||
%th.text-center.qty= t(:qty)
|
||||
%th.text-right.total
|
||||
%span= t(:total)
|
||||
%tbody{"data-hook" => ""}
|
||||
- order.line_items.each do |item|
|
||||
%tr{"data-hook" => "order_details_line_item_row"}
|
||||
%td(data-hook = "order_item_description")
|
||||
|
||||
%div.item-thumb-image{"data-hook" => "order_item_image"}
|
||||
- if item.variant.images.length == 0
|
||||
= link_to mini_image(item.variant.product), item.variant.product
|
||||
- else
|
||||
= link_to image_tag(item.variant.images.first.attachment.url(:mini)), item.variant.product
|
||||
|
||||
|
||||
= render 'spree/shared/line_item_name', line_item: item
|
||||
|
||||
%td.text-right.price{"data-hook" => "order_item_price"}
|
||||
%span= item.single_display_amount_with_adjustments.to_html
|
||||
%td.text-center{"data-hook" => "order_item_qty"}= item.quantity
|
||||
%td.text-right.total{"data-hook" => "order_item_total"}
|
||||
%span= item.display_amount_with_adjustments.to_html
|
||||
|
||||
%tfoot
|
||||
#subtotal{"data-hook" => "order_details_subtotal"}
|
||||
%tr#subtotal-row.total
|
||||
%td.text-right{colspan: "3"}
|
||||
%strong
|
||||
= t :order_produce
|
||||
%td.text-right.total
|
||||
%span= display_checkout_subtotal(order)
|
||||
|
||||
#order-charges{"data-hook" => "order_details_adjustments"}
|
||||
- checkout_adjustments_for(order, exclude: [:line_item]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
|
||||
%tr.total
|
||||
%td.text-right{:colspan => "3"}
|
||||
%strong
|
||||
= adjustment.label
|
||||
%td.text-right.total
|
||||
%span= adjustment.display_amount.to_html
|
||||
|
||||
#order-total{"data-hook" => "order_details_total"}
|
||||
%tr.total
|
||||
%td.text-right{colspan: "3"}
|
||||
%h5
|
||||
= t :order_total_price
|
||||
%td.text-right.total
|
||||
%h5#order_total= order.display_total.to_html
|
||||
|
||||
- if order.total_tax > 0
|
||||
#tax{"data-hook" => "order_details_tax"}
|
||||
%tr#tax-row.total
|
||||
%td.text-right{colspan: "3"}
|
||||
= t :order_includes_tax
|
||||
%td.text-right.total
|
||||
%span= display_checkout_tax_total(order)
|
||||
@@ -31,18 +31,7 @@
|
||||
.row
|
||||
= render :partial => 'form', :locals => { :order_form => order_form }
|
||||
|
||||
|
||||
.links{'data-hook' => "cart_buttons"}
|
||||
.row
|
||||
.columns.large-8{"data-hook" => ""}
|
||||
|
||||
%a.button.large.secondary{href: main_app.shop_path}
|
||||
%i.ofn-i_008-caret-left
|
||||
= t :orders_edit_continue
|
||||
.columns.large-4.text-right
|
||||
%a#checkout-link.button.large.primary{href: main_app.checkout_path}
|
||||
= t :orders_edit_checkout
|
||||
%i.ofn-i_007-caret-right
|
||||
= render "spree/orders/form/cart_links"
|
||||
|
||||
= render 'bought' if show_bought_items?
|
||||
|
||||
|
||||
10
app/views/spree/orders/form/_cart_actions_row.html.haml
Normal file
10
app/views/spree/orders/form/_cart_actions_row.html.haml
Normal file
@@ -0,0 +1,10 @@
|
||||
%tr
|
||||
%td{colspan:"2"}
|
||||
%td
|
||||
= button_tag :class => 'secondary radius expand small', :id => 'update-button' do
|
||||
%i.ofn-i_023-refresh
|
||||
= t(:update)
|
||||
%td
|
||||
%td#empty-cart.text-center
|
||||
%span#clear_cart_link{"data-hook" => ""}
|
||||
= link_to t(:orders_form_empty_cart), empty_cart_path, method: :put, :class => 'not-bold small'
|
||||
9
app/views/spree/orders/form/_cart_links.html.haml
Normal file
9
app/views/spree/orders/form/_cart_links.html.haml
Normal file
@@ -0,0 +1,9 @@
|
||||
.row.links{'data-hook' => "cart_buttons"}
|
||||
.columns.large-8{"data-hook" => ""}
|
||||
%a.button.large.secondary{href: main_app.shop_path}
|
||||
%i.ofn-i_008-caret-left
|
||||
= t :orders_edit_continue
|
||||
.columns.large-4.text-right
|
||||
%a#checkout-link.button.large.primary{href: main_app.checkout_path}
|
||||
= t :orders_edit_checkout
|
||||
%i.ofn-i_007-caret-right
|
||||
5
app/views/spree/orders/form/_update_buttons.html.haml
Normal file
5
app/views/spree/orders/form/_update_buttons.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
.row
|
||||
.columns.small-12.medium-3
|
||||
= link_to main_app.shop_path, :class => "button expand" do
|
||||
%i.ofn-i_008-caret-left
|
||||
= t(:back_to_store)
|
||||
@@ -19,12 +19,5 @@
|
||||
|
||||
= render 'spree/shared/order_details', order: @order
|
||||
|
||||
.row
|
||||
.columns.large-12
|
||||
= link_to t(:back_to_store), main_app.shop_path, :class => "button"
|
||||
- unless params.has_key? :checkout_complete
|
||||
- if try_spree_current_user && respond_to?(:spree_account_path)
|
||||
= link_to t(:my_account), spree_account_path, :class => "button"
|
||||
|
||||
|
||||
= render partial: "shared/footer"
|
||||
|
||||
@@ -86,68 +86,5 @@
|
||||
%br
|
||||
.row
|
||||
.columns.large-12
|
||||
%table#line-items{"data-hook" => "order_details"}
|
||||
%col{valign: "middle"}/
|
||||
%col{halign: "center", valign: "middle", width: "5%"}/
|
||||
%col{halign: "center", valign: "middle", width: "5%"}/
|
||||
%col{halign: "center", valign: "middle", width: "5%"}/
|
||||
%thead{"data-hook" => ""}
|
||||
%tr{"data-hook" => "order_details_line_items_headers"}
|
||||
%th= t(:item)
|
||||
%th.price= t(:price)
|
||||
%th.text-center.qty= t(:qty)
|
||||
%th.text-right.total
|
||||
%span= t(:total)
|
||||
%tbody{"data-hook" => ""}
|
||||
- order.line_items.each do |item|
|
||||
%tr{"data-hook" => "order_details_line_item_row"}
|
||||
%td(data-hook = "order_item_description")
|
||||
|
||||
%div.item-thumb-image{"data-hook" => "order_item_image"}
|
||||
- if item.variant.images.length == 0
|
||||
= link_to mini_image(item.variant.product), item.variant.product
|
||||
- else
|
||||
= link_to image_tag(item.variant.images.first.attachment.url(:mini)), item.variant.product
|
||||
|
||||
|
||||
= render 'spree/shared/line_item_name', line_item: item
|
||||
|
||||
%td.text-right.price{"data-hook" => "order_item_price"}
|
||||
%span= item.single_display_amount_with_adjustments.to_html
|
||||
%td.text-center{"data-hook" => "order_item_qty"}= item.quantity
|
||||
%td.text-right.total{"data-hook" => "order_item_total"}
|
||||
%span= item.display_amount_with_adjustments.to_html
|
||||
|
||||
%tfoot
|
||||
#subtotal{"data-hook" => "order_details_subtotal"}
|
||||
%tr#subtotal-row.total
|
||||
%td.text-right{colspan: "3"}
|
||||
%strong
|
||||
= t :order_produce
|
||||
%td.text-right.total
|
||||
%span= display_checkout_subtotal(order)
|
||||
|
||||
#order-charges{"data-hook" => "order_details_adjustments"}
|
||||
- checkout_adjustments_for(order, exclude: [:line_item]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
|
||||
%tr.total
|
||||
%td.text-right{:colspan => "3"}
|
||||
%strong
|
||||
= adjustment.label
|
||||
%td.text-right.total
|
||||
%span= adjustment.display_amount.to_html
|
||||
|
||||
#order-total{"data-hook" => "order_details_total"}
|
||||
%tr.total
|
||||
%td.text-right{colspan: "3"}
|
||||
%h5
|
||||
= t :order_total_price
|
||||
%td.text-right.total
|
||||
%h5#order_total= order.display_total.to_html
|
||||
|
||||
- if order.total_tax > 0
|
||||
#tax{"data-hook" => "order_details_tax"}
|
||||
%tr#tax-row.total
|
||||
%td.text-right{colspan: "3"}
|
||||
= t :order_includes_tax
|
||||
%td.text-right.total
|
||||
%span= display_checkout_tax_total(order)
|
||||
= render partial: 'spree/orders/summary'
|
||||
= render 'spree/orders/form/update_buttons'
|
||||
|
||||
Reference in New Issue
Block a user