Permalink
Browse files

Spree 2.0

  • Loading branch information...
1 parent c29d0cb commit 736252c258672d07f5327c2dd86ffc9a1ae280d6 @geermc4 geermc4 committed with JDutil Jun 5, 2013
@@ -6,7 +6,7 @@ class Admin::StoreCreditsController < Admin::ResourceController
private
def check_amounts
if (@store_credit.remaining_amount < @store_credit.amount)
- flash[:error] = I18n.t(:cannot_edit_used)
+ flash[:error] = Spree.t(:cannot_edit_used)
redirect_to admin_store_credits_path
end
end
@@ -54,7 +54,7 @@ def process_store_credit
sca.update_attributes({:amount => -(@store_credit_amount)})
else
# create adjustment off association to prevent reload
- sca = adjustments.store_credits.create(:label => I18n.t(:store_credit) , :amount => -(@store_credit_amount))
+ sca = adjustments.store_credits.create(:label => Spree.t(:store_credit) , :amount => -(@store_credit_amount))
end
end
@@ -4,7 +4,7 @@ class StoreCreditMinimumValidator < ActiveModel::Validator
def validate(record)
store_credit_amount = record.instance_variable_get(:@store_credit_amount).to_f
if Spree::Config[:use_store_credit_minimum] and record.item_total < Spree::Config[:use_store_credit_minimum].to_f and store_credit_amount > 0 and record.errors.empty?
- record.errors.add :base, I18n.t("errors.messages.store_credit_minimum_order_not_reach", :amount => number_to_currency(Spree::Config[:use_store_credit_minimum].to_f))
+ record.errors.add :base, Spree.t("errors.messages.store_credit_minimum_order_not_reach", :amount => number_to_currency(Spree::Config[:use_store_credit_minimum].to_f))
end
end
end
@@ -2,14 +2,14 @@
:virtual_path => "spree/admin/shared/_configuration_menu",
:name => "store_credits_admin_configurations_menu",
:insert_bottom => "[data-hook='admin_configurations_sidebar_menu']",
- :text => "<%= configurations_sidebar_menu_item t(:store_credits), admin_store_credits_url %>",
+ :text => "<%= configurations_sidebar_menu_item Spree.t(:store_credits), admin_store_credits_url %>",
:disabled => false)
Deface::Override.new(
:virtual_path => "spree/admin/users/index",
:name => "store_credits_admin_users_index_row_actions",
:insert_bottom => "[data-hook='admin_users_index_row_actions']",
- :text => "&nbsp;<%= link_to_with_icon('add', t('add_store_credit'), new_admin_user_store_credit_url(user)) %>",
+ :text => "&nbsp;<%= link_to_with_icon('add', Spree.t('add_store_credit'), new_admin_user_store_credit_url(user)) %>",
:disabled => false)
Deface::Override.new(
@@ -1,6 +1,6 @@
<p class="field">
<% field_name = "#{param_prefix}[preferred_amount]" %>
- <%= label_tag field_name, t(:preferred_amount) %>
+ <%= label_tag field_name, Spree.t(:preferred_amount) %>
<%= preference_field_tag(field_name,
promotion_action.get_preference(:amount),
:type => promotion_action.preferred_amount) %>
@@ -1,8 +1,8 @@
<%= f.field_container :amount do %>
- <%= f.label :amount, t("amount")%><br />
+ <%= f.label :amount, Spree.t("amount")%><br />
<%= f.text_field :amount %>
<% end %>
<%= f.field_container :reason do %>
- <%= f.label :reason, t("reason")%><br />
+ <%= f.label :reason, Spree.t("reason")%><br />
<%= f.text_field :reason %>
<% end %>
@@ -1,6 +1,6 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
-<h1><%=t("editing_store_credit")%></h1>
+<h1><%=Spree.t("editing_store_credit")%></h1>
<%= render 'spree/shared/error_messages', :target => @store_credit %>
@@ -1,14 +1,14 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
-<h1 class="page-title "> <%= t("listing_store_credits") %></h1><br>
+<h1 class="page-title "> <%= Spree.t("listing_store_credits") %></h1><br>
<table class="index">
<thead>
<tr>
- <th><%= t("user") %></th>
- <th><%= t("amount") %></th>
- <th><%= t("remaining_amount") %></th>
- <th><%= t("reason") %></th>
+ <th><%= Spree.t("user") %></th>
+ <th><%= Spree.t("amount") %></th>
+ <th><%= Spree.t("remaining_amount") %></th>
+ <th><%= Spree.t("reason") %></th>
</tr>
</thead>
<tbody>
@@ -23,16 +23,16 @@
<% if store_credit.amount == store_credit.remaining_amount %>
<%= link_to_edit store_credit, :no_text => true %> &nbsp;
<% else %>
- <%= t(:was_partially_used) %>
+ <%= Spree.t(:was_partially_used) %>
<% end %>
<%= link_to_delete store_credit, :no_text => true %>
<% else %>
- <%= t(:was_fully_used) %>
+ <%= Spree.t(:was_fully_used) %>
<% end %>
</tr>
<% end %>
<% if @store_credits.empty? %>
- <tr><td colspan="4"><%= t(:none) %></td></tr>
+ <tr><td colspan="4"><%= Spree.t(:none) %></td></tr>
<% end %>
</tbody>
</table>
@@ -1,6 +1,6 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
-<h1><%=t("new_store_credit")%></h1>
+<h1><%=Spree.t("new_store_credit")%></h1>
<%= render 'spree/shared/error_messages', :target => @store_credit %>
@@ -1,27 +1,27 @@
<% if @user.has_store_credit? %>
- <h3><%= t("store_credits") %></h3>
+ <h3><%= Spree.t("store_credits") %></h3>
<p>
- <%= t('current_store_credit') %>: <strong><%= number_to_currency @user.store_credits_total %></strong>
+ <%= Spree.t('current_store_credit') %>: <strong><%= number_to_currency @user.store_credits_total %></strong>
</p>
<% if @orders_with_store_credit.present? %>
- <h3><%= t('orders_with_store_credit') %></h3>
+ <h3><%= Spree.t('orders_with_store_credit') %></h3>
<table class="order-summary">
<thead>
<tr>
- <th><%= t("order_number") %></th>
- <th><%= t("order_date") %></th>
- <th><%= t("status") %></th>
- <th><%= t("customer") %></th>
- <th><%= t("total") %></th>
- <th><%= t("store_credit") %></th>
+ <th><%= Spree.t("order_number") %></th>
+ <th><%= Spree.t("order_date") %></th>
+ <th><%= Spree.t("status") %></th>
+ <th><%= Spree.t("customer") %></th>
+ <th><%= Spree.t("total") %></th>
+ <th><%= Spree.t("store_credit") %></th>
</tr>
</thead>
<tbody>
<% @orders_with_store_credit.each do |order| %>
<tr class="<%= cycle('even', 'odd') %>">
<td><%= link_to order.number, order_url(order) %></td>
<td><%=order.created_at.to_date%></td>
- <td><%= t(order.state).titleize %></td>
+ <td><%= Spree.t(order.state).titleize %></td>
<td><%= order.user.email if order.user %></td>
<td><%= number_to_currency order.total %></td>
<td><%= number_to_currency order.store_credit_amount %></td>
View
@@ -1,21 +1,22 @@
---
en:
- add_store_credit: "Add store credit"
- current_store_credit: "Current store credit"
- editing_store_credit: "Editing store credit"
- enter_desired_amount_of_store_credit: "Enter amount, which you want to use"
- listing_store_credits: "Store credits"
- new_store_credit: "New store credit"
- manage_store_credits: "Manage store credits"
- orders_with_store_credit: "Orders with store credit"
- remaining_amount: "Remaining amount"
- store_credit: "Store Credit"
- store_credit_maximum_amount: "The store credit amount should be less or equal to %{amount}. This is mandatory for the order to be confirmed."
- store_credits: "Store Credits"
- you_have_store_credit: "You have %{amount} of store credits"
- was_fully_used: "was fully used"
- was_partially_used: "was partially used"
- cannot_edit_used: "Cannot be edited because it has been used"
- errors:
- messages:
- store_credit_minimum_order_not_reach: "Order's item total is less than the minimum allowed (%{amount}) to use store credit."
+ spree:
+ add_store_credit: "Add store credit"
+ current_store_credit: "Current store credit"
+ editing_store_credit: "Editing store credit"
+ enter_desired_amount_of_store_credit: "Enter amount, which you want to use"
+ listing_store_credits: "Store credits"
+ new_store_credit: "New store credit"
+ manage_store_credits: "Manage store credits"
+ orders_with_store_credit: "Orders with store credit"
+ remaining_amount: "Remaining amount"
+ store_credit: "Store Credit"
+ store_credit_maximum_amount: "The store credit amount should be less or equal to %{amount}. This is mandatory for the order to be confirmed."
+ store_credits: "Store Credits"
+ you_have_store_credit: "You have %{amount} of store credits"
+ was_fully_used: "was fully used"
+ was_partially_used: "was partially used"
+ cannot_edit_used: "Cannot be edited because it has been used"
+ errors:
+ messages:
+ store_credit_minimum_order_not_reach: "Order's item total is less than the minimum allowed (%{amount}) to use store credit."
View
@@ -1,20 +1,21 @@
---
fr-FR:
- add_store_credit: "Ajouter un avoir"
- current_store_credit: "Solde de vos avoirs"
- editing_store_credit: "Editer les avoirs"
- enter_desired_amount_of_store_credit: "Entrer un montant d'avoir à utiliser"
- listing_store_credits: "Listes des avoirs"
- new_store_credit: "Nouvel avoir"
- manage_store_credits: "Gérer les avoirs"
- orders_with_store_credit: "Commandes utilisant des avoirs"
- remaining_amount: "Montant restant"
- store_credit: "Avoirs"
- store_credits: "Avoirs sur la boutique"
- you_have_store_credit: "Vous avez un avoir de %{amount}."
- was_fully_used: "on été totalement utilisés"
- was_partially_used: "on été partialement utilisés"
- cannot_edit_used: "Cannot be edited because it has been used"
- errors:
- messages:
- store_credit_minimum_order_not_reach: "Afin d'utiliser votre avoir, le montant total de votre commande doit etre supérieur au montant minimum autorisé (%{amount})"
+ spree:
+ add_store_credit: "Ajouter un avoir"
+ current_store_credit: "Solde de vos avoirs"
+ editing_store_credit: "Editer les avoirs"
+ enter_desired_amount_of_store_credit: "Entrer un montant d'avoir à utiliser"
+ listing_store_credits: "Listes des avoirs"
+ new_store_credit: "Nouvel avoir"
+ manage_store_credits: "Gérer les avoirs"
+ orders_with_store_credit: "Commandes utilisant des avoirs"
+ remaining_amount: "Montant restant"
+ store_credit: "Avoirs"
+ store_credits: "Avoirs sur la boutique"
+ you_have_store_credit: "Vous avez un avoir de %{amount}."
+ was_fully_used: "on été totalement utilisés"
+ was_partially_used: "on été partialement utilisés"
+ cannot_edit_used: "Cannot be edited because it has been used"
+ errors:
+ messages:
+ store_credit_minimum_order_not_reach: "Afin d'utiliser votre avoir, le montant total de votre commande doit etre supérieur au montant minimum autorisé (%{amount})"
View
@@ -1,2 +1,3 @@
fr:
- store_credit_maximum_amount: "Le montant de votre avoir doit être inférieur ou égal à %{amount}. Ceci est nécessaire afin que le paiement soit validé."
+ spree:
+ store_credit_maximum_amount: "Le montant de votre avoir doit être inférieur ou égal à %{amount}. Ceci est nécessaire afin que le paiement soit validé."
View
@@ -1,21 +1,22 @@
---
pt-BR:
- add_store_credit: "Adicionar crédito"
- current_store_credit: "Crédito atual"
- editing_store_credit: "Editar crédito"
- enter_desired_amount_of_store_credit: "Informe o montante de crédito que deseja usar"
- listing_store_credits: "Créditos"
- new_store_credit: "Novo crédito"
- manage_store_credits: "Gerenciar créditos"
- orders_with_store_credit: "Pedidos com crédito"
- remaining_amount: "Montante restante"
- store_credit: "Crédito da Loja"
- store_credit_maximum_amount: "O montante de crédito deve ser menor ou igual a %{amount}. Isto é obrigatório para o pedido ser confirmado."
- store_credits: "Créditos da Loja"
- you_have_store_credit: "Você tem %{amount} de crédito da loja"
- was_fully_used: "foi totalmente usado"
- was_partially_used: "foi parcialmente usado"
- cannot_edit_used: "Não pode ser editado porque já foi usado"
- errors:
- messages:
- store_credit_minimum_order_not_reach: "Total do item do pedido é menor do que o mínimo permitido (%{amount}) para usar crédito da loja."
+ spree:
+ add_store_credit: "Adicionar crédito"
+ current_store_credit: "Crédito atual"
+ editing_store_credit: "Editar crédito"
+ enter_desired_amount_of_store_credit: "Informe o montante de crédito que deseja usar"
+ listing_store_credits: "Créditos"
+ new_store_credit: "Novo crédito"
+ manage_store_credits: "Gerenciar créditos"
+ orders_with_store_credit: "Pedidos com crédito"
+ remaining_amount: "Montante restante"
+ store_credit: "Crédito da Loja"
+ store_credit_maximum_amount: "O montante de crédito deve ser menor ou igual a %{amount}. Isto é obrigatório para o pedido ser confirmado."
+ store_credits: "Créditos da Loja"
+ you_have_store_credit: "Você tem %{amount} de crédito da loja"
+ was_fully_used: "foi totalmente usado"
+ was_partially_used: "foi parcialmente usado"
+ cannot_edit_used: "Não pode ser editado porque já foi usado"
+ errors:
+ messages:
+ store_credit_minimum_order_not_reach: "Total do item do pedido é menor do que o mínimo permitido (%{amount}) para usar crédito da loja."
View
@@ -1,22 +1,23 @@
---
ru:
- add_store_credit: "Дать бонус"
- current_store_credit: "Текущий бонус"
- editing_store_credit: "Редактирование бонуса"
- enter_desired_amount_of_store_credit: "Введите сумму, которую Вы хотите использовать"
- listing_store_credits: "Бонусы"
- new_store_credit: "Новый бонус"
- manage_store_credits: "Управление кредитами магазина (бонусами)"
- orders_with_store_credit: "Заказы, частично или полностью оплаченные бонусами"
- remaining_amount: "Remaining amount"
- store_credit: "Бонус"
- store_credits: "Бонусы"
- you_have_store_credit: "Ваш суммарный бонус составляет %{amount}"
- was_fully_used: "был полностью использован"
- was_partially_used: "был частично использован"
- cannot_edit_used: "Cannot be edited because it has been used"
+ spree:
+ add_store_credit: "Дать бонус"
+ current_store_credit: "Текущий бонус"
+ editing_store_credit: "Редактирование бонуса"
+ enter_desired_amount_of_store_credit: "Введите сумму, которую Вы хотите использовать"
+ listing_store_credits: "Бонусы"
+ new_store_credit: "Новый бонус"
+ manage_store_credits: "Управление кредитами магазина (бонусами)"
+ orders_with_store_credit: "Заказы, частично или полностью оплаченные бонусами"
+ remaining_amount: "Remaining amount"
+ store_credit: "Бонус"
+ store_credits: "Бонусы"
+ you_have_store_credit: "Ваш суммарный бонус составляет %{amount}"
+ was_fully_used: "был полностью использован"
+ was_partially_used: "был частично использован"
+ cannot_edit_used: "Cannot be edited because it has been used"
- activerecord:
- attributes:
- order:
- remove_store_credits: "Отменить использование бонуса"
+ activerecord:
+ attributes:
+ order:
+ remove_store_credits: "Отменить использование бонуса"
@@ -1,5 +1,5 @@
require 'spree_core'
-require 'spree_promo'
+#require 'spree_promo'
module SpreeStoreCredits
class Engine < Rails::Engine
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ["lib"]
- s.add_dependency 'spree_core', '~> 1.3'
- s.add_dependency 'spree_promo', '~> 1.3'
+ s.add_dependency 'spree_core', '~> 2.0.0'
+# s.add_dependency 'spree_promo', '~> 1.3.2'
s.add_development_dependency 'capybara', '1.0.1'
s.add_development_dependency 'ffaker'

0 comments on commit 736252c

Please sign in to comment.