Skip to content

Commit

Permalink
set comma everywhere, fix localize close message
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegPhenomenon committed Jul 2, 2024
1 parent 285cb82 commit 318b488
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
4 changes: 1 addition & 3 deletions app/components/application_view_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ def main_app
end

def price_format(price)
separator = I18n.locale == :en ? '.' : ','

"#{number_to_currency(price, unit: '', separator:, delimiter: '', precision: 2)} €"
"#{number_to_currency(price, unit: '', separator: ',', delimiter: '', precision: 2)} €"
end
end
1 change: 0 additions & 1 deletion app/components/modals/change_offer/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def offer_form_properties
autotax_counter_template_value: t('english_offers.price_with_wat_template'),
autotax_counter_tax_value: "#{offer.billing_profile.present? ? offer.billing_profile.vat_rate : 0.0}",
autotax_counter_defaulttemplate_value: t('offers.price_is_without_vat'),
autotax_counter_separator_value: I18n.locale == :en ? '.' : ',',
}
}
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/modals/deposit/component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="c-modal__main__info c-modal__main__info--white c-modal__header__desc">
<div class="c-modal__main__info__wrapper u-flex u-align-start u-content-sp u-flex-col">
<span class="u-mb-60"><strong><%= t('offers.new.deposit_description_html', deposit: price_format(@auction.deposit)) %></strong></span>
<button class="c-btn c-btn--ghost c-btn--fs" data-action='modals--offer-modal#close'>Tagasi</button>
<button class="c-btn c-btn--ghost c-btn--fs" data-action='modals--offer-modal#close'><%= t('close') %></button>
</div>
</div>
<div class="c-modal__main__info c-modal__main__info--orange u-align-center u-content-center u-flex-col">
Expand Down
7 changes: 1 addition & 6 deletions app/javascript/controllers/autotax_counter_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default class extends Controller {
template: String,
defaulttemplate: String,
priceElement: { default: 'input[name="offer[price]"]', type: String },
separator: { default: '.', type: String }
}

connect() {
Expand All @@ -24,11 +23,7 @@ export default class extends Controller {
const totalAmount = value + taxAmount;

let tem = this.templateValue.replace('{price}', totalAmount.toFixed(2)).replace('{tax}', (tax * 100.0).toFixed(2));

if (this.separatorValue !== '.') {
tem = tem.replace('.', ',').replace('.', ',');
}

tem = tem.replace('.', ',').replace('.', ',');
result.innerHTML = tem
} else {
result.innerHTML = this.defaulttemplateValue;
Expand Down

0 comments on commit 318b488

Please sign in to comment.