Show banner on p2p create page, too

This commit is contained in:
Kasia Jarmołkowicz 2018-05-30 21:58:41 +02:00 committed by Eric Schultz
parent 539d8f472a
commit aaddc721bf
5 changed files with 32 additions and 28 deletions

View file

@ -12,11 +12,11 @@ body {
background: $fog;
}
body > .ymca-banner {
body > .campaign-banner {
margin: auto;
width: 100vw;
height: 120px;
background-color: #01a490;
width: 980px;
max-height: 120px;
text-align: center;
}
main {

View file

@ -109,8 +109,8 @@ class CampaignsController < ApplicationController
def peer_to_peer
session[:donor_signup_url] = request.env["REQUEST_URI"]
@npo = Nonprofit.find_by_id(params[:npo_id])
@campaign = Campaign.find_by_id(params[:campaign_id])
@nonprofit = Nonprofit.find_by_id(params[:npo_id])
@parent_campaign = Campaign.find_by_id(params[:campaign_id])
@profile = current_user.profile if current_user
end

View file

@ -3,7 +3,7 @@
<div class='modal' id='newPeerToPeerCampaign'>
<%= render 'common/modal_header', title: @campaign.name %>
<%= render 'common/modal_header', title: @parent_campaign.name %>
<div class='wizard-steps' style='display:none;'>
<!--= wizard.init 'new_p2p_campaign_wiz' -->
@ -18,7 +18,7 @@
<form parsley-validate>
<!--= on 'submit' (def 'new_p2p_campaign' form_object) (wizard.advance 'new_p2p_campaign_wiz') -->
<input type='hidden' name='campaign[profile_id]' value='<%= current_user.profile.id %>'>
<input type='hidden' name='campaign[parent_campaign_id]' value='<%= @campaign.id %>'>
<input type='hidden' name='campaign[parent_campaign_id]' value='<%= @parent_campaign.id %>'>
<p>Personalize your campaign page with your name and photo to greatly increase the success of your campaign.</p>
<div class='layout--three'>
@ -63,10 +63,10 @@
<div class='u-margin--auto'>
<fieldset class='col-right-12'>
<label>What's your reason for supporting <%= @campaign.name %>?</label>
<label>What's your reason for supporting <%= @parent_campaign.name %>?</label>
<p>Your passion is contagious! Inspire giving by telling your network why youre getting involved in this campaign.</p>
<textarea class='u-marginTop--15' rows='4' name='campaign[reason_for_supporting]' required><%= @campaign.default_reason_for_supporting %></textarea>
<textarea class='u-marginTop--15' rows='4' name='campaign[reason_for_supporting]' required><%= @parent_campaign.default_reason_for_supporting %></textarea>
</fieldset>
<fieldset class='group u-marginBottom--0'>

View file

@ -10,27 +10,27 @@
<% content_for :javascripts do %>
<script>
<% if @npo %>
<% if @nonprofit %>
appl.def('selected_result', {
name: '<%= @npo.name.html_safe %>',
id: <%= @npo.id %>,
name: '<%= @nonprofit.name.html_safe %>',
id: <%= @nonprofit.id %>,
modal_id: 'newCampaign'
})
app.nonprofit_id = <%= @npo.id %>
<% elsif @campaign %>
app.nonprofit_id = <%= @nonprofit.id %>
<% elsif @parent_campaign %>
appl.def('selected_result', {
name: '<%= @campaign.nonprofit.name.html_safe %>',
parent_campaign_id: <%= @campaign.id %>,
campaign_name: '<%= @campaign.name %>',
name: '<%= @parent_campaign.nonprofit.name.html_safe %>',
parent_campaign_id: <%= @parent_campaign.id %>,
campaign_name: '<%= @parent_campaign.name %>',
modal_id: 'newPeerToPeerCampaign'
})
app.nonprofit_id = <%= @campaign.nonprofit.id %>
app.nonprofit_id = <%= @parent_campaign.nonprofit.id %>
<% end %>
<% if current_user %>
appl.def('is_logged_in', true)
appl.def('is_confirmed', <%= !current_user.confirmed_at.nil? %>)
appl.def('user', {
name: '<%= current_user.profile.name %>',
name: '<%= current_user.profile.name || current_user.email %>',
id: <%= current_user.id %>
})
<% end %>
@ -38,8 +38,11 @@
<%= IncludeAsset.js '/client/js/campaigns/peer_to_peer/page.js' %>
<% end %>
<div class='ymca-banner'></div>
<% if @parent_campaign.banner_image_url %>
<div class='campaign-banner u-margin'>
<img src='<%= @parent_campaign.banner_image_url %>'>
</div>
<% end %>
<main>
<header class='u-paddingX--15 container'>
@ -59,14 +62,14 @@
</tr></table>
<ul class='u-paddingLeft--10 timeline--checklist'>
<% if @campaign.present? %>
<% if @parent_campaign.present? %>
<li>
<!--= set_attr_if selected_result 'class' 'is-complete' -->
<span class='annot'>10 seconds</span>
<p class='strong u-marginBottom--15'>My campaign</p>
<div class='u-paddingLeft--20 u-maxWidth--500'>
<h4><%= @campaign.name %></h4>
<p>See our other <%= link_to 'active campaigns', @campaign.nonprofit.url %>.</p>
<h4><%= @parent_campaign.name %></h4>
<p>See our other <%= link_to 'active campaigns', @parent_campaign.nonprofit.url || @nonprofit.url %>.</p>
</div>
</li>
<% else %>
@ -141,9 +144,9 @@
</main>
<% if current_user %>
<% if @npo.present? %>
<% if @nonprofit.present? %>
<%= render 'campaigns/new_modal' %>
<% elsif @campaign.present? %>
<% elsif @parent_campaign.present? %>
<%= render 'campaigns/new_peer_to_peer_modal' %>
<% end %>
<% end %>

View file

@ -64,7 +64,8 @@
<%= render 'components/fundraising_pages/header',
image_url: @nonprofit_background_image,
is_editor: current_nonprofit_user?,
header_content_partial: 'header_content' %>
header_content_partial: 'header_content',
banner_image_url: nil %>
<%= render 'components/preview_mode_notification' %>