From 2ed3f3d4c615e2e5f6c87eba0e8c91830b9dc0a7 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 28 Mar 2014 15:22:21 -0500 Subject: [PATCH] more abstraction --- app/helpers/outfits_helper.rb | 12 +++++------- app/views/outfits/edit.html.haml | 1 + app/views/outfits/show.html.haml | 3 ++- config/locales/en.yml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index 3933e357..0eeec250 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -126,13 +126,11 @@ module OutfitsHelper 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 + def prank_color_message(color_unfunny_human_name) + 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 diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index 833b29e8..378c31d9 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -48,6 +48,7 @@ #save-success= t '.sidebar.notifications.outfits.save.success' #save-error #preview-closet.sidebar-view + = prank_color_message('%{color}') %ul #preview-outfits.sidebar-view %ul#preview-outfits-list diff --git a/app/views/outfits/show.html.haml b/app/views/outfits/show.html.haml index ce1ee42c..9e73f26a 100644 --- a/app/views/outfits/show.html.haml +++ b/app/views/outfits/show.html.haml @@ -16,7 +16,8 @@ #outfit-user = outfit_creation_summary(@outfit) -= prank_color_message(@outfit.color) +- if @outfit.color.prank? + = prank_color_message(@outfit.color.unfunny_human_name) #preview-wrapper #preview-swf diff --git a/config/locales/en.yml b/config/locales/en.yml index 67323b65..8279bc01 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -228,7 +228,7 @@ en: thing. C'mon, would I lie to you? On today of all days? unfunny_html: This pet is painted %{color}, a fake color added to the site for April Fools 2014. Anyone who claims to have a real - Nebula pet is a big fat liar. + %{color} pet is a big fat liar. contributions: contributed_description: