diff --git a/backend/app/assets/stylesheets/spree/backend/components/_pills.scss b/backend/app/assets/stylesheets/spree/backend/components/_pills.scss new file mode 100644 index 00000000000..3f2c818c51b --- /dev/null +++ b/backend/app/assets/stylesheets/spree/backend/components/_pills.scss @@ -0,0 +1,91 @@ +.pill { + display: inline-block; + padding: 0.2em 0.9em; + border-radius: 10px; + font-size: $font-size-pill; + background: $color-pill-neutral; + color: $color-pill-neutral-text; + white-space: nowrap; + + $states: ( + complete: ( + background: $color-pill-complete, + color: $color-pill-complete-text + ), + active: ( + background: $color-pill-active, + color: $color-pill-active-text + ), + inactive: ( + background: $color-pill-inactive, + color: $color-pill-inactive-text + ), + pending: ( + background: $color-pill-pending, + color: $color-pill-pending-text + ), + warning: ( + background: $color-pill-warning, + color: $color-pill-warning-text + ), + error: ( + background: $color-pill-error, + color: $color-pill-error-text + ) + ); + + @each $name, $colors in $states { + &-#{$name} { + background: map-get($colors, background); + color: map-get($colors, color); + } + } +} + +// Extend pill states for custom order, payment, and shipment state names +.pill-address, +.pill-awaiting, +.pill-awaiting_return, +.pill-backorder, +.pill-backordered, +.pill-balance_due, +.pill-cart, +.pill-checkout, +.pill-confirm, +.pill-credit_owed, +.pill-delivery, +.pill-in_transit, +.pill-on_hand, +.pill-partial, +.pill-payment, +.pill-processing, +.pill-resumed { + @extend .pill-pending; +} + +.pill-authorized, +.pill-canceled, +.pill-completed, +.pill-expired, +.pill-given_to_customer, +.pill-lost_in_transit, +.pill-paid, +.pill-received, +.pill-reimbursed, +.pill-returned, +.pill-shipped, +.pill-shipped_wrong_item, +.pill-short_shipped, +.pill-unexchanged, +.pill-void { + @extend .pill-complete; +} + +.pill-failed { + @extend .pill-warning; +} + +.pill-errored, +.pill-invalid { + @extend .pill-error; +} diff --git a/backend/app/assets/stylesheets/spree/backend/components/_states.scss b/backend/app/assets/stylesheets/spree/backend/components/_states.scss index 16b3ce7d6cd..2b5eccb6a41 100644 --- a/backend/app/assets/stylesheets/spree/backend/components/_states.scss +++ b/backend/app/assets/stylesheets/spree/backend/components/_states.scss @@ -22,12 +22,3 @@ } } } - -table tbody tr { - &[class*="state"] td:first-child { - border-left-width: 3px; - } - &.state-complete td:first-child { border-left-color: $brand-success } - &.state-cart td:first-child { border-left-color: very-light($brand-warning, 6) } - &.state-canceled td:first-child { border-left-color: $brand-danger } -} diff --git a/backend/app/assets/stylesheets/spree/backend/globals/_variables.scss b/backend/app/assets/stylesheets/spree/backend/globals/_variables.scss index ad3fe88dd7b..454286e4f2f 100644 --- a/backend/app/assets/stylesheets/spree/backend/globals/_variables.scss +++ b/backend/app/assets/stylesheets/spree/backend/globals/_variables.scss @@ -6,6 +6,7 @@ //-------------------------------------------------------------- @include solidus-deprecated-variable("base-font-family", "font-family-base"); $base-font-family: "Open Sans", "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif !default; +$font-size-pill: 11px; // Colors //-------------------------------------------------------------- @@ -74,6 +75,27 @@ $color-btn-text: $color-1 !default; $color-btn-hover-bg: $color-2 !default; $color-btn-hover-text: $color-1 !default; +// Pill colors +// +// For now these are custom assigned colors just for this section. As we go +// about updating other areas of the admin we will likely want to pull these +// colors out into better named variables. +$color-pill-text: #1f2933; +$color-pill-neutral: #e6e6e6; +$color-pill-neutral-text: $color-pill-text; +$color-pill-complete: #c8d8e8; +$color-pill-complete-text: $color-pill-text; +$color-pill-active: #bbe5b3; +$color-pill-active-text: $color-pill-text; +$color-pill-inactive: $color-pill-neutral; +$color-pill-inactive-text: lighten($color-pill-text, 30%); +$color-pill-pending: #ffe87d; +$color-pill-pending-text: $color-pill-text; +$color-pill-warning: #f9b36d; +$color-pill-warning-text: $color-pill-text; +$color-pill-error: #ff967b; +$color-pill-error-text: $color-pill-text; + // Actions colors $color-action-edit-bg: very-light($color-success, 5 ) !default; $color-action-edit-brd: very-light($color-success, 20 ) !default; diff --git a/backend/app/assets/stylesheets/spree/backend/sections/_style_guide.scss b/backend/app/assets/stylesheets/spree/backend/sections/_style_guide.scss index d308dc5706c..52f629472a8 100644 --- a/backend/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +++ b/backend/app/assets/stylesheets/spree/backend/sections/_style_guide.scss @@ -114,6 +114,11 @@ } } +.style-guide-code, +.style-guide-result { + margin: 1rem 0; +} + .color-variables { display: flex; flex-wrap: wrap; diff --git a/backend/app/assets/stylesheets/spree/backend/spree_admin.scss b/backend/app/assets/stylesheets/spree/backend/spree_admin.scss index c4f05523c3b..94f7fb73da2 100644 --- a/backend/app/assets/stylesheets/spree/backend/spree_admin.scss +++ b/backend/app/assets/stylesheets/spree/backend/spree_admin.scss @@ -36,6 +36,7 @@ @import 'spree/backend/components/number_field_update'; @import 'spree/backend/components/stock_table'; @import 'spree/backend/components/editable_table'; +@import 'spree/backend/components/pills'; @import 'spree/backend/components/tabs'; @import 'font-awesome'; diff --git a/backend/app/controllers/spree/admin/customer_returns_controller.rb b/backend/app/controllers/spree/admin/customer_returns_controller.rb index 2d9e90a8bb6..eca85025a08 100644 --- a/backend/app/controllers/spree/admin/customer_returns_controller.rb +++ b/backend/app/controllers/spree/admin/customer_returns_controller.rb @@ -1,7 +1,6 @@ module Spree module Admin class CustomerReturnsController < ResourceController - helper 'spree/admin/reimbursements' helper 'spree/admin/reimbursement_type' belongs_to 'spree/order', find_by: :number diff --git a/backend/app/controllers/spree/admin/style_guide_controller.rb b/backend/app/controllers/spree/admin/style_guide_controller.rb index 8fe5330963f..a739470036e 100644 --- a/backend/app/controllers/spree/admin/style_guide_controller.rb +++ b/backend/app/controllers/spree/admin/style_guide_controller.rb @@ -22,6 +22,7 @@ def index 'validation' ], components: [ + 'pills', 'tabs' ], messaging: [ diff --git a/backend/app/helpers/spree/admin/reimbursements_helper.rb b/backend/app/helpers/spree/admin/reimbursements_helper.rb deleted file mode 100644 index 99890c933ef..00000000000 --- a/backend/app/helpers/spree/admin/reimbursements_helper.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Spree - module Admin - module ReimbursementsHelper - def reimbursement_status_color(reimbursement) - case reimbursement.reimbursement_status - when 'reimbursed' then 'success' - when 'pending' then 'notice' - when 'errored' then 'error' - else raise "unknown reimbursement status: #{reimbursement.reimbursement_status}" - end - end - end - end -end diff --git a/backend/app/helpers/spree/admin/stock_transfers_helper.rb b/backend/app/helpers/spree/admin/stock_transfers_helper.rb index cb5423ba38f..4e0ff938c37 100644 --- a/backend/app/helpers/spree/admin/stock_transfers_helper.rb +++ b/backend/app/helpers/spree/admin/stock_transfers_helper.rb @@ -17,10 +17,6 @@ def stock_transfer_edit_or_ship_path(stock_transfer) end end - def stock_transfer_status(stock_transfer) - stock_transfer.closed? ? Spree.t(:closed) : Spree.t(:open) - end - def deleted_variant_admin_hint(variant) newer_variant_with_same_sku = Spree::Variant.find_by(sku: variant.sku) hint_type = newer_variant_with_same_sku ? :deleted_explanation_with_replacement : :deleted_explanation diff --git a/backend/app/views/spree/admin/adjustment_reasons/index.html.erb b/backend/app/views/spree/admin/adjustment_reasons/index.html.erb index c70ddec1821..0ec3a01c535 100644 --- a/backend/app/views/spree/admin/adjustment_reasons/index.html.erb +++ b/backend/app/views/spree/admin/adjustment_reasons/index.html.erb @@ -33,7 +33,9 @@ <%= adjustment_reason.name %> - <%= Spree.t(adjustment_reason.active? ? :active : :inactive) %> + + <%= Spree.t(adjustment_reason.active? ? :active : :inactive) %> + <%= link_to_edit adjustment_reason, no_text: true %> diff --git a/backend/app/views/spree/admin/cancellations/index.html.erb b/backend/app/views/spree/admin/cancellations/index.html.erb index 0176f3fe291..ee09bb686fb 100644 --- a/backend/app/views/spree/admin/cancellations/index.html.erb +++ b/backend/app/views/spree/admin/cancellations/index.html.erb @@ -34,7 +34,11 @@ <% end %> 1 - <%= inventory_unit.state %> + + + <%= Spree.t(inventory_unit.state, scope: :inventory_states) %> + + <%= inventory_unit.shipment.number %> <%= check_box_tag 'inventory_unit_ids[]', inventory_unit.id %> diff --git a/backend/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb b/backend/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb index 5bdbf3fc942..d11fb95c1d2 100644 --- a/backend/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +++ b/backend/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb @@ -20,8 +20,11 @@ <%= reimbursement.display_total %> - - <%= reimbursement.reimbursement_status %> + + <%= Spree.t( + reimbursement.reimbursement_status, + scope: :reimbursement_states + ) %> <%= pretty_time(reimbursement.created_at) %> diff --git a/backend/app/views/spree/admin/customer_returns/_return_item_decision.html.erb b/backend/app/views/spree/admin/customer_returns/_return_item_decision.html.erb index fb3098afd57..d5047cc9930 100644 --- a/backend/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +++ b/backend/app/views/spree/admin/customer_returns/_return_item_decision.html.erb @@ -39,7 +39,12 @@ <%= return_item.acceptance_status_errors %> - <%= return_item.reception_status.humanize %> + + <%= Spree.t( + return_item.reception_status, + scope: :reception_states + ) %> + <% unless return_item.received? %> diff --git a/backend/app/views/spree/admin/customer_returns/_return_item_selection.html.erb b/backend/app/views/spree/admin/customer_returns/_return_item_selection.html.erb index c36f28d68ab..bcd73f20ce4 100644 --- a/backend/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +++ b/backend/app/views/spree/admin/customer_returns/_return_item_selection.html.erb @@ -38,7 +38,12 @@ <%= return_item.display_amount %> - <%= return_item.inventory_unit.state %> + + <%= Spree.t( + return_item.inventory_unit.state, + scope: :inventory_states + ) %> + <%= return_item.exchange_variant.try(:exchange_name) %> diff --git a/backend/app/views/spree/admin/customer_returns/index.html.erb b/backend/app/views/spree/admin/customer_returns/index.html.erb index 2dfe8e9aaef..a3407a49a6e 100644 --- a/backend/app/views/spree/admin/customer_returns/index.html.erb +++ b/backend/app/views/spree/admin/customer_returns/index.html.erb @@ -31,9 +31,9 @@ <%= pretty_time(customer_return.created_at) %> <% if customer_return.fully_reimbursed? %> - <%= Spree.t(:reimbursed) %> + <%= Spree.t(:reimbursed) %> <% else %> - <%= Spree.t(:incomplete) %> + <%= Spree.t(:incomplete) %> <% end %> diff --git a/backend/app/views/spree/admin/orders/_risk_analysis.html.erb b/backend/app/views/spree/admin/orders/_risk_analysis.html.erb index 3946ba1cba1..eb83296e7b6 100644 --- a/backend/app/views/spree/admin/orders/_risk_analysis.html.erb +++ b/backend/app/views/spree/admin/orders/_risk_analysis.html.erb @@ -11,10 +11,11 @@ <%= Spree.t(:failed_payment_attempts) %>: - - <%= link_to Spree.t(:payments_failed_count, - count: @order.payments.failed.count), - spree.admin_order_payments_path(@order) %> + + <%= Spree.t( + :payments_failed_count, + count: @order.payments.failed.count + ) %> @@ -22,21 +23,22 @@ <%= Spree.t(:avs_response) %>: - <% if latest_payment.is_avs_risky? %> - <%= Spree.t(:error) %>: - <%= avs_response_code[latest_payment.avs_response] %> - <% else %> - <%= Spree.t(:success) %> - <% end %> + + <% if latest_payment.is_avs_risky? %> + <%= avs_response_code[latest_payment.avs_response] %> + <% else %> + <%= Spree.t(:success) %> + <% end %> + <%= Spree.t(:cvv_response) %>: - + <% if latest_payment.is_cvv_risky? %> - <%= "#{Spree.t(:error)}: #{cvv_response_code[latest_payment.cvv_response_code]}" %> + <%= cvv_response_code[latest_payment.cvv_response_code] %> <% else %> <%= Spree.t(:success) %> <% end %> diff --git a/backend/app/views/spree/admin/orders/confirm/_payments.html.erb b/backend/app/views/spree/admin/orders/confirm/_payments.html.erb index f7dfb8c6f04..078488c968a 100644 --- a/backend/app/views/spree/admin/orders/confirm/_payments.html.erb +++ b/backend/app/views/spree/admin/orders/confirm/_payments.html.erb @@ -30,8 +30,8 @@ <%= payment.transaction_id %> - - <%= Spree.t(payment.state, scope: :payment_states, default: payment.state.capitalize) %> + + <%= Spree.t(payment.state, scope: :payment_states) %> diff --git a/backend/app/views/spree/admin/orders/index.html.erb b/backend/app/views/spree/admin/orders/index.html.erb index f95ac9ed91f..9a4f17ddd2e 100644 --- a/backend/app/views/spree/admin/orders/index.html.erb +++ b/backend/app/views/spree/admin/orders/index.html.erb @@ -147,14 +147,30 @@ <% @orders.each do |order| %> - + <%= l (@show_only_completed ? order.completed_at : order.created_at).to_date %> <%= link_to order.number, edit_admin_order_path(order) %> - <%= Spree.t("order_state.#{order.state.downcase}") %> - <%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state %> - <% if Spree::Order.checkout_step_names.include?(:delivery) %> - <%= Spree.t("shipment_states.#{order.shipment_state}") if order.shipment_state %> + + + <%= Spree.t(order.state, scope: :order_state) %> + + + + <% if order.payment_state %> + + <%= Spree.t(order.payment_state, scope: :payment_states) %> + <% end %> + + <% if Spree::Order.checkout_step_names.include?(:delivery) %> + + <% if order.shipment_state %> + + <%= Spree.t(order.shipment_state, scope: :shipment_states) %> + + <% end %> + + <% end %> <% if order.user %> <%= link_to order.email, edit_admin_user_path(order.user) %> diff --git a/backend/app/views/spree/admin/payment_methods/index.html.erb b/backend/app/views/spree/admin/payment_methods/index.html.erb index d97aee5c37d..07c9b3c509e 100644 --- a/backend/app/views/spree/admin/payment_methods/index.html.erb +++ b/backend/app/views/spree/admin/payment_methods/index.html.erb @@ -31,7 +31,7 @@ <%= Spree::PaymentMethod.human_attribute_name(:type) %> <%= Spree::PaymentMethod.human_attribute_name(:available_to_users) %> <%= Spree::PaymentMethod.human_attribute_name(:available_to_admin) %> - <%= Spree::PaymentMethod.human_attribute_name(:active) %> + <%= Spree::PaymentMethod.human_attribute_name(:state) %> @@ -43,7 +43,11 @@ <%= method.model_name.human %> <%= method.available_to_users ? Spree.t(:say_yes) : Spree.t(:say_no) %> <%= method.available_to_admin ? Spree.t(:say_yes) : Spree.t(:say_no) %> - <%= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) %> + + + <%= Spree.t(method.active? ? :active : :inactive) %> + + <% if can?(:update, method.becomes(Spree::PaymentMethod)) %> <%= link_to_edit method.becomes(Spree::PaymentMethod), no_text: true %> diff --git a/backend/app/views/spree/admin/payments/_list.html.erb b/backend/app/views/spree/admin/payments/_list.html.erb index 81703dd2dba..bd38d6e5bf3 100644 --- a/backend/app/views/spree/admin/payments/_list.html.erb +++ b/backend/app/views/spree/admin/payments/_list.html.erb @@ -21,7 +21,11 @@ <%= payment_method_name(payment) %> <%= payment.transaction_id %> - <%= Spree.t(payment.state, scope: :payment_states, default: payment.state.capitalize) %> + + + <%= Spree.t(payment.state, scope: :payment_states) %> + +
<%= link_to_with_icon 'save', Spree.t('actions.save'), nil, no_text: true, class: "js-save", data: {action: 'save'} %> diff --git a/backend/app/views/spree/admin/payments/show.html.erb b/backend/app/views/spree/admin/payments/show.html.erb index e2400082be3..e963b7afbd9 100644 --- a/backend/app/views/spree/admin/payments/show.html.erb +++ b/backend/app/views/spree/admin/payments/show.html.erb @@ -3,8 +3,8 @@ <% admin_breadcrumb(link_to plural_resource_name(Spree::Payment), spree.admin_order_payments_path(@order)) %> <% admin_breadcrumb do %> <%= payment_method_name(@payment) %> - - <%= Spree.t(@payment.state, scope: :payment_states, default: @payment.state.capitalize) %> + + <%= Spree.t(@payment.state, scope: :payment_states ) %> <% end %> diff --git a/backend/app/views/spree/admin/promotions/index.html.erb b/backend/app/views/spree/admin/promotions/index.html.erb index 3a852e23de1..db93263a168 100644 --- a/backend/app/views/spree/admin/promotions/index.html.erb +++ b/backend/app/views/spree/admin/promotions/index.html.erb @@ -61,22 +61,14 @@ <% if @promotions.any? %> - - - - - - - - - - + - + + @@ -85,11 +77,26 @@ <% @promotions.each do |promotion| %> - - - - - + + + + + + - + @@ -36,7 +36,9 @@ <%= named_type.name %> - + <% end %> diff --git a/backend/app/views/spree/admin/return_authorizations/_form.html.erb b/backend/app/views/spree/admin/return_authorizations/_form.html.erb index 8f472c279c6..e99f688f832 100644 --- a/backend/app/views/spree/admin/return_authorizations/_form.html.erb +++ b/backend/app/views/spree/admin/return_authorizations/_form.html.erb @@ -34,7 +34,11 @@
<%= inventory_unit.variant.name %>
<%= inventory_unit.variant.options_text %>
- + diff --git a/backend/app/views/spree/admin/return_authorizations/edit.html.erb b/backend/app/views/spree/admin/return_authorizations/edit.html.erb index 4157b9e2cba..b39fd79fdb5 100644 --- a/backend/app/views/spree/admin/return_authorizations/edit.html.erb +++ b/backend/app/views/spree/admin/return_authorizations/edit.html.erb @@ -9,8 +9,15 @@ <%= render partial: 'spree/admin/shared/order_tabs', locals: { current: 'Return Authorizations' } %> <% admin_breadcrumb(link_to plural_resource_name(Spree::ReturnAuthorization), spree.admin_order_return_authorizations_url) %> -<% admin_breadcrumb("#{@return_authorization.number} (#{Spree.t(@return_authorization.state.downcase)})") %> - +<% admin_breadcrumb( + """ + #{ @return_authorization.number } + (#{ Spree.t( + @return_authorization.state, + scope: :return_authorization_states + ) }) + """ +) %> <%= render partial: 'spree/shared/error_messages', locals: { target: @return_authorization } %> diff --git a/backend/app/views/spree/admin/return_authorizations/index.html.erb b/backend/app/views/spree/admin/return_authorizations/index.html.erb index 6e19756d7fe..4bb784cd624 100644 --- a/backend/app/views/spree/admin/return_authorizations/index.html.erb +++ b/backend/app/views/spree/admin/return_authorizations/index.html.erb @@ -28,7 +28,14 @@ <% @return_authorizations.each do |return_authorization| %> - + - + @@ -36,7 +36,9 @@ <%= named_type.name %> - + - + + + <% if Spree::Order.checkout_step_names.include?(:delivery) %> + + <% end %> <% @orders.each do |order| %> - + - + + <% if Spree::Order.checkout_step_names.include?(:delivery) %> + + <% end %> <% end %> diff --git a/backend/spec/features/admin/configuration/payment_methods_spec.rb b/backend/spec/features/admin/configuration/payment_methods_spec.rb index 8125246003d..3aed3d81618 100644 --- a/backend/spec/features/admin/configuration/payment_methods_spec.rb +++ b/backend/spec/features/admin/configuration/payment_methods_spec.rb @@ -19,7 +19,7 @@ expect(all("th")[2].text).to eq("Type") expect(all("th")[3].text).to eq("Available to users") expect(all("th")[4].text).to eq("Available to admin") - expect(all("th")[5].text).to eq("Active") + expect(all("th")[5].text).to eq("State") end within('table#listing_payment_methods') do diff --git a/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb b/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb index 00cb773c376..f8edb7436fd 100644 --- a/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb +++ b/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb @@ -23,7 +23,7 @@ visit spree.edit_admin_order_path(order.number) click_button 'cancel' within(".additional-info") do - expect(find('dt#order_status + dd')).to have_content("canceled") + expect(find('dt#order_status + dd')).to have_content("Canceled") end end @@ -36,7 +36,7 @@ visit spree.edit_admin_order_path(order.number) click_button 'resume' within(".additional-info") do - expect(find('dt#order_status + dd')).to have_content("resumed") + expect(find('dt#order_status + dd')).to have_content("Resumed") end end end diff --git a/backend/spec/features/admin/orders/cancelling_inventory_spec.rb b/backend/spec/features/admin/orders/cancelling_inventory_spec.rb index bff4577e46a..f13b488790b 100644 --- a/backend/spec/features/admin/orders/cancelling_inventory_spec.rb +++ b/backend/spec/features/admin/orders/cancelling_inventory_spec.rb @@ -32,7 +32,7 @@ def visit_order click_button "Cancel Items" expect(page).to have_content("Inventory canceled") - expect(page).to have_content("1 x canceled") + expect(page).to have_content("1 x Canceled") end end diff --git a/backend/spec/features/admin/orders/customer_details_spec.rb b/backend/spec/features/admin/orders/customer_details_spec.rb index 96171021ba6..4b80ff576ed 100644 --- a/backend/spec/features/admin/orders/customer_details_spec.rb +++ b/backend/spec/features/admin/orders/customer_details_spec.rb @@ -103,7 +103,7 @@ # Regression test for https://github.com/spree/spree/issues/2950 and https://github.com/spree/spree/issues/2433 # This act should transition the state of the order as far as it will go too within("#order_tab_summary") do - expect(find("dt#order_status + dd")).to have_content("complete") + expect(find("dt#order_status + dd")).to have_content("Complete") end end diff --git a/backend/spec/features/admin/orders/listing_spec.rb b/backend/spec/features/admin/orders/listing_spec.rb index 1d9df78aad0..29dba3d0905 100644 --- a/backend/spec/features/admin/orders/listing_spec.rb +++ b/backend/spec/features/admin/orders/listing_spec.rb @@ -32,7 +32,7 @@ it "should list existing orders" do within_row(1) do expect(column_text(2)).to eq "R100" - expect(column_text(3)).to eq "cart" + expect(column_text(3)).to eq "Cart" end within_row(2) do diff --git a/backend/spec/features/admin/orders/new_order_spec.rb b/backend/spec/features/admin/orders/new_order_spec.rb index 43c2ae3d1bf..afb55e7420e 100644 --- a/backend/spec/features/admin/orders/new_order_spec.rb +++ b/backend/spec/features/admin/orders/new_order_spec.rb @@ -54,7 +54,7 @@ click_on "Ship" within '.carton-state' do - expect(page).to have_content('shipped') + expect(page).to have_content('Shipped') end end @@ -155,8 +155,8 @@ click_on "Payments" click_on "Continue" - within(".additional-info .state") do - expect(page).to have_content("confirm") + within(".additional-info") do + expect(page).to have_content("Confirm") end end end diff --git a/backend/spec/features/admin/orders/order_details_spec.rb b/backend/spec/features/admin/orders/order_details_spec.rb index 04493ad1c76..0263fc3b638 100644 --- a/backend/spec/features/admin/orders/order_details_spec.rb +++ b/backend/spec/features/admin/orders/order_details_spec.rb @@ -195,7 +195,7 @@ within_row(1) { click_icon 'arrows-h' } complete_split_to(stock_location2, quantity: 2) - expect(page).to have_content("pending package from 'Clarksville'") + expect(page).to have_content("Pending package from 'Clarksville'") expect(order.shipments.count).to eq(1) expect(order.shipments.last.backordered?).to eq(false) @@ -209,7 +209,7 @@ within_row(1) { click_icon 'arrows-h' } complete_split_to(stock_location2, quantity: 5) - expect(page).to have_content("pending package from 'Clarksville'") + expect(page).to have_content("Pending package from 'Clarksville'") expect(order.shipments.count).to eq(1) expect(order.shipments.last.backordered?).to eq(false) @@ -281,7 +281,7 @@ within_row(1) { click_icon 'arrows-h' } complete_split_to(stock_location2, quantity: 2) - expect(page).to have_content("pending package from 'Clarksville'") + expect(page).to have_content("Pending package from 'Clarksville'") expect(order.shipments.count).to eq(1) expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2) @@ -412,16 +412,16 @@ within_row(1) { click_icon 'arrows-h' } complete_split_to(@shipment2, quantity: 1) - expect(page).to have_content("1 x backordered") + expect(page).to have_content("1 x Backordered") - within('.stock-contents', text: "1 x on hand") do + within('.stock-contents', text: "1 x On hand") do within_row(1) { click_icon 'arrows-h' } complete_split_to(@shipment2, quantity: 1) end # Empty shipment should be removed expect(page).to have_css('.stock-contents', count: 1) - expect(page).to have_content("2 x backordered") + expect(page).to have_content("2 x Backordered") end end end @@ -526,7 +526,7 @@ find(".ship-shipment-button").click within '.carton-state' do - expect(page).to have_content('shipped') + expect(page).to have_content('Shipped') end end end diff --git a/backend/spec/features/admin/orders/payments_spec.rb b/backend/spec/features/admin/orders/payments_spec.rb index 0763df824f9..b5789a21bff 100644 --- a/backend/spec/features/admin/orders/payments_spec.rb +++ b/backend/spec/features/admin/orders/payments_spec.rb @@ -66,17 +66,17 @@ within_row(1) do expect(column_text(3)).to eq('$150.00') expect(column_text(4)).to eq('Credit Card') - expect(column_text(6)).to eq('checkout') + expect(column_text(6)).to eq('Checkout') end click_icon :void - expect(page).to have_css('#payment_status', text: 'balance due') + expect(page).to have_css('#payment_status', text: 'Balance due') expect(page).to have_content('Payment Updated') within_row(1) do expect(column_text(3)).to eq('$150.00') expect(column_text(4)).to eq('Credit Card') - expect(column_text(6)).to eq('void') + expect(column_text(6)).to eq('Void') end click_on 'New Payment' @@ -86,7 +86,7 @@ click_icon(:capture) - expect(page).to have_selector('#payment_status', text: 'paid') + expect(page).to have_selector('#payment_status', text: 'Paid') expect(page).not_to have_selector('#new_payment_section') end diff --git a/backend/spec/features/admin/orders/risk_analysis_spec.rb b/backend/spec/features/admin/orders/risk_analysis_spec.rb index aba0254dae3..80cef5d41e3 100644 --- a/backend/spec/features/admin/orders/risk_analysis_spec.rb +++ b/backend/spec/features/admin/orders/risk_analysis_spec.rb @@ -31,7 +31,7 @@ def visit_order click_button('approve') expect(page).to have_content 'Approver' expect(page).to have_content 'Approved at' - expect(page).to have_content 'Status: complete' + expect(page).to have_content 'Status: Complete' end end diff --git a/backend/spec/features/admin/orders/shipments_spec.rb b/backend/spec/features/admin/orders/shipments_spec.rb index d98935b48d7..7934cbb3243 100644 --- a/backend/spec/features/admin/orders/shipments_spec.rb +++ b/backend/spec/features/admin/orders/shipments_spec.rb @@ -33,7 +33,7 @@ def ship_shipment find(".ship-shipment-button").click - expect(page).to have_content("shipped package") + expect(page).to have_content("Shipped package") expect(order.reload.shipment_state).to eq("shipped") end diff --git a/backend/spec/features/admin/users_spec.rb b/backend/spec/features/admin/users_spec.rb index 6238b17b5c0..601db5bf871 100644 --- a/backend/spec/features/admin/users_spec.rb +++ b/backend/spec/features/admin/users_spec.rb @@ -260,7 +260,7 @@ def always_invalid_email end end - [:number, :state, :total].each do |attr| + [:number, :total].each do |attr| context attr do it_behaves_like "a sortable attribute" do let(:text_match_1) { order.send(attr).to_s } @@ -270,6 +270,13 @@ def always_invalid_email end end end + + context "state" do + let(:text_match_1) { "Complete" } + let(:text_match_2) { "Complete" } + let(:table_id) { "listing_orders" } + let(:sort_link) { "orders_#{attr}_title" } + end end context 'items purchased with sorting' do @@ -290,15 +297,18 @@ def always_invalid_email end end - [:number, :state].each do |attr| - context attr do - it_behaves_like "a sortable attribute" do - let(:text_match_1) { order.send(attr).to_s } - let(:text_match_2) { order_2.send(attr).to_s } - let(:table_id) { "listing_items" } - let(:sort_link) { "orders_#{attr}_title" } - end - end + context "number" do + let(:text_match_1) { "R123" } + let(:text_match_2) { "R456" } + let(:table_id) { "listing_items" } + let(:sort_link) { "orders_#{attr}_title" } + end + + context "state" do + let(:text_match_1) { "Complete" } + let(:text_match_2) { "Complete" } + let(:table_id) { "listing_items" } + let(:sort_link) { "orders_#{attr}_title" } end it "has item attributes" do diff --git a/backend/spec/helpers/admin/reimbursements_helper_spec.rb b/backend/spec/helpers/admin/reimbursements_helper_spec.rb deleted file mode 100644 index 310ab147ff0..00000000000 --- a/backend/spec/helpers/admin/reimbursements_helper_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'spec_helper' - -describe Spree::Admin::ReimbursementsHelper, type: :helper do - describe '.reimbursement_status_color' do - subject { helper.reimbursement_status_color(reimbursement) } - - let(:reimbursement) do - Spree::Reimbursement.new(reimbursement_status: status) - end - - context 'when status is reimbursed' do - let(:status) { 'reimbursed' } - it { is_expected.to eq 'success' } - end - - context 'when status is pending' do - let(:status) { 'pending' } - it { is_expected.to eq 'notice' } - end - - context 'when status is pending' do - let(:status) { 'errored' } - it { is_expected.to eq 'error' } - end - - context 'when status is not valid' do - let(:status) { 'noop' } - - it 'should raise an error' do - expect{ subject }.to raise_error(RuntimeError, "unknown reimbursement status: noop") - end - end - end -end diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml index caebe5b8cca..572a9651221 100644 --- a/core/config/locales/en.yml +++ b/core/config/locales/en.yml @@ -180,13 +180,14 @@ en: code: Code description: Description event_name: Event Name - expires_at: Expiration date + expires_at: End name: Name path: Path per_code_usage_limit: Per Code Usage Limit promotion_uses: Promotion Uses - starts_at: Start date - usage_limit: Overall Usage Limit + starts_at: Start + status: Status + usage_limit: Usage Limit spree/promotion/actions/create_adjustment: description: Creates a promotion credit adjustment on the order spree/promotion/actions/create_item_adjustments: @@ -1088,6 +1089,7 @@ en: clear_cache_warning: Clearing cache will temporarily reduce the performance of your store. clone: Clone close: Close + closed: Closed close_stock_transfer: confirm: "Are you sure you want to close this stock transfer?\n\nStock levels will be changed for the received items and you will no longer be able to edit the stock transfer." code: Code @@ -1382,11 +1384,11 @@ en: inventory_not_available: Inventory not available for %{item}. inventory_state: Inventory State inventory_states: - backordered: backordered - canceled: canceled - on_hand: on hand - returned: returned - shipped: shipped + backordered: Backordered + canceled: Canceled + on_hand: On hand + returned: Returned + shipped: Shipped is_not_available_to_shipment_address: is not available to shipment address iso_name: Iso Name item: Item @@ -1591,16 +1593,16 @@ en: order_refresh_totals: Refresh Totals order_resumed: Order resumed order_state: - address: address - awaiting_return: awaiting return - canceled: canceled - cart: cart - complete: complete - confirm: confirm - delivery: delivery - payment: payment - resumed: resumed - returned: returned + address: Address + awaiting_return: Awaiting return + canceled: Canceled + cart: Cart + complete: Complete + confirm: Confirm + delivery: Delivery + payment: Payment + resumed: Resumed + returned: Returned order_summary: Order Summary order_sure_want_to: Are you sure you want to %{event} this order? order_total: Order Total @@ -1634,15 +1636,16 @@ en: payment_processor_choose_link: our payments page payment_state: Payment State payment_states: - balance_due: balance due - checkout: checkout - completed: completed - credit_owed: credit owed - failed: failed - paid: paid - pending: pending - processing: processing - void: void + balance_due: Balance due + checkout: Checkout + completed: Completed + credit_owed: Credit owed + failed: Failed + paid: Paid + pending: Pending + processing: Processing + void: Void + invalid: Invalid payment_updated: Payment Updated payments: Payments percent: Percent @@ -1725,6 +1728,17 @@ en: received_successfully: Received Successfully receiving: Receiving receiving_match: Receiving match + reception_states: + awaiting: Awaiting + canceled: Canceled + expired: Expired + given_to_customer: Given to customer + in_transit: In transit + lost_in_transit: Lost in transit + received: Received + shipped_wrong_item: Wrong item + short_shipped: Short shipped + unexchanged: Unexchanged reception_status: Reception Status reference: Reference refund: Refund @@ -1739,6 +1753,10 @@ en: reimbursed: Reimbursed reimbursement: Reimbursement reimbursement_perform_failed: "Reimbursement could not be performed. Error: %{error}" + reimbursement_states: + errored: Errored + pending: Pending + reimbursed: Reimbursed reimbursement_status: Reimbursement status reimbursement_type: Reimbursement type reimbursement_type_override: Reimbursement Type Override @@ -1758,6 +1776,9 @@ en: resumed: Resumed return: return return_authorization: Return Merchandise Authorization + return_authorization_states: + authorized: Authorized + canceled: Canceled return_authorizations: Return Merchandise Authorizations return_authorization_updated: Return merchandise authorization updated return_item_inventory_unit_ineligible: Return item's inventory unit must be shipped @@ -1839,12 +1860,12 @@ en: shipment_numbers: Shipment numbers shipment_state: Shipment State shipment_states: - backorder: backorder - canceled: canceled - partial: partial - pending: pending - ready: ready - shipped: shipped + backorder: Backorder + canceled: Canceled + partial: Partial + pending: Pending + ready: Ready + shipped: Shipped shipment_transfer_success: 'Variants successfully transferred' shipment_transfer_error: 'There was an error transferring variants' shipments: Shipments
<%= Spree::Promotion.human_attribute_name(:name) %> <%= Spree::Promotion.human_attribute_name(:code) %><%= Spree::Promotion.human_attribute_name(:description) %><%= Spree::Promotion.human_attribute_name(:status) %> <%= Spree::Promotion.human_attribute_name(:usage_limit) %><%= Spree::Promotion.human_attribute_name(:promotion_uses) %><%= Spree::Promotion.human_attribute_name(:uses) %><%= Spree::Promotion.human_attribute_name(:starts_at) %> <%= Spree::Promotion.human_attribute_name(:expires_at) %>
<%= promotion.name %><%= (promotion.codes.size == 1) ? promotion.codes.first.try!(:value) : Spree.t(:number_of_codes, count: promotion.codes.size) %><%= promotion.description %><%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %><%= Spree.t(:current_promotion_usage, count: promotion.usage_count) %><%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %> + <%= (promotion.codes.size == 1) ? promotion.codes.first.try!(:value) : Spree.t(:number_of_codes, count: promotion.codes.size) %> + + + <%= Spree.t(promotion.active?? :active : :inactive) %> + + + <%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %> + + <%= promotion.usage_count %> + + <%= promotion.starts_at.to_date.to_s(:short_date) if promotion.starts_at %> + + <%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %> + <% if can?(:edit, promotion) %> <%= link_to_edit promotion, no_text: true %> diff --git a/backend/app/views/spree/admin/refund_reasons/index.html.erb b/backend/app/views/spree/admin/refund_reasons/index.html.erb index 8ba31dec2a3..a26a96f9519 100644 --- a/backend/app/views/spree/admin/refund_reasons/index.html.erb +++ b/backend/app/views/spree/admin/refund_reasons/index.html.erb @@ -25,7 +25,7 @@
<%= Spree::RefundReason.human_attribute_name(:name) %><%= Spree::RefundReason.human_attribute_name(:active) %><%= Spree::RefundReason.human_attribute_name(:state) %>
- <%= Spree.t(named_type.active? ? :say_yes : :say_no) %> + + <%= Spree.t(named_type.active? ? :active : :inactive) %> + <% if can?(:update, named_type) && named_type.mutable? %> diff --git a/backend/app/views/spree/admin/reimbursements/index.html.erb b/backend/app/views/spree/admin/reimbursements/index.html.erb index 561ad243db0..2825521f12a 100644 --- a/backend/app/views/spree/admin/reimbursements/index.html.erb +++ b/backend/app/views/spree/admin/reimbursements/index.html.erb @@ -22,7 +22,14 @@
<%= reimbursement.id %> <%= reimbursement.total %><%= reimbursement.reimbursement_status %> + + <%= Spree.t( + reimbursement.reimbursement_status, + scope: :reimbursement_states + ) %> + + <%= pretty_time(reimbursement.created_at) %>
<%= inventory_unit.state.humanize %> + + <%= Spree.t(inventory_unit.state, scope: :inventory_states) %> + + <%= return_item.display_amount %>
<%= return_authorization.number %><%= Spree.t(return_authorization.state.downcase) %> + + <%= Spree.t( + return_authorization.state, + scope: :return_authorization_states + ) %> + + <%= return_authorization.display_pre_tax_total.to_html %> <%= pretty_time(return_authorization.created_at) %> diff --git a/backend/app/views/spree/admin/shared/_order_summary.html.erb b/backend/app/views/spree/admin/shared/_order_summary.html.erb index 05709a85d0b..cc3d89c00ca 100644 --- a/backend/app/views/spree/admin/shared/_order_summary.html.erb +++ b/backend/app/views/spree/admin/shared/_order_summary.html.erb @@ -1,7 +1,11 @@
<%= Spree.t(:status) %>:
-
<%= Spree.t(@order.state, scope: :order_state) %>
+
+ + <%= Spree.t(@order.state, scope: :order_state) %> + +
<% if @order.user.present? %>
<%= Spree.t(:user) %>:
@@ -25,11 +29,23 @@
<%= Spree::Order.human_attribute_name(:total) %>:
<%= @order.display_total.to_html %>
-
"><%= Spree::Shipment.model_name.human %>:
-
" id='shipment_status'><%= Spree.t(@order.shipment_state, scope: :shipment_states, default: [:missing, "none"]) %>
+ <% if @order.shipment_state %> +
<%= Spree::Shipment.model_name.human %>:
+
+ + <%= Spree.t(@order.shipment_state, scope: :shipment_states) %> + +
+ <% end %> -
"><%= Spree::Payment.model_name.human %>:
-
" id='payment_status'><%= Spree.t(@order.payment_state, scope: :payment_states, default: [:missing, "none"]) %>
+ <% if @order.payment_state %> +
<%= Spree::Payment.model_name.human %>:
+
+ + <%= Spree.t(@order.payment_state, scope: :payment_states) %> + +
+ <% end %> <% if @order.completed? %>
<%= Spree::Order.human_attribute_name(:completed_at) %>:
diff --git a/backend/app/views/spree/admin/shared/named_types/_index.html.erb b/backend/app/views/spree/admin/shared/named_types/_index.html.erb index 836a119ca00..0b35e5470ce 100644 --- a/backend/app/views/spree/admin/shared/named_types/_index.html.erb +++ b/backend/app/views/spree/admin/shared/named_types/_index.html.erb @@ -25,7 +25,7 @@
<%= Spree.t(:name) %><%= Spree.t(:active) %><%= Spree.t(:state) %>
- <%= Spree.t(named_type.active? ? :say_yes : :say_no) %> + + <%= Spree.t(named_type.active? ? :active : :inactive) %> + <% if named_type.mutable? && can?(:update, named_type) %> diff --git a/backend/app/views/spree/admin/stock_locations/index.html.erb b/backend/app/views/spree/admin/stock_locations/index.html.erb index 4bf3a379be7..e4d3fe7fea6 100644 --- a/backend/app/views/spree/admin/stock_locations/index.html.erb +++ b/backend/app/views/spree/admin/stock_locations/index.html.erb @@ -52,11 +52,9 @@ <%= admin_stock_location_display_name(stock_location) %> - <% if stock_location.active? %> - <%= Spree.t('active') %> - <% else %> - <%= Spree.t('inactive') %> - <% end %> + + <%= Spree.t(stock_location.active? ? :active : :inactive) %> + <% if can?(:display, Spree::StockMovement) %> diff --git a/backend/app/views/spree/admin/stock_transfers/index.html.erb b/backend/app/views/spree/admin/stock_transfers/index.html.erb index 772e46761e5..9b870132d0d 100644 --- a/backend/app/views/spree/admin/stock_transfers/index.html.erb +++ b/backend/app/views/spree/admin/stock_transfers/index.html.erb @@ -94,7 +94,11 @@ <%= stock_transfer.expected_item_count %> <%= stock_transfer.received_item_count %> <%= stock_transfer.shipped_at.try(:to_date) %><%= stock_transfer_status(stock_transfer) %> + + <%= Spree.t(stock_transfer.closed? ? :closed : :open) %> + + <% if stock_transfer.receivable? && can?(:edit, stock_transfer) %> <%= link_to_with_icon 'download', Spree.t('actions.receive'), receive_admin_stock_transfer_path(stock_transfer), no_text: true, data: { action: 'green' } %> diff --git a/backend/app/views/spree/admin/style_guide/topics/components/_pills.html.erb b/backend/app/views/spree/admin/style_guide/topics/components/_pills.html.erb new file mode 100644 index 00000000000..74822d37449 --- /dev/null +++ b/backend/app/views/spree/admin/style_guide/topics/components/_pills.html.erb @@ -0,0 +1,101 @@ +

+ Pills are useful for showing statuses as an admin can get a better idea of the + state of the object by the color alone. These are most effective in a table, + as displayed below, but can also be used in other areas of the system where + appropriate. +

+ +<%- snippet = capture do %> + Complete + Active + Inactive + Pending + Warning + Error +<%- end %> + +
+ <%= snippet %> +
+ +
+
<%= escape_once snippet %>
+
+ +
+

Orders

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DateNumberPaymentsShipmentsCustomerTotal
July 18, 2017R1234PaidShippedlauren@example.com$75.00
July 17, 2017R1234Balance DuePendingjessicajones@example.com$105.00
July 15, 2017R1234Credit OwedReadyjohn@example.com$34.00
+
+ +
+

Promotions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeStatusUsedStartEnd
FALL2017Inactive0September 1, 2017
SAVE_20Active651June 20, 2016
NEWSLETTERExpired358January 1, 2016March 30, 2016
+
diff --git a/backend/app/views/spree/admin/users/items.html.erb b/backend/app/views/spree/admin/users/items.html.erb index c02e5bdc54f..49c73953f7e 100644 --- a/backend/app/views/spree/admin/users/items.html.erb +++ b/backend/app/views/spree/admin/users/items.html.erb @@ -53,13 +53,9 @@
<%= item.quantity %> <%= item.money.to_html %> -
<%= Spree.t("order_state.#{order.state.downcase}") %>
- <% if order.payment_state %> -
<%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) %>
- <% end %> - <% if Spree::Order.checkout_step_names.include?(:delivery) && order.shipment_state %> -
<%= Spree.t("shipment_states.#{order.shipment_state}") %>
- <% end %> + + <%= Spree.t(order.state, scope: :order_state) %> +
<% if can?([:admin, :edit], order) %> diff --git a/backend/app/views/spree/admin/users/orders.html.erb b/backend/app/views/spree/admin/users/orders.html.erb index 90ad356587f..d2265d071c3 100644 --- a/backend/app/views/spree/admin/users/orders.html.erb +++ b/backend/app/views/spree/admin/users/orders.html.erb @@ -25,13 +25,17 @@
<%= sort_link @search, :completed_at, Spree::Order.human_attribute_name(:completed_at), {}, {title: 'orders_completed_at_title'} %> <%= sort_link @search, :number, Spree::Order.human_attribute_name(:number), {}, {title: 'orders_number_title'} %><%= sort_link @search, :state, Spree::Order.human_attribute_name(:state), {}, {title: 'orders_state_title'} %><%= sort_link @search, :state %><%= sort_link @search, :payment_state %><%= sort_link @search, :shipment_state %><%= sort_link @search, :total, Spree::Order.human_attribute_name(:total), {}, {title: 'orders_total_title'} %>
<%= l(order.completed_at.to_date) if order.completed_at %> <% if can?([:admin, :edit], order) %> @@ -40,15 +44,27 @@ <%= order.number %> <% end %> -
<%= Spree.t("order_state.#{order.state.downcase}") %>
- <% if order.payment_state %> -
<%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) %>
- <% end %> - <% if Spree::Order.checkout_step_names.include?(:delivery) && order.shipment_state %> -
<%= Spree.t("shipment_states.#{order.shipment_state}") %>
+
+ + <%= Spree.t(order.state, scope: :order_state) %> + + + <% if order.payment_state %> + + <%= Spree.t(order.payment_state, scope: :payment_states) %> + <% end %> + <% if order.shipment_state %> + + <%= Spree.t(@order.shipment_state, scope: :shipment_states) %> + + <% end %> + <%= order.display_total.to_html %>