From 8781d58540a235c21bbffd3fa9e6bcec23069c19 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 28 Mar 2014 15:19:45 -0500 Subject: [PATCH] extract prank_color_message to helper --- app/helpers/outfits_helper.rb | 9 +++++++++ app/views/outfits/show.html.haml | 7 +------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index e05cac76..3933e357 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -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 diff --git a/app/views/outfits/show.html.haml b/app/views/outfits/show.html.haml index fa5e6754..ce1ee42c 100644 --- a/app/views/outfits/show.html.haml +++ b/app/views/outfits/show.html.haml @@ -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