emoji4rails
Emoji4rails brings Emoji support for you Rails apps.
Installing
Install gem:
gem install emoji4rails
or edit your Gemfile:
gem 'emoji4rails'
and run:
bundle install
Basics
You are going to use just one simple helper:
render_emoji ( text, = { :class => 'emoji' } )
- text – text with Emojis
- options – hash of HTML attributes
Such thing
render_emoji ( ':bear:', { :style => 'width:20px;' } )
will be rendered as:
<img src='/assets/emojis/bear.png' style='width:20px;' />
Usage
In Views
The helper is automatically included into ActionView::Base
so just call:
<%= raw render_emoji('Text, containing emojis :mouse:') %>
In Models, Controllers, etc
Include Emoji4Rails::Helpers
to your class:
require "emoji4rails/helpers"
class MyClass
include Emoji4Rails::Helpers
def render_page html_content
render_emoji html_content
end
end
Found a Bug? Having Troubles?
Please, let me know
Thanks To
These guys, I borrowed the images from this repo.
LISENCE
MIT License. Copyright 2012 Dmitry Filimonov.