Peer-to-peer editors can only edit goal amount
This commit is contained in:
parent
74ba1cf069
commit
539d8f472a
4 changed files with 204 additions and 139 deletions
|
@ -36,7 +36,7 @@ class CampaignsController < ApplicationController
|
||||||
@nonprofit = current_nonprofit
|
@nonprofit = current_nonprofit
|
||||||
@url = Format::Url.concat(root_url, @campaign.url)
|
@url = Format::Url.concat(root_url, @campaign.url)
|
||||||
|
|
||||||
if @campaign.parent_campaign
|
if @campaign.child_campaign?
|
||||||
@parent_campaign = @campaign.parent_campaign
|
@parent_campaign = @campaign.parent_campaign
|
||||||
@peer_to_peer_campaign_param = @parent_campaign.id
|
@peer_to_peer_campaign_param = @parent_campaign.id
|
||||||
else
|
else
|
||||||
|
|
|
@ -179,6 +179,10 @@ class Campaign < ActiveRecord::Base
|
||||||
attributes.except(*excluded_for_peer_to_peer)
|
attributes.except(*excluded_for_peer_to_peer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def child_campaign?
|
||||||
|
true if parent_campaign.present?
|
||||||
|
end
|
||||||
|
|
||||||
def user_reason_for_supporting
|
def user_reason_for_supporting
|
||||||
if reason_for_supporting.present?
|
if reason_for_supporting.present?
|
||||||
reason_for_supporting
|
reason_for_supporting
|
||||||
|
|
|
@ -4,6 +4,19 @@
|
||||||
<%= render 'common/modal_header', title: 'Campaign Settings' %>
|
<%= render 'common/modal_header', title: 'Campaign Settings' %>
|
||||||
|
|
||||||
<form class='form--flatFields' autosubmit action='/nonprofits/<%=@nonprofit.id%>/campaigns/<%=@campaign.id%>' method='put' data-reload parsley-validate>
|
<form class='form--flatFields' autosubmit action='/nonprofits/<%=@nonprofit.id%>/campaigns/<%=@campaign.id%>' method='put' data-reload parsley-validate>
|
||||||
|
<% if @campaign.child_campaign? %>
|
||||||
|
<div class='modal-body'>
|
||||||
|
<section class='layout--three'>
|
||||||
|
<fieldset>
|
||||||
|
<label>Goal</label>
|
||||||
|
<div class='prepend--dollar u-inlineBlock'>
|
||||||
|
<input type='number' parsley-type='number' class='input--150' name='campaign[goal_amount_dollars]' value='<%= sprintf("%.2f", @campaign.goal_amount / 100.0) %>'>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
<div class='modal-body'>
|
<div class='modal-body'>
|
||||||
<section class='layout--two'>
|
<section class='layout--two'>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
@ -37,6 +50,51 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class='modal-body'>
|
||||||
|
<section class='layout--three'>
|
||||||
|
<fieldset>
|
||||||
|
<label>Goal</label>
|
||||||
|
<div class='prepend--dollar u-inlineBlock'>
|
||||||
|
<input type='number' parsley-type='number' class='input--150' name='campaign[goal_amount_dollars]' value='<%= sprintf("%.2f", @campaign.goal_amount / 100.0) %>'>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class='modal-body'>
|
||||||
|
<section class='layout--two'>
|
||||||
|
<fieldset>
|
||||||
|
<label>Title </label>
|
||||||
|
<input type='text' class='u-marginBottom--0' name='campaign[name]' value='<%= @campaign.name %>'>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<label class='u-block'>Tagline</label>
|
||||||
|
<input type='text' name='campaign[tagline]' value='<%= @campaign.tagline %>'>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<section class='layout--three'>
|
||||||
|
<fieldset>
|
||||||
|
<label>Goal</label>
|
||||||
|
<div class='prepend--dollar u-inlineBlock'>
|
||||||
|
<input type='number' parsley-type='number' class='input--150' name='campaign[goal_amount_dollars]' value='<%= sprintf("%.2f", @campaign.goal_amount / 100.0) %>'>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<label>End Date & Time</label>
|
||||||
|
<div pikaday-timepicker='MM/DD/YYYY hh:mm a'>
|
||||||
|
<input class='u-width--200 u-bold u-inlineBlock' type='text' name='campaign[end_datetime]' required parsley-trigger='change' placeholder='MM/DD/YYYY HH:MM' value='<%= Format::Date.full(@campaign.end_datetime, @nonprofit.timezone) %>'>
|
||||||
|
<a class='button edit u-inlineBlock'>Set</a>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<%= render 'components/forms/slug_field', fundraiser: @campaign, url: @nonprofit.url + '/campaigns' %>
|
<%= render 'components/forms/slug_field', fundraiser: @campaign, url: @nonprofit.url + '/campaigns' %>
|
||||||
|
@ -111,7 +169,7 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<% if @campaign.parent_campaign.blank? %>
|
<% if !@campaign.child_campaign? %>
|
||||||
<hr>
|
<hr>
|
||||||
<section class='layout--two'>
|
<section class='layout--two'>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
@ -188,6 +246,9 @@
|
||||||
|
|
||||||
<div><p class='error'></p></div>
|
<div><p class='error'></p></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<footer class='modal-footer u-padding--15 layout--two'>
|
<footer class='modal-footer u-padding--15 layout--two'>
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
<section class='box-r'>
|
<section class='box-r'>
|
||||||
|
|
||||||
<% if current_campaign_editor? %>
|
<% if current_campaign_editor? && !@campaign.child_campaign? %>
|
||||||
<!-- Campaign editor gift option management modal -->
|
<!-- Campaign editor gift option management modal -->
|
||||||
<button class='button edit u-width--full u-marginBottom--15'>
|
<button class='button edit u-width--full u-marginBottom--15'>
|
||||||
<!--= on 'click' (open_modal 'manageGiftOptionsModal') -->
|
<!--= on 'click' (open_modal 'manageGiftOptionsModal') -->
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
</button>
|
</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !@campaign.parent_campaign %>
|
<% if !@campaign.child_campaign? %>
|
||||||
<aside class='u-marginBottom--15 pastelBox--grey'>
|
<aside class='u-marginBottom--15 pastelBox--grey'>
|
||||||
<a class='button u-width--full' target='_blank' if-branded='background-color, dark' href='/peer-to-peer?campaign_id=<%= @peer_to_peer_campaign_param %>'>
|
<a class='button u-width--full' target='_blank' if-branded='background-color, dark' href='/peer-to-peer?campaign_id=<%= @peer_to_peer_campaign_param %>'>
|
||||||
Start Your Own Campaign for <%= @nonprofit.name %>
|
Start Your Own Campaign for <%= @nonprofit.name %>
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<% if @campaign.parent_campaign %>
|
<% if @campaign.child_campaign? %>
|
||||||
<%= render 'components/fundraising_pages/campaigner_profile',
|
<%= render 'components/fundraising_pages/campaigner_profile',
|
||||||
profile: @campaign.profile,
|
profile: @campaign.profile,
|
||||||
campaign_name: @campaign.name,
|
campaign_name: @campaign.name,
|
||||||
|
|
Loading…
Reference in a new issue