Makup
Decorator helper and makup for Draper decorator.
Instalation
Add this line to your application's Gemfile:
gem 'makup'
And then execute:
$ bundle
Usage
Create your decorator as a regular draper decorator. When you try to output a date you will have an internacionalized date.
decorator.created_at # => "Fri, 27 Dec 2013 20:29:51 -02:00"
Overriding/Adding global behavior
Overriding
# app/helpers/some_helper.rb
module SomeHelper
def decorate_Time(value)
I18n.l(value, format: :short)
end
end
decorator.created_at # 27 Dec 20:29
Creating new makups
# app/helpers/some_helper.rb
module SomeHelper
def decorate_Money(value)
helper.number_to_currency(value)
end
end
decorator.price # => "$ 5.00"
Authors
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) Do not forget to write tests - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request