more abstraction

This commit is contained in:
Emi Matchu 2014-03-28 15:22:21 -05:00
parent 8781d58540
commit 2ed3f3d4c6
4 changed files with 9 additions and 9 deletions

View file

@ -126,13 +126,11 @@ module OutfitsHelper
end end
end end
def prank_color_message(color) def prank_color_message(color_unfunny_human_name)
if color.prank?
content_key_base = Color.pranks_funny? ? 'funny' : 'unfunny' content_key_base = Color.pranks_funny? ? 'funny' : 'unfunny'
content = t("colors.prank_message.#{content_key_base}_html", content = t("colors.prank_message.#{content_key_base}_html",
color: color.unfunny_human_name) color: color_unfunny_human_name)
content_tag('p', content, id: 'prank-color-message', :class => 'warning') content_tag('p', content, id: 'prank-color-message', :class => 'warning')
end end
end
end end

View file

@ -48,6 +48,7 @@
#save-success= t '.sidebar.notifications.outfits.save.success' #save-success= t '.sidebar.notifications.outfits.save.success'
#save-error #save-error
#preview-closet.sidebar-view #preview-closet.sidebar-view
= prank_color_message('%{color}')
%ul %ul
#preview-outfits.sidebar-view #preview-outfits.sidebar-view
%ul#preview-outfits-list %ul#preview-outfits-list

View file

@ -16,7 +16,8 @@
#outfit-user #outfit-user
= outfit_creation_summary(@outfit) = outfit_creation_summary(@outfit)
= prank_color_message(@outfit.color) - if @outfit.color.prank?
= prank_color_message(@outfit.color.unfunny_human_name)
#preview-wrapper #preview-wrapper
#preview-swf #preview-swf

View file

@ -228,7 +228,7 @@ en:
thing. C'mon, would I lie to you? On today of all days? 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 unfunny_html: This pet is painted %{color}, a fake color added to the
site for April Fools 2014. Anyone who claims to have a <em>real</em> site for April Fools 2014. Anyone who claims to have a <em>real</em>
Nebula pet is a big fat liar. %{color} pet is a big fat liar.
contributions: contributions:
contributed_description: contributed_description: