extract prank_color_message to helper

This commit is contained in:
Emi Matchu 2014-03-28 15:19:45 -05:00
parent 32bab89ed4
commit 8781d58540
2 changed files with 10 additions and 6 deletions

View file

@ -125,5 +125,14 @@ module OutfitsHelper
haml_concat javascript_tag("var ModelingI18n = #{modeling_i18n.to_json};")
end
end
def prank_color_message(color)
if color.prank?
content_key_base = Color.pranks_funny? ? 'funny' : 'unfunny'
content = t("colors.prank_message.#{content_key_base}_html",
color: color.unfunny_human_name)
content_tag('p', content, id: 'prank-color-message', :class => 'warning')
end
end
end

View file

@ -16,12 +16,7 @@
#outfit-user
= outfit_creation_summary(@outfit)
- if @outfit.color.prank?
%p.warning#prank-color-message
- if Color.pranks_funny?
= t 'colors.prank_message.funny_html', color: @outfit.color.unfunny_human_name
- else
= t 'colors.prank_message.unfunny_html', color: @outfit.color.unfunny_human_name
= prank_color_message(@outfit.color)
#preview-wrapper
#preview-swf