Skip to content

Commit

Permalink
Merge pull request #867 from Murph33/extend_exchange_class
Browse files Browse the repository at this point in the history
Add ActiveModel::Naming to Exchange class
  • Loading branch information
jhawthorn committed Feb 18, 2016
2 parents 746bbf6 + 4c8ada3 commit 902ad00
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/orders/_carton.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<span class="carton-number"><%= carton.number %></span>
-
<span class="carton-state"><%= Spree.t("shipment_states.shipped") %></span>
<span class="carton-exchange"><%= Spree.t(:exchange) if carton.any_exchanges? %></span>
<span class="carton-exchange"><%= Spree::Exchange.model_name.human if carton.any_exchanges? %></span>
<%= Spree.t(:package_from) %>
<strong class="stock-location-name" data-hook="stock-location-name">'<%= carton.stock_location.name %>'</strong>
</legend>
Expand Down
9 changes: 1 addition & 8 deletions core/app/models/spree/exchange.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Spree
class Exchange
class UnableToCreateShipments < StandardError; end
extend ActiveModel::Naming

def initialize(order, reimbursement_objects)
@order = order
Expand Down Expand Up @@ -38,13 +39,5 @@ def to_key
def self.param_key
"spree_exchange"
end

def self.model_name
Spree::Exchange
end

def model_name
self.class.model_name
end
end
end
3 changes: 3 additions & 0 deletions core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ en:
spree/customer_return:
one: Customer Return
other: Customer Returns
spree/exchange:
one: Exchange
other: Exchanges
spree/inventory_unit:
one: Inventory Unit
other: Inventory Units
Expand Down
4 changes: 0 additions & 4 deletions core/spec/models/spree/exchange_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,5 @@ module Spree
describe ".param_key" do # for dom_id
it { expect(Exchange.param_key).to eq "spree_exchange" }
end

describe ".model_name" do # for dom_id
it { expect(Exchange.model_name).to eq Spree::Exchange }
end
end
end

0 comments on commit 902ad00

Please sign in to comment.