From cb1f79f59a725b63e17add171dd30f7a43e77ece Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Wed, 28 Oct 2015 15:42:14 +1100 Subject: [PATCH] Updating front end order details, invoices and pdfs to display names of line_items as opposed to variants --- .../stylesheets/darkswarm/typography.css.sass | 16 ++++++++++------ app/assets/stylesheets/mail/email.css.sass | 6 +++++- .../spree/admin/orders/_invoice_table.html.haml | 9 +-------- .../spree/order_mailer/_order_summary.html.haml | 9 +-------- app/views/spree/orders/_line_item.html.haml | 10 +--------- app/views/spree/shared/_line_item_name.html.haml | 6 ++++++ app/views/spree/shared/_order_details.html.haml | 10 +--------- 7 files changed, 25 insertions(+), 41 deletions(-) create mode 100644 app/views/spree/shared/_line_item_name.html.haml diff --git a/app/assets/stylesheets/darkswarm/typography.css.sass b/app/assets/stylesheets/darkswarm/typography.css.sass index 97230d5b0a..8c151db832 100644 --- a/app/assets/stylesheets/darkswarm/typography.css.sass +++ b/app/assets/stylesheets/darkswarm/typography.css.sass @@ -10,8 +10,8 @@ $headingFont: 'Oswald' $bodyFont: 'Roboto' body - @include bodyFont - font-weight: 400 + @include bodyFont + font-weight: 400 a color: $clr-brick &:hover, &:focus, &:active @@ -52,7 +52,7 @@ small, .small .pre-line white-space: pre-line - + .light color: #999 display: inline @@ -66,13 +66,17 @@ small, .small .brick color: $clr-brick -.hr-light +.hr-light border-color: rgba(#ddd, 0.25) h1, h2, h3, h4, h5, h6 @include headingFont padding: 0px +.inline-header + display: inline-block + margin: 0px + ul.bullet-list, ul.check-list margin: 0 0 0 1.25em !important li @@ -108,12 +112,12 @@ ul.check-list .footer-pad padding-bottom: 100px - + // These selectors match the default Foundation selectors // For clean overriden magic table tr th, table tr td color: #333333 -table thead tr th, table thead tr td, table tfoot tr th, table tfoot tr td +table thead tr th, table thead tr td, table tfoot tr th, table tfoot tr td color: #333333 span.email diff --git a/app/assets/stylesheets/mail/email.css.sass b/app/assets/stylesheets/mail/email.css.sass index 5f0a91bd72..4256357923 100644 --- a/app/assets/stylesheets/mail/email.css.sass +++ b/app/assets/stylesheets/mail/email.css.sass @@ -66,7 +66,7 @@ table.order-summary padding-right: 5px h4 margin-top: 15px - tfoot + tfoot tr:first-child td border-top: 1px solid black padding-top: 5px @@ -303,3 +303,7 @@ ul width: auto!important img.float-right float: none!important + +.inline-header + display: inline-block + margin: 0px diff --git a/app/views/spree/admin/orders/_invoice_table.html.haml b/app/views/spree/admin/orders/_invoice_table.html.haml index 9a7ebf14ce..12e0d198bb 100644 --- a/app/views/spree/admin/orders/_invoice_table.html.haml +++ b/app/views/spree/admin/orders/_invoice_table.html.haml @@ -13,14 +13,7 @@ - @order.line_items.each do |item| %tr %td - - if item.variant.product.name == item.variant.name_to_display - %strong= "#{raw(item.variant.product.name)}" - - else - %strong - %span= "#{raw(item.variant.product.name)}" - %span= "- " + "#{raw(item.variant.name_to_display)}" - - if item.variant.options_text - = "(" + "#{raw(item.variant.options_text)}" + ")" + = render 'spree/shared/line_item_name', line_item: item %td{:align => "right"} = item.quantity %td{:align => "right"} diff --git a/app/views/spree/order_mailer/_order_summary.html.haml b/app/views/spree/order_mailer/_order_summary.html.haml index 86b1af1f3b..9f7afdb25e 100644 --- a/app/views/spree/order_mailer/_order_summary.html.haml +++ b/app/views/spree/order_mailer/_order_summary.html.haml @@ -11,14 +11,7 @@ - @order.line_items.each do |item| %tr %td - - if item.variant.product.name == item.variant.name_to_display - %strong= "#{raw(item.variant.product.name)}" - - else - %strong - %span= "#{raw(item.variant.product.name)}" - %span= "- " + "#{raw(item.variant.name_to_display)}" - - if item.variant.options_text - = "(" + "#{raw(item.variant.options_text)}" + ")" + = render 'spree/shared/line_item_name', line_item: item %br %small %em= raw(item.variant.product.supplier.name) diff --git a/app/views/spree/orders/_line_item.html.haml b/app/views/spree/orders/_line_item.html.haml index d687290561..6014b617a9 100644 --- a/app/views/spree/orders/_line_item.html.haml +++ b/app/views/spree/orders/_line_item.html.haml @@ -15,15 +15,7 @@ - else = link_to image_tag(variant.images.first.attachment.url(:mini)), variant.product - - if variant.product.name == variant.name_to_display - %h5 - %span= variant.product.name - %span.text-small.text-skinny= " (" + variant.options_text + ")" unless variant.options_text.empty? - - else - %h5 - %span= variant.product.name - %span= "- " + variant.name_to_display - %span.text-small.text-skinny= " (" + variant.options_text + ")" unless variant.options_text.empty? + = render 'spree/shared/line_item_name', line_item: line_item - if @order.insufficient_stock_lines.include? line_item %span.out-of-stock diff --git a/app/views/spree/shared/_line_item_name.html.haml b/app/views/spree/shared/_line_item_name.html.haml new file mode 100644 index 0000000000..12a32772a4 --- /dev/null +++ b/app/views/spree/shared/_line_item_name.html.haml @@ -0,0 +1,6 @@ +%h5.inline-header + = "#{raw(line_item.product.name)}" + - unless line_item.product.name.include? line_item.name_to_display + %span= "- #{raw(line_item.name_to_display)}" +- if line_item.options_text + = "(#{raw(line_item.options_text)})" diff --git a/app/views/spree/shared/_order_details.html.haml b/app/views/spree/shared/_order_details.html.haml index e8315a00e9..e9d14648d1 100644 --- a/app/views/spree/shared/_order_details.html.haml +++ b/app/views/spree/shared/_order_details.html.haml @@ -108,15 +108,7 @@ = link_to image_tag(item.variant.images.first.attachment.url(:mini)), item.variant.product - - if item.variant.product.name == item.variant.name_to_display - %h5 - %span= item.variant.product.name - %span.text-small.text-skinny= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? - - else - %h5 - %span= item.variant.product.name - %span= "- " + item.variant.name_to_display - %span.text-small.text-skinny= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? + = 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