From cf2550c7bc6ea6eb9f44340123926e1a7518c7f5 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 13 Sep 2014 20:54:39 -0500 Subject: [PATCH] for large donations, show a banner instead of their placeholder outfits --- app/assets/stylesheets/static/_donate.sass | 20 +++++++++++++++++++- app/helpers/static_helper.rb | 7 +++++++ app/views/static/donate.html.haml | 18 ++++++++++++------ 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/static/_donate.sass b/app/assets/stylesheets/static/_donate.sass index 7f6cdf3b..0f6b01ef 100644 --- a/app/assets/stylesheets/static/_donate.sass +++ b/app/assets/stylesheets/static/_donate.sass @@ -57,6 +57,7 @@ body.static-donate #outfits +outfits-list + text-align: center > li +outfit @@ -68,13 +69,30 @@ body.static-donate header, footer font-size: 85% padding: $outfit-banner-v-padding $outfit-banner-h-padding - text-align: center width: $outfit-banner-inner-width img height: $outfit-inner-height width: $outfit-inner-width + &.banner + background-image: url(http://images.neopets.com/themes/004_bir_a2e60/footer_bg.png) + background-position: 0 -60px + border: 2px solid #006 + color: white + height: 100px + line-height: 100px + margin: 4px 0 + text-shadow: #335 2px 2px 1px + width: $container-width - 4px + + span + +inline-block + font-size: 32px + font-weight: bold + line-height: 1.5 + vertical-align: middle + #fine-print font-size: 85% margin-top: 2em diff --git a/app/helpers/static_helper.rb b/app/helpers/static_helper.rb index 8cfc9af4..fc37f273 100644 --- a/app/helpers/static_helper.rb +++ b/app/helpers/static_helper.rb @@ -1,2 +1,9 @@ module StaticHelper + def large_donation?(amount) + amount > 100_00 + end + + def outfit_image?(outfit) + outfit.present? && outfit.image? + end end diff --git a/app/views/static/donate.html.haml b/app/views/static/donate.html.haml index 16ab9db0..e351c179 100644 --- a/app/views/static/donate.html.haml +++ b/app/views/static/donate.html.haml @@ -65,14 +65,20 @@ %h2 Thanks to our lovely donors! %ul#outfits - @donations.each do |donation| + - if large_donation?(donation.amount) + %li.banner + %span + Thanks, #{donation.donor_name}, for donating + #{number_to_currency(donation.amount / 100.0)}! - donation.features.each do |feature| - %li - - if feature.outfit_id? && feature.outfit.image? - = link_to image_tag(feature.outfit.image.small.url), feature.outfit - - else - = image_tag 'default_preview.png' + - if outfit_image?(feature.outfit) || !large_donation?(donation.amount) + %li + - if outfit_image?(feature.outfit) + = link_to image_tag(feature.outfit.image.small.url), feature.outfit + - else + = image_tag 'default_preview.png' - %header Thanks, #{donation.donor_name.presence || 'Anonymous'}! + %header Thanks, #{donation.donor_name.presence || 'Anonymous'}! #fine-print %h2 Some notes on featured outfits