From 0a5d78b7f4695a27050cf5bfd3c1f011da83c4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 19:16:24 +0200 Subject: [PATCH] Remove custom ERB file, add campaigner profile and p2p button to campaign page --- .../safety_around_water.css.scss | 78 -------- .../stylesheets/campaigns/show/page.css.scss | 37 ++++ app/controllers/campaigns_controller.rb | 33 +--- app/views/campaigns/show.html.erb | 28 ++- .../_campaigner_profile.html.erb | 23 +++ .../fundraising_pages/_header.html.erb | 5 + .../safety_around_water.html.erb | 185 ------------------ 7 files changed, 91 insertions(+), 298 deletions(-) delete mode 100644 app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss create mode 100644 app/views/components/fundraising_pages/_campaigner_profile.html.erb delete mode 100644 app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb diff --git a/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss b/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss deleted file mode 100644 index c6d8efe4..00000000 --- a/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss +++ /dev/null @@ -1,78 +0,0 @@ -@import 'mixins'; -@import 'common/fundraisers'; - -main button, main a.js-contributeButton { - background: #01a490 !important; -} - -main a.button { - background: #0089d0 !important; - color: white; -} - -main .button.edit, main .button--tiny.edit { - color: white; -} - -main { - width: 1200px; - margin: auto; -} - -main > header { - display: flex; - justify-content: center; - align-items: center; - margin: auto; -} - -body > .ymca-banner { - margin: auto; - width: 100vw; - height: 120px; - background-color: #01a490; -} - -main > header div.fundraisingHeader--image-container { - background-position: 0 -80px; -} - -img.fundraisingHeader--image-aspectRatio { - width: 1200px; - height: 500px; -} - -main > .container { - max-width: none; - margin-top: 15px; -} - -.campaigner-profile { - display: flex; - flex-wrap: nowrap; - align-items: baseline; -} - -.campaigner-profile > figure { - display: flex; - flex-direction: column; - align-items: center; - margin-right: 20px; - align-self: flex-start; -} - -.campaigner-profile > figure > .avatar { - flex-basis: 20%; -} - -.avatar > img { - width: 150px; - height: 150px; - clip-path: circle(50% at center); -} - -.campaigner-profile > figure > figcaption { - flex-basis: 55%; - padding: 15px; - text-align: left; -} diff --git a/app/assets/stylesheets/campaigns/show/page.css.scss b/app/assets/stylesheets/campaigns/show/page.css.scss index 53e60010..d603ffc2 100644 --- a/app/assets/stylesheets/campaigns/show/page.css.scss +++ b/app/assets/stylesheets/campaigns/show/page.css.scss @@ -103,6 +103,43 @@ margin-right: 1px; } +.campaigner-profile { + display: flex; + flex-wrap: nowrap; + align-items: baseline; +} + +.campaigner-profile > figure { + display: flex; + flex-direction: column; + align-items: center; + margin: auto 10px; + align-self: flex-start; +} + +.campaigner-profile > figure > .avatar { + flex-basis: 20%; + min-width: 100px; + height: auto; +} + +.avatar > img { + clip-path: circle(50% at center); +} + +.campaigner-profile > figure > figcaption { + flex-basis: 40%; + padding: 15px; + text-align: left; +} + +.campaigner-profile .reason { + flex-basis: 60%; +} + +.campaigner-profile .pastelBox-body { + min-height: 100px; +} @media screen and (max-width: 1000px) { .box, diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 815959a1..12fcdefa 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -44,14 +44,6 @@ class CampaignsController < ApplicationController end @campaign_background_image = FetchBackgroundImage.with_model(@campaign) - - if @nonprofit.custom_layout.blank? - respond_to do |format| - format.html - end - else - render template: "nonprofits/custom_campaign_layouts/" + @nonprofit.custom_layout - end end def activities @@ -122,29 +114,6 @@ class CampaignsController < ApplicationController @profile = current_user.profile if current_user end - def custom_layout - @campaign = current_campaign - @timezone = Format::Timezone.to_proxy(current_nonprofit.timezone) - if @campaign.deleted && !current_campaign_editor? - redirect_to nonprofit_path(current_nonprofit) - flash[:notice] = "Sorry, we couldn't find that campaign" - return - end - @nonprofit = current_nonprofit - @url = Format::Url.concat(root_url, @campaign.url) - - if @campaign.parent_campaign - @parent_campaign = @campaign.parent_campaign - @peer_to_peer_campaign_param = @parent_campaign.id - else - @peer_to_peer_campaign_param = @campaign.id - end - - @campaign_background_image = FetchBackgroundImage.with_model(@campaign) - - render template: "nonprofits/custom_campaign_layouts/safety_around_water" - end - private def check_nonprofit_status @@ -160,7 +129,7 @@ class CampaignsController < ApplicationController p2p_params = params.except(:nonprofit_id, :summary,:goal_amount) p2p_params.merge!(parent_campaign.child_params) - + base_slug = Format::Url.convert_to_slug "#{p2p_params[:name]}-#{profile.name}" algo = SlugP2pCampaignNamingAlgorithm.new(p2p_params[:nonprofit_id]) p2p_params[:slug] = algo.create_copy_name(base_slug) diff --git a/app/views/campaigns/show.html.erb b/app/views/campaigns/show.html.erb index 6218ffa3..b88c22a6 100644 --- a/app/views/campaigns/show.html.erb +++ b/app/views/campaigns/show.html.erb @@ -64,14 +64,14 @@ image_url: @campaign_background_image, is_editor: current_campaign_editor?, hide_title: @campaign.hide_title && @campaign_background_image, - header_content_partial: 'header_content' %> + header_content_partial: 'header_content', + banner_image_url: @campaign.banner_image&.url %> <%= render 'components/preview_mode_notification' %>
- -
+
<%= render 'campaign_media' %>
@@ -85,6 +85,14 @@ <% end %> + <% if !@campaign.parent_campaign %> + + <% end %> +
@@ -105,6 +113,20 @@
+ <% if @campaign.parent_campaign %> + <%= render 'components/fundraising_pages/campaigner_profile', + profile: @campaign.profile, + campaign_name: @campaign.name, + reason_for_supporting: @campaign.reason_for_supporting + %> + +
+ + Start Your Own Campaign for <%= @nonprofit.name %> + +
+ <% end %> +
diff --git a/app/views/components/fundraising_pages/_campaigner_profile.html.erb b/app/views/components/fundraising_pages/_campaigner_profile.html.erb new file mode 100644 index 00000000..79aca61c --- /dev/null +++ b/app/views/components/fundraising_pages/_campaigner_profile.html.erb @@ -0,0 +1,23 @@ +
+
+
+
+ +
+
+

<%= profile.name %>

+

<%= profile.city %>

+ <% if profile.state_code && profile.city %> +

<%= profile.city_state %> <%= profile.state_code %>

+ <% end %> +
+
+ +
+
What's your reason for supporting <%= campaign_name %>?
+
+ <%= reason_for_supporting %> +
+
+
+
diff --git a/app/views/components/fundraising_pages/_header.html.erb b/app/views/components/fundraising_pages/_header.html.erb index af6f2574..4acb733b 100644 --- a/app/views/components/fundraising_pages/_header.html.erb +++ b/app/views/components/fundraising_pages/_header.html.erb @@ -6,6 +6,11 @@
id='js-fundraisingHeader'> + <% if banner_image_url %> +
+ +
+ <% end %> diff --git a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb deleted file mode 100644 index f0e5319e..00000000 --- a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb +++ /dev/null @@ -1,185 +0,0 @@ -<%= content_for(:title_prefix) { "#{@campaign.name} - #{@campaign.nonprofit.name} | ".html_safe } %> -<% content_for(:fixed_position_cta_hidden) {'hidden'} %> -<%= content_for(:meta_description) {raw @campaign.summary} %> -<% @brand_color = @nonprofit.brand_color ? @nonprofit.brand_color : nil %> - -<%= content_for :javascripts do %> - - <%= render 'schema', campaign: @campaign, url: @url %> - <%= render 'common/froala' if current_campaign_editor? %> - - <%= IncludeAsset.js '/client/js/campaigns/show/page.js' %> -<% end %> - -<%= content_for :stylesheets do %> - <%= stylesheet_link_tag 'campaigns/show/page' %> - <%= stylesheet_link_tag 'campaigns/edit/page' %> - <%= stylesheet_link_tag 'campaigns/custom_layout/safety_around_water' %> - -<% end %> - -<% content_for :head do %> - -<% end %> - -<%= content_for :facebook_tags do %> - - - -<% end %> - -<%= content_for :twitter_tags do %> - - - -<% end %> - -<% if current_campaign_editor? %> - <%= render 'admin_top_nav' %> -<% end %> - -<%= render '/components/trial_bar' if QueryBillingSubscriptions.currently_in_trial?(@nonprofit.id) %> - -<% hide_title = @campaign.hide_title && @campaign_background_image ? true : false %> -<% css_style = current_campaign_editor? ? "style='margin-top: 0'" : '' %> - -
-
- -
- - <%= render 'components/fundraising_pages/header', - image_url: @campaign_background_image, - is_editor: current_campaign_editor?, - hide_title: @campaign.hide_title && @campaign_background_image, - header_content_partial: 'header_content' %> - - <%= render 'components/preview_mode_notification' %> - -
-
- <%= render 'campaign_media' %> -
- -
- - <% if current_campaign_editor? %> - - - <% end %> - - <% if !@campaign.parent_campaign %> - - <% end %> - - -
- - - -
- - <% if @campaign.parent_campaign %> -
- -
-
-
- /> -
-
-

<%= @campaign.profile.name %>

-

<%= @campaign.profile.city %>

- <% if @campaign.profile.state_code && @campaign.profile.city %> -

<%= @campaign.profile.city_state %> <%= @campaign.profile.state_code %>

- <% end %> -
-
- -
-
I am supporting the Y becauseā€¦
-
- <%= @campaign.reason_for_supporting %> -
- - - Start Your Own Campaign for <%= @nonprofit.name %> - -
-
-
- <% end %> - -
-

<%= @campaign.name %>

- -
- <%= raw @campaign.body %> -
- - <% unless @campaign.hide_activity_feed %> -
- <%= render 'components/activity_feed' %> -
- <% end %> -
-
-
- -<% if current_campaign_editor? %> - <%= render 'settings_modal' %> - <%= render 'video_modal' %> - <%= render 'donations/campaign_new_offline_modal' %> - <%= render 'campaign_gift_options/manage_modal'%> - <%= render 'campaign_gift_options/form_modal'%> - <%= render 'components/upload_background_image', - end_point: "/nonprofits/#{@nonprofit.id}/campaigns/#{@campaign.id}", - image_url: @campaign_background_image, - input_name: 'campaign[background_image]' %> - <%= render 'components/upload_banner_image', - end_point: "/nonprofits/#{@nonprofit.id}/campaigns/#{@campaign.id}", - image_url: @campaign.banner_image.url, - input_name: 'campaign[banner_image]' %> - <%= render 'components/custom_receipt_modal', - title: 'Campaign Receipt Message', - type: 'campaign', - path: nonprofit_campaign_path(@nonprofit, @campaign), - key: 'campaign[receipt_message]', - text: @campaign.receipt_message %> - <%= render 'components/duplicate_fundraiser_modal', type: 'campaign' %> -<% end %> - -<%= render 'components/share_modal', name: @campaign.name, type: 'campaign' %> -<%= render 'common/email_share_modal', fundraiser: @campaign.name, fundraiser_url: @url %>