Skip to content

Commit

Permalink
Simplify view with number helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
mkllnk committed Oct 16, 2023
1 parent c2b8265 commit c0938d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/order_balance.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class OrderBalance
delegate :zero?, :abs, :to_s, :to_f, :to_d, :<, :>, to: :amount
delegate :negative?, :positive?, :zero?, :abs, :to_s, :to_f, :to_d, :<, :>, to: :amount

def initialize(order)
@order = order
Expand Down
6 changes: 3 additions & 3 deletions app/views/spree/orders/_totals_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
%td.text-right.total
%strong
= order.display_payment_total.to_html
- if order.outstanding_balance? && order.outstanding_balance > 0
- if order.outstanding_balance.positive?
%tr.total
%td.text-right{colspan: "3"}
%h5.not-paid
= t :order_balance_due
%td.text-right.total.not-paid
%h5.not-paid
= order.display_outstanding_balance.to_html
- if order.outstanding_balance? && order.outstanding_balance < 0
- if order.outstanding_balance.negative?
%tr.total
%td.text-right{colspan: "3"}
%h5
Expand All @@ -49,7 +49,7 @@
%h5
= order.display_outstanding_balance.to_html

- if order.total_tax > 0
- if order.total_tax.positive?
#tax
%tr#tax-row.total
%td.text-right{colspan: "3"}
Expand Down

0 comments on commit c0938d1

Please sign in to comment.