Le Funny Emoji Meme Face x--DD
This commit is contained in:
parent
c2811e65ce
commit
5118ba9761
|
@ -19,9 +19,10 @@ coverage/
|
||||||
|
|
||||||
/public/assets
|
/public/assets
|
||||||
/public/system
|
/public/system
|
||||||
|
/public/images/emoji
|
||||||
|
|
||||||
# damn vim backup files
|
# damn vim backup files
|
||||||
*~
|
*~
|
||||||
|
|
||||||
# every fucking time, dolphin
|
# every fucking time, dolphin
|
||||||
.directory
|
.directory
|
||||||
|
|
4
Gemfile
4
Gemfile
|
@ -34,6 +34,10 @@ gem 'rails-assets-growl'
|
||||||
gem "paperclip", "~> 4.2"
|
gem "paperclip", "~> 4.2"
|
||||||
gem 'delayed_paperclip'
|
gem 'delayed_paperclip'
|
||||||
|
|
||||||
|
# x--DD
|
||||||
|
gem 'gemoji'
|
||||||
|
gem 'rumoji'
|
||||||
|
|
||||||
gem 'ruby-progressbar'
|
gem 'ruby-progressbar'
|
||||||
|
|
||||||
gem 'rails_admin'
|
gem 'rails_admin'
|
||||||
|
|
|
@ -118,6 +118,7 @@ GEM
|
||||||
foreman (0.76.0)
|
foreman (0.76.0)
|
||||||
dotenv (~> 1.0.2)
|
dotenv (~> 1.0.2)
|
||||||
thor (~> 0.19.1)
|
thor (~> 0.19.1)
|
||||||
|
gemoji (2.1.0)
|
||||||
haml (4.0.6)
|
haml (4.0.6)
|
||||||
tilt
|
tilt
|
||||||
hashie (3.3.2)
|
hashie (3.3.2)
|
||||||
|
@ -254,6 +255,7 @@ GEM
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.0.0)
|
||||||
rspec-support (3.0.4)
|
rspec-support (3.0.4)
|
||||||
ruby-progressbar (1.7.0)
|
ruby-progressbar (1.7.0)
|
||||||
|
rumoji (0.4.0)
|
||||||
safe_yaml (1.0.4)
|
safe_yaml (1.0.4)
|
||||||
sanitize (3.1.0)
|
sanitize (3.1.0)
|
||||||
crass (~> 1.0.1)
|
crass (~> 1.0.1)
|
||||||
|
@ -362,6 +364,7 @@ DEPENDENCIES
|
||||||
font-awesome-rails (~> 4.2.0.0)
|
font-awesome-rails (~> 4.2.0.0)
|
||||||
font-kit-rails
|
font-kit-rails
|
||||||
foreman
|
foreman
|
||||||
|
gemoji
|
||||||
haml
|
haml
|
||||||
http_accept_language
|
http_accept_language
|
||||||
jbuilder (~> 2.2.4)
|
jbuilder (~> 2.2.4)
|
||||||
|
@ -382,6 +385,7 @@ DEPENDENCIES
|
||||||
redis
|
redis
|
||||||
rspec-rails (~> 3.0.0)
|
rspec-rails (~> 3.0.0)
|
||||||
ruby-progressbar
|
ruby-progressbar
|
||||||
|
rumoji
|
||||||
sanitize
|
sanitize
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.1)
|
sdoc (~> 0.4.1)
|
||||||
|
|
1
Rakefile
1
Rakefile
|
@ -2,6 +2,7 @@
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
require File.expand_path('../config/application', __FILE__)
|
require File.expand_path('../config/application', __FILE__)
|
||||||
|
load 'tasks/emoji.rake'
|
||||||
|
|
||||||
Rails.application.load_tasks
|
Rails.application.load_tasks
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
module EmojiHelper
|
||||||
|
|
||||||
|
def emojify(content, size = 20)
|
||||||
|
Rumoji::encode(h(content).to_str).gsub(/:([\w+-]+):/) do |match|
|
||||||
|
if emoji = Emoji.find_by_alias($1)
|
||||||
|
%(<img alt="#$1" src="/images/emoji/#{emoji.image_filename}" style="vertical-align:middle" width="#{size}" height="#{size}" />)
|
||||||
|
else
|
||||||
|
match
|
||||||
|
end
|
||||||
|
end.html_safe if content.present?
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,7 @@
|
||||||
module MarkdownHelper
|
module MarkdownHelper
|
||||||
|
|
||||||
|
include EmojiHelper
|
||||||
|
|
||||||
def markdown(content)
|
def markdown(content)
|
||||||
md = Redcarpet::Markdown.new(FlavoredMarkdown,
|
md = Redcarpet::Markdown.new(FlavoredMarkdown,
|
||||||
filter_html: true,
|
filter_html: true,
|
||||||
|
@ -16,6 +18,6 @@ module MarkdownHelper
|
||||||
disable_indented_code_blocks: true,
|
disable_indented_code_blocks: true,
|
||||||
strikethrough: true,
|
strikethrough: true,
|
||||||
superscript: false)
|
superscript: false)
|
||||||
Sanitize.fragment(md.render(content), EVIL_TAGS).html_safe
|
emojify Sanitize.fragment(md.render(content), EVIL_TAGS).html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -15,7 +15,7 @@
|
||||||
·
|
·
|
||||||
%a{href: show_user_question_path(i.question.user.screen_name, i.question.id)}
|
%a{href: show_user_question_path(i.question.user.screen_name, i.question.id)}
|
||||||
#{i.question.answer_count} response(s)
|
#{i.question.answer_count} response(s)
|
||||||
%p.answerbox--question-text= i.question.content
|
%p.answerbox--question-text= emojify i.question.content, 16
|
||||||
.panel-body
|
.panel-body
|
||||||
%textarea.form-control{name: 'ib-answer', placeholder: 'Write your answer here...', data: { id: i.id }}
|
%textarea.form-control{name: 'ib-answer', placeholder: 'Write your answer here...', data: { id: i.id }}
|
||||||
%br/
|
%br/
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
%a{href: show_user_question_path(a.question.user.screen_name, a.question.id)}
|
%a{href: show_user_question_path(a.question.user.screen_name, a.question.id)}
|
||||||
#{a.question.answer_count} answers
|
#{a.question.answer_count} answers
|
||||||
%p.answerbox--question-text
|
%p.answerbox--question-text
|
||||||
= a.question.content
|
= emojify a.question.content, 16
|
||||||
.panel-body
|
.panel-body
|
||||||
- if @display_all.nil?
|
- if @display_all.nil?
|
||||||
= markdown a.content[0..255]
|
= markdown a.content[0..255]
|
||||||
|
|
Loading…
Reference in New Issue