-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor loading of theme Pro Price helper
Prepending module to the Pro Price helper was causing issues in CI only. We don't actually have to do this as helper modules are all included into the same context via ActionView::Base.
- Loading branch information
Showing
3 changed files
with
24 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
lib/helpers/alaveteli_pro/alternative_price_text_helper.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module AlaveteliPro::AlternativePriceTextHelper | ||
def alternative_price_text(price) | ||
amount = format_currency( | ||
price.unit_amount_with_tax, no_cents_if_whole: true | ||
) | ||
|
||
if interval(price) == 'day' && interval_count(price) == 1 | ||
_('or {{amount}} daily', amount: amount) | ||
elsif interval(price) == 'week' && interval_count(price) == 1 | ||
_('or {{amount}} weekly', amount: amount) | ||
elsif interval(price) == 'month' && interval_count(price) == 1 | ||
_('or {{amount}} monthly', amount: amount) | ||
elsif interval(price) == 'year' && interval_count(price) == 1 | ||
_('or {{amount}} annually', amount: amount) | ||
else | ||
_('or {{amount}} every {{interval}}', | ||
amount: amount, | ||
interval: pluralize_interval(price)) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters