diff --git a/core/app/views/spree/admin/shared/_order_tabs.html.erb b/core/app/views/spree/admin/shared/_order_tabs.html.erb index 2d88fdd6837..3f44559ef96 100644 --- a/core/app/views/spree/admin/shared/_order_tabs.html.erb +++ b/core/app/views/spree/admin/shared/_order_tabs.html.erb @@ -1,13 +1,13 @@ -

<%= t(:order) %> <%= @order.number %>

+

<%= t(:order) + " #{@order.number}" %>

<% content_for :sidebar do %>
-

<%= t(:order) %> #<%= @order.number%>

-
<%= t(:status) %>: <%= t(@order.state, :scope => :order_state) %>
-
<%= t(:total) %>: <%= number_to_currency @order.total %>
+

<%= "#{t(:order)} ##{@order.number} " %>

+
<%= "#{t(:status)}: #{t("order_state.#{@order.state}")}" %>
+
<%= "#{t(:total)}: #{number_to_currency @order.total}" %>
<% if @order.completed? %> -
<%= t(:shipment) %>: <%= t(@order.shipment_state, :scope => :shipment_state, :default => [:missing, "none"]) %>
-
<%= t(:payment) %>: <%= t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %>
+
<%= "#{t(:shipment)}: #{t("shipment_states.#{@order.shipment_state}")}" %>
+
<%= "#{t(:payment)}: #{t("payment_states.#{@order.payment_state}")}" %>
<% end %>
diff --git a/core/app/views/spree/admin/shared/_update_order_state.js b/core/app/views/spree/admin/shared/_update_order_state.js index 30d12c2662e..e1e243b48d6 100644 --- a/core/app/views/spree/admin/shared/_update_order_state.js +++ b/core/app/views/spree/admin/shared/_update_order_state.js @@ -1,6 +1,6 @@ -$('#order_tab_summary h5#order_status').html('<%= j t(:status) %>: <%= j t(@order.state, :scope => :order_state) %>'); -$('#order_tab_summary h5#order_total').html('<%= j t(:total) %>: <%= j number_to_currency @order.total %>'); +$('#order_tab_summary h5#order_status').html('<%= "#{t(:status)}: #{t("order_state.#{@order.state}")}" %>'); +$('#order_tab_summary h5#order_total').html('<%= "#{t(:total)}: #{number_to_currency @order.total}" %>'); <% if @order.completed? %> -$('#order_tab_summary h5#payment_status').html('<%= j t(:payment) %>: <%= j t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %>'); -$('#order_tab_summary h5#shipment_status').html('<%= j t(:shipment) %>: <%= j t(@order.shipment_state, :scope => :shipment_state, :default => [:missing, "none"]) %>'); +$('#order_tab_summary h5#payment_status').html('<%= "#{t(:payment)}: #{t("payment_states.#{@order.payment_state}")}" %>'); +$('#order_tab_summary h5#shipment_status').html('<%= "#{t(:shipment)}: #{t("shipment_states.#{@order.shipment_state}")}" %>'); <% end %> diff --git a/core/spec/requests/admin/orders/order_details_spec.rb b/core/spec/requests/admin/orders/order_details_spec.rb index 2c4e09f3bb4..80bd60aff27 100644 --- a/core/spec/requests/admin/orders/order_details_spec.rb +++ b/core/spec/requests/admin/orders/order_details_spec.rb @@ -1,19 +1,14 @@ -# coding: utf-8 require 'spec_helper' describe "Order Details" do context "edit order page" do - - before do + it "should allow me to edit order details", :js => true do reset_spree_preferences do |config| config.allow_backorders = true end - end - - let(:product) { Factory(:product, :name => 'spree t-shirt', :on_hand => 5, :price => 19.99) } - let(:order) { Factory(:order, :completed_at => "2011-02-01 12:36:15", :number => "R100", :state => :complete) } - it "should allow me to edit order details", :js => true do + order = Factory(:order, :completed_at => "2011-02-01 12:36:15", :number => "R100") + product = Factory(:product, :name => 'spree t-shirt', :on_hand => 5) order.add_variant(product.master, 2) order.inventory_units.each do |iu| iu.update_attribute_without_callbacks('state', 'sold') @@ -30,36 +25,5 @@ fill_in "order_line_items_attributes_0_quantity", :with => "1" page.should have_content("Total: $19.99") end - - it "should render details properly" do - sign_in_as!(Factory(:admin_user)) - - visit spree.edit_admin_order_path(order) - - within "#sidebar" do - find("#order_number").text.should == "Order #R100" - find("#order_status").text.should == "Status: complete" - find("#shipment_status").text.should == "Shipment: none" - find("#payment_status").text.should == "Payment: none" - end - - I18n.backend.store_translations I18n.locale, - :shipment_state => { :missing => 'some text' }, - :payment_states => { :missing => 'other text' }, - :number => { :currency => { :format => { - :format => "%n—%u", - :unit => "£" - }}} - - visit spree.edit_admin_order_path(order) - - within "#sidebar" do - # beware - the dash before pound is really em dash character '—' - find("#order_total").text.should == "#{I18n.t(:total)}: 0.00—£" - find("#shipment_status").text.should == "#{I18n.t(:shipment)}: some text" - find("#payment_status").text.should == "#{I18n.t(:payment)}: other text" - end - - end end end