Replace references to :split_checkout translation keys with :checkout in views, controllers, etc.

This commit is contained in:
Cillian O'Ruanaidh
2023-12-01 12:37:13 +00:00
parent 3fee77136a
commit b78258c505
13 changed files with 82 additions and 82 deletions

View File

@@ -32,7 +32,7 @@ class CheckoutController < BaseController
return if available_shipping_methods.any?
flash[:error] = I18n.t('split_checkout.errors.no_shipping_methods_available')
flash[:error] = I18n.t('checkout.errors.no_shipping_methods_available')
end
def update
@@ -55,7 +55,7 @@ class CheckoutController < BaseController
private
def render_error
flash.now[:error] ||= I18n.t('split_checkout.errors.saving_failed')
flash.now[:error] ||= I18n.t('checkout.errors.saving_failed')
render status: :unprocessable_entity, cable_ready: cable_car.
replace("#checkout", partial("checkout/checkout")).

View File

@@ -32,21 +32,21 @@ class VoucherAdjustmentsController < BaseController
def add_voucher
if voucher_params[:voucher_code].blank?
@order.errors.add(:voucher_code, I18n.t('split_checkout.errors.voucher_not_found'))
@order.errors.add(:voucher_code, I18n.t('checkout.errors.voucher_not_found'))
return false
end
voucher = Voucher.find_by(code: voucher_params[:voucher_code], enterprise: @order.distributor)
if voucher.nil?
@order.errors.add(:voucher_code, I18n.t('split_checkout.errors.voucher_not_found'))
@order.errors.add(:voucher_code, I18n.t('checkout.errors.voucher_not_found'))
return false
end
adjustment = voucher.create_adjustment(voucher.code, @order)
unless adjustment.persisted?
@order.errors.add(:voucher_code, I18n.t('split_checkout.errors.add_voucher_error'))
@order.errors.add(:voucher_code, I18n.t('checkout.errors.add_voucher_error'))
adjustment.errors.each { |error| @order.errors.import(error) }
return false
end

View File

@@ -174,7 +174,7 @@ module Spree
return unless checkout_processing
return if payments.any?
errors.add :payment_method, I18n.t('split_checkout.errors.select_a_payment_method')
errors.add :payment_method, I18n.t('checkout.errors.select_a_payment_method')
throw :halt
end
end

View File

@@ -22,21 +22,21 @@ module Checkout
def validate_details
return true if params[:shipping_method_id].present?
order.errors.add :shipping_method, I18n.t('split_checkout.errors.select_a_shipping_method')
order.errors.add :shipping_method, I18n.t('checkout.errors.select_a_shipping_method')
end
def validate_payment
return true if params.dig(:order, :payments_attributes, 0, :payment_method_id).present?
return true if order.zero_priced_order?
order.errors.add :payment_method, I18n.t('split_checkout.errors.select_a_payment_method')
order.errors.add :payment_method, I18n.t('checkout.errors.select_a_payment_method')
end
def validate_summary
return true if params[:accept_terms]
return true unless TermsOfService.required?(order.distributor)
order.errors.add(:terms_and_conditions, I18n.t("split_checkout.errors.terms_not_accepted"))
order.errors.add(:terms_and_conditions, I18n.t("checkout.errors.terms_not_accepted"))
end
end
end

View File

@@ -1,3 +1,3 @@
.already-ordered
.panel
= t("split_checkout.already_ordered.message_html", cart: link_to(t('split_checkout.already_ordered.cart'), "#{main_app.cart_path}#bought-products"))
= t("checkout.already_ordered.message_html", cart: link_to(t('checkout.already_ordered.cart'), "#{main_app.cart_path}#bought-products"))

View File

