Add format helper for currency

This commit is contained in:
Patrick Gansterer 2018-09-16 12:05:39 +02:00
parent 5408c08b58
commit 6cc02cb563
7 changed files with 21 additions and 9 deletions

View file

@ -19,6 +19,11 @@ module ApplicationHelper
I18n.l(time, :format => format) unless (time.nil? || format.nil?)
end
def format_currency(amount)
class_name = amount < 0 ? 'negative_amout' : 'positive_amount'
content_tag :span, number_to_currency(amount), class: class_name
end
# Creates ajax-controlled-links for pagination
def pagination_links_remote(collection, options = {})
per_page = options[:per_page] || @per_page