From b953e572a377791bce89375bb138a9d3bd848cb8 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 26 Sep 2015 13:17:36 -0700 Subject: [PATCH] hide desc on complete campaign; add toggle link --- app/assets/javascripts/static/donate.js | 11 +++++++++++ app/assets/stylesheets/campaigns/_show.sass | 13 +++++++++++++ app/views/campaigns/show.html.haml | 9 ++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/static/donate.js b/app/assets/javascripts/static/donate.js index 8f4e919c..0a180b39 100644 --- a/app/assets/javascripts/static/donate.js +++ b/app/assets/javascripts/static/donate.js @@ -33,4 +33,15 @@ } } }); + + var toggle = document.getElementById('success-thanks-toggle-description'); + toggle.addEventListener('click', function() { + var desc = document.getElementById('description'); + var attr = 'data-show'; + if (desc.hasAttribute(attr)) { + desc.removeAttribute(attr); + } else { + desc.setAttribute(attr, true); + } + }); })(); diff --git a/app/assets/stylesheets/campaigns/_show.sass b/app/assets/stylesheets/campaigns/_show.sass index a1fae484..ee2f5889 100644 --- a/app/assets/stylesheets/campaigns/_show.sass +++ b/app/assets/stylesheets/campaigns/_show.sass @@ -79,14 +79,27 @@ body.campaigns-show, body.campaigns-current button +loud-awesome-button-color + #campaign-text[data-campaign-complete] + #description + display: none + &[data-show] + display: block + #success-thanks border: 1px dashed $module-border-color margin-bottom: 1em padding: 1em + position: relative p:last-child margin-bottom: 0 + #success-thanks-toggle-description + position: absolute + bottom: 1em + font-style: italic + right: 1em + #outfits +outfits-list text-align: center diff --git a/app/views/campaigns/show.html.haml b/app/views/campaigns/show.html.haml index 96b4181e..caf27538 100644 --- a/app/views/campaigns/show.html.haml +++ b/app/views/campaigns/show.html.haml @@ -26,9 +26,12 @@ = text_field_tag 'donation[amount]', '10.00' %button{:type => 'submit'} Donate now! -- if @campaign.complete? && @campaign.thanks? - #success-thanks= emote_md @campaign.thanks -#description= emote_md @campaign.description +#campaign-text{'data-campaign-complete' => @campaign.complete?} + - if @campaign.complete? && @campaign.thanks? + #success-thanks + #success-thanks-main= emote_md @campaign.thanks + %a#success-thanks-toggle-description{href: '#'} How are donations used? + #description= emote_md @campaign.description - if @donations.present? %h2 Thanks to our lovely donors!