@@ -4,52 +4,52 @@
%div.checkout-substep
-# YOUR DETAILS
%div.checkout-title
= t("split_checkout.step1.contact_information.title")
= t("checkout.step1.contact_information.title")
.two-columns-inputs
%div.checkout-input.with-floating-label{ "data-controller": "floating-label" }
= f.label :email, t("split_checkout.step1.contact_information.email.label")
= f.label :email, t("checkout.step1.contact_information.email.label")
= f.text_field :email, { placeholder: " " }
= f.error_message_on :email
%div.checkout-input.with-floating-label{ "data-controller": "floating-label" }
= bill_address.label :phone, t("split_checkout.step1.contact_information.phone.label")
= bill_address.label :phone, t("checkout.step1.contact_information.phone.label")
= bill_address.text_field :phone, { placeholder: " " }
= f.error_message_on "bill_address.phone"
%div.checkout-substep
-# BILLING ADDRESS
%div.checkout-title
= t("split_checkout.step1.billing_address.title")
= t("checkout.step1.billing_address.title")
.two-columns-inputs
%div.checkout-input.with-floating-label{ "data-controller": "floating-label" }
= bill_address.label :firstname, t("split_checkout.step1.billing_address.first_name.label")
= bill_address.label :firstname, t("checkout.step1.billing_address.first_name.label")
= bill_address.text_field :firstname, { placeholder: " " }
= f.error_message_on "bill_address.firstname"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label" }
= bill_address.label :lastname, t("split_checkout.step1.billing_address.last_name.label")
= bill_address.label :lastname, t("checkout.step1.billing_address.last_name.label")
= bill_address.text_field :lastname, { placeholder: " " }
= f.error_message_on "bill_address.lastname"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= bill_address.label :address1, t("split_checkout.step1.address.address1.label")
= bill_address.label :address1, t("checkout.step1.address.address1.label")
= bill_address.text_field :address1, { placeholder: " " }
= f.error_message_on "bill_address.address1"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= bill_address.label :address2, t("split_checkout.step1.address.address2.label")
= bill_address.label :address2, t("checkout.step1.address.address2.label")
= bill_address.text_field :address2, { placeholder: " " }
= f.error_message_on "bill_address.address2"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= bill_address.label :city, t("split_checkout.step1.address.city.label")
= bill_address.label :city, t("checkout.step1.address.city.label")
= bill_address.text_field :city, { placeholder: " " }
= f.error_message_on "bill_address.city"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= bill_address.label :zipcode, t("split_checkout.step1.address.zipcode.label")
= bill_address.label :zipcode, t("checkout.step1.address.zipcode.label")
= bill_address.text_field :zipcode, { placeholder: " " }
= f.error_message_on "bill_address.zipcode"
@@ -57,11 +57,11 @@
- bill_address_country = @order.bill_address.country || DefaultCountry.country
%div.checkout-input
= bill_address.label :country_id, t("split_checkout.step1.address.country_id.label")
= bill_address.label :country_id, t("checkout.step1.address.country_id.label")
= bill_address.select :country_id, countries, { selected: bill_address_country.id }, { "data-dependent-select-target": "source", "data-action": "dependent-select#handleSelectChange" }
%div.checkout-input
= bill_address.label :state_id, t("split_checkout.step1.address.state_id.label")
= bill_address.label :state_id, t("checkout.step1.address.state_id.label")
= bill_address.select :state_id, states_for_country(bill_address_country), { selected: @order.bill_address&.state_id }, { "data-dependent-select-target": "select" }
- if spree_current_user
@@ -72,7 +72,7 @@
%div.checkout-substep{ "data-controller": "toggle shippingmethod" }
- selected_shipping_method = @order.shipping_method&.id || params[:shipping_method_id]
%div.checkout-title
= t("split_checkout.step1.shipping_info.title")
= t("checkout.step1.shipping_info.title")
- display_ship_address = false
- ship_method_description = nil
@@ -111,22 +111,22 @@
%div{"data-shippingmethod-target": "shippingMethodAddress", style: "display: #{!display_ship_address || shipping_and_billing_match?(@order) ? 'none' : 'block'}" }
= f.fields :ship_address, model: @order.ship_address do |ship_address|
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= ship_address.label :address1, t("split_checkout.step1.address.address1.label")
= ship_address.label :address1, t("checkout.step1.address.address1.label")
= ship_address.text_field :address1, { placeholder: " " }
= f.error_message_on "ship_address.address1"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= ship_address.label :address2, t("split_checkout.step1.address.address2.label")
= ship_address.label :address2, t("checkout.step1.address.address2.label")
= ship_address.text_field :address2, { placeholder: " " }
= f.error_message_on "ship_address.address2"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= ship_address.label :city, t("split_checkout.step1.address.city.label")
= ship_address.label :city, t("checkout.step1.address.city.label")
= ship_address.text_field :city, { placeholder: " " }
= f.error_message_on "ship_address.city"
%div.checkout-input.with-floating-label{ "data-controller": "floating-label"}
= ship_address.label :zipcode, t("split_checkout.step1.address.zipcode.label")
= ship_address.label :zipcode, t("checkout.step1.address.zipcode.label")
= ship_address.text_field :zipcode, { placeholder: " " }
= f.error_message_on "ship_address.zipcode"
@@ -134,11 +134,11 @@
- ship_address_country = @order.ship_address.country || DefaultCountry.country
%div.checkout-input
= ship_address.label :country_id, t("split_checkout.step1.address.country_id.label")
= ship_address.label :country_id, t("checkout.step1.address.country_id.label")
= ship_address.select :country_id, countries, { selected: ship_address_country.id }, { "data-dependent-select-target": "source", "data-action": "dependent-select#handleSelectChange" }
%div.checkout-input
= ship_address.label :state_id, t("split_checkout.step1.address.state_id.label")
= ship_address.label :state_id, t("checkout.step1.address.state_id.label")
= ship_address.select :state_id, states_for_country(ship_address_country), { selected: @order.ship_address&.state_id }, { "data-dependent-select-target": "select" }
- if spree_current_user
@@ -151,6 +151,6 @@
= f.text_area :special_instructions, size: "60x4"
%div.checkout-submit
= f.submit t("split_checkout.step1.submit"), class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false
= f.submit t("checkout.step1.submit"), class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false
%a.button.cancel{href: main_app.cart_path}
= t("split_checkout.step1.cancel")
= t("checkout.step1.cancel")

View File

@@ -6,7 +6,7 @@
= form_with url: checkout_update_path(local_assigns[:step] || checkout_step), model: @order, method: :put, data: { remote: "true" } do |f|
%div.checkout-substep{"data-controller": "paymentmethod"}
%div.checkout-title
= t("split_checkout.step2.payment_method.title")
= t("checkout.step2.payment_method.title")
- if @order.zero_priced_order?
%h3= t(:no_payment_required)
@@ -36,9 +36,9 @@
= f.error_message_on :payment_method, standalone: true
%div.checkout-substep
= t("split_checkout.step2.explaination")
= t("checkout.step2.explaination")
%div.checkout-submit
= f.submit t("split_checkout.step2.submit"), class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false
= f.submit t("checkout.step2.submit"), class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false
%a.button.cancel{href: main_app.checkout_step_path(:details)}
= t("split_checkout.step2.cancel")
= t("checkout.step2.cancel")

View File

@@ -3,9 +3,9 @@
= render partial: "checkout/already_ordered" if show_bought_items? && checkout_step?(:summary)
.checkout-substep
.checkout-title
= t("split_checkout.step3.delivery_details.title")
= t("checkout.step3.delivery_details.title")
%a.summary-edit{href: main_app.checkout_step_path(:details)}
= t("split_checkout.step3.delivery_details.edit")
= t("checkout.step3.delivery_details.edit")
.summary-subtitle
= @order.shipping_method.name
@@ -13,7 +13,7 @@
.two-columns
%div
.summary-subtitle
= t("split_checkout.step3.delivery_details.address")
= t("checkout.step3.delivery_details.address")
%span
= @order.ship_address.firstname
= @order.ship_address.lastname
@@ -42,7 +42,7 @@
- if @order.shipping_method.description.present?
%div
.summary-subtitle
= t("split_checkout.step3.delivery_details.instructions")
= t("checkout.step3.delivery_details.instructions")
%div
= @order.shipping_method.description
@@ -50,9 +50,9 @@
.checkout-substep
.checkout-title
= t("split_checkout.step3.payment_method.title")
= t("checkout.step3.payment_method.title")
%a.summary-edit{href: main_app.checkout_step_path(:payment)}
= t("split_checkout.step3.payment_method.edit")
= t("checkout.step3.payment_method.edit")
.two-columns
- payment_method = last_payment_method(@order)
%div
@@ -66,16 +66,16 @@
- if payment_method&.description.present?
%div
.summary-subtitle
= t("split_checkout.step3.payment_method.instructions")
= t("checkout.step3.payment_method.instructions")
%div
= payment_method&.description
%div.checkout-substep
%div.checkout-title
= t("split_checkout.step3.order.title")
= t("checkout.step3.order.title")
%a.summary-edit{href: main_app.cart_path}
= t("split_checkout.step3.order.edit")
= t("checkout.step3.order.edit")
= render 'spree/orders/summary', order: @order, display_footer: false
@@ -108,4 +108,4 @@
.checkout-submit
- if any_terms_required?(@order.distributor)
= render partial: "terms_and_conditions", locals: { f: f }
= f.submit t("split_checkout.step3.submit"), name: "confirm_order", class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false
= f.submit t("checkout.step3.submit"), name: "confirm_order", class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false

View File

@@ -1,21 +1,21 @@
%div.flex
%div.columns.three.text-center.checkout-tab{"class": [("selected" if checkout_step?(:details)), ("success" unless checkout_step?(:details))]}
%div
%div
%span.checkout-tab-number
1 -
1 -
%span.checkout-tab-label
= link_to_unless checkout_step?(:details), t("split_checkout.your_details_without_number"), main_app.checkout_step_path(:details) do
= t("split_checkout.your_details_without_number")
= link_to_unless checkout_step?(:details), t("checkout.your_details_without_number"), main_app.checkout_step_path(:details) do
= t("checkout.your_details_without_number")
%div.columns.three.text-center.checkout-tab{"class": [("selected" if checkout_step?(:payment)), ("success" if checkout_step?(:summary))]}
%div
%span.checkout-tab-number
2 -
2 -
%span.checkout-tab-label
= link_to_if checkout_step?(:summary), t("split_checkout.payment_method_without_number"), main_app.checkout_step_path(:payment) do
= t("split_checkout.payment_method_without_number")
= link_to_if checkout_step?(:summary), t("checkout.payment_method_without_number"), main_app.checkout_step_path(:payment) do
= t("checkout.payment_method_without_number")
%div.columns.three.text-center.checkout-tab{"class": ("selected" if checkout_step?(:summary))}
%div
%span.checkout-tab-number
3 -
3 -
%span.checkout-tab-label
= t("split_checkout.order_summary_without_number")
= t("checkout.order_summary_without_number")

View File

@@ -3,14 +3,14 @@
- if platform_terms_required? && distributor_terms_required?
= f.check_box :accept_terms, { name: "accept_terms", checked: all_terms_and_conditions_already_accepted? }, 1, nil
= f.label :accept_terms do
= t('split_checkout.step3.all_terms_and_conditions.message_html', terms_and_conditions_link: link_to( t("split_checkout.step3.terms_and_conditions.link_text"), @order.distributor.terms_and_conditions, target: '_blank'), tos_link: link_to_platform_terms)
= t('checkout.step3.all_terms_and_conditions.message_html', terms_and_conditions_link: link_to( t("checkout.step3.terms_and_conditions.link_text"), @order.distributor.terms_and_conditions, target: '_blank'), tos_link: link_to_platform_terms)
- elsif platform_terms_required?
= f.check_box :accept_terms, { name: "accept_terms", checked: platform_tos_already_accepted? }, 1, nil
= f.label :accept_terms do
= t('split_checkout.step3.platform_terms_of_service.message_html', tos_link: link_to_platform_terms)
= t('checkout.step3.platform_terms_of_service.message_html', tos_link: link_to_platform_terms)
- elsif distributor_terms_required?
= f.check_box :accept_terms, { name: "accept_terms", checked: terms_and_conditions_already_accepted? }, 1, nil
= f.label :accept_terms do
= t('split_checkout.step3.terms_and_conditions.message_html', terms_and_conditions_link: link_to( t("split_checkout.step3.terms_and_conditions.link_text"), @order.distributor.terms_and_conditions, target: '_blank'))
= t('checkout.step3.terms_and_conditions.message_html', terms_and_conditions_link: link_to( t("checkout.step3.terms_and_conditions.link_text"), @order.distributor.terms_and_conditions, target: '_blank'))
= f.error_message_on :terms_and_conditions, standalone: true

View File

@@ -1,25 +1,25 @@
%div#voucher-section
.checkout-title
= t("split_checkout.step2.voucher.apply_voucher")
= t("checkout.step2.voucher.apply_voucher")
.checkout-input{"data-controller": "toggle-button-disabled"}
= form_with url: voucher_adjustments_path, model: @order, method: :post, data: { remote: true } do |form|
- if voucher_adjustment.present?
.two-columns-inputs.voucher
%span.button.voucher-added
%i.ofn-i_051-check-big
= t("split_checkout.step2.voucher.voucher", voucher_amount: voucher_adjustment.originator.display_value)
= link_to t("split_checkout.step2.voucher.remove_code"), voucher_adjustment_path(id: voucher_adjustment.id), method: "delete", data: { confirm: t("split_checkout.step2.voucher.confirm_delete") }
= t("checkout.step2.voucher.voucher", voucher_amount: voucher_adjustment.originator.display_value)
= link_to t("checkout.step2.voucher.remove_code"), voucher_adjustment_path(id: voucher_adjustment.id), method: "delete", data: { confirm: t("checkout.step2.voucher.confirm_delete") }
- # This might not be true, ie payment method including a fee which wouldn't be covered by voucher or tax implication raising total to be bigger than the voucher amount ?
- if voucher_adjustment.originator.amount > order.pre_discount_total && voucher_adjustment.originator.is_a?(Vouchers::FlatRate)
.checkout-input
%span.formError.standalone
= t("split_checkout.step2.voucher.warning_forfeit_remaining_amount")
= t("checkout.step2.voucher.warning_forfeit_remaining_amount")
- else
.two-columns-inputs
%div.checkout-input
= form.text_field :voucher_code, value: params.dig(:order, :voucher_code), data: { action: "input->toggle-button-disabled#inputIsChanged" }, placeholder: t("split_checkout.step2.voucher.placeholder"), class: "voucher"
= form.text_field :voucher_code, value: params.dig(:order, :voucher_code), data: { action: "input->toggle-button-disabled#inputIsChanged" }, placeholder: t("checkout.step2.voucher.placeholder"), class: "voucher"
= form.error_message_on :voucher_code
%div.checkout-input
= form.submit t("split_checkout.step2.voucher.apply"), disabled: true, class: "button cancel voucher-button", "data-disable-with": false, data: { "toggle-button-disabled-target": "button" }
= form.submit t("checkout.step2.voucher.apply"), disabled: true, class: "button cancel voucher-button", "data-disable-with": false, data: { "toggle-button-disabled-target": "button" }

View File

@@ -1,27 +1,27 @@
= f.fields :bill_address, model: @order.bill_address do |bill_address|
%div.checkout-input
= bill_address.label :firstname, t("split_checkout.step1.your_details.first_name.label")
= bill_address.text_field :firstname, { placeholder: t("split_checkout.step1.your_details.first_name.placeholder") }
= f.error_message_on "bill_address.firstname"
= bill_address.label :firstname, t("checkout.step1.your_details.first_name.label")
= bill_address.text_field :firstname, { placeholder: t("checkout.step1.your_details.first_name.placeholder") }
= f.error_message_on "bill_address.firstname"
%div.checkout-input
= bill_address.label :lastname, t("split_checkout.step1.your_details.last_name.label")
= bill_address.text_field :lastname, { placeholder: t("split_checkout.step1.your_details.last_name.placeholder") }
= bill_address.label :lastname, t("checkout.step1.your_details.last_name.label")
= bill_address.text_field :lastname, { placeholder: t("checkout.step1.your_details.last_name.placeholder") }
= f.error_message_on "bill_address.lastname"
.flex{style: "justify-content: space-between; gap: 10px;" }
%div.checkout-input{style: "flex-grow: 2;" }
= f.label :card_number, t("split_checkout.step2.form.card_number.label")
= f.text_field :card_number, { placeholder: t("split_checkout.step2.form.card_number.placeholder") }
= f.label :card_number, t("checkout.step2.form.card_number.label")
= f.text_field :card_number, { placeholder: t("checkout.step2.form.card_number.placeholder") }
%div.checkout-input{style: "flex: 0 1 100px;"}
= f.label :card_verification_value, t("split_checkout.step2.form.card_verification_value.label")
= f.number_field :card_verification_value, { placeholder: t("split_checkout.step2.form.card_verification_value.placeholder") }
= f.label :card_verification_value, t("checkout.step2.form.card_verification_value.label")
= f.number_field :card_verification_value, { placeholder: t("checkout.step2.form.card_verification_value.placeholder") }
%div.checkout-input{style: "flex: 0 1 70px;"}
= f.label :card_month, t("split_checkout.step2.form.card_month.label")
= f.number_field :card_month, { placeholder: t("split_checkout.step2.form.card_month.placeholder"), max: 12 }
= f.label :card_month, t("checkout.step2.form.card_month.label")
= f.number_field :card_month, { placeholder: t("checkout.step2.form.card_month.placeholder"), max: 12 }
%div.checkout-input{style: "flex: 0 1 70px;"}
= f.label :card_year, t("split_checkout.step2.form.card_year.label")
= f.number_field :card_year, { placeholder: t("split_checkout.step2.form.card_year.placeholder"), min: Time.now.year, max: Time.now.year + 10 }
= f.label :card_year, t("checkout.step2.form.card_year.label")
= f.number_field :card_year, { placeholder: t("checkout.step2.form.card_year.placeholder"), min: Time.now.year, max: Time.now.year + 10 }

View File

@@ -4,16 +4,16 @@
- if saved_credit_cards.any?
.checkout-input
%label
= t('split_checkout.step2.form.stripe.use_saved_card')
= t('checkout.step2.form.stripe.use_saved_card')
= select_tag :existing_card_id,
options_for_select(stripe_card_options(saved_credit_cards) + [[t('split_checkout.step2.form.stripe.create_new_card'), ""]], nil),
options_for_select(stripe_card_options(saved_credit_cards) + [[t('checkout.step2.form.stripe.create_new_card'), ""]], nil),
{ "data-action": "change->stripe-cards#onSelectCard", "data-stripe-cards-target": "select" }
%div{"data-stripe-cards-target": "stripeelements"}
.checkout-input
- if saved_credit_cards.none?
%label
= t('split_checkout.step2.form.stripe.use_new_card')
= t('checkout.step2.form.stripe.use_new_card')
%div{ "data-controller": "stripe", "data-stripe-key": "#{Stripe.publishable_key}" }
.stripe-card
@@ -25,11 +25,11 @@
= hidden_field_tag "order[payments_attributes][][source_attributes][last_digits]", nil, { "data-stripe-target": "last4" }
= hidden_field_tag "order[payments_attributes][][source_attributes][gateway_payment_profile_id]", nil, { "data-stripe-target": "pmId" }
%div.card-element{ "data-stripe-target": "cardElement" }
%div.error.card-errors{ "data-stripe-target": "cardErrors" }
- if spree_current_user
.checkout-input
= check_box_tag "order[payments_attributes][][source_attributes][save_requested_by_customer]", 1, false
= label_tag :order_payments_attributes__source_attributes_save_requested_by_customer, t('split_checkout.step2.form.stripe.save_card')
= label_tag :order_payments_attributes__source_attributes_save_requested_by_customer, t('checkout.step2.form.stripe.save_card')