This commit is contained in:
Kasia Jarmołkowicz 2018-05-29 17:31:55 +02:00 committed by Eric Schultz
parent f621d89d51
commit 9d20974abd
4 changed files with 362 additions and 338 deletions

View file

@ -34,7 +34,8 @@ class Campaign < ActiveRecord::Base
:receipt_message, # text
:hide_custom_amounts, # boolean
:parent_campaign_id,
:reason_for_supporting
:reason_for_supporting,
:default_reason_for_supporting
validate :end_datetime_cannot_be_in_past, :on => :create
validates :profile, :presence => true
@ -177,4 +178,12 @@ class Campaign < ActiveRecord::Base
excluded_for_peer_to_peer.push(customizable_attributes_list)
attributes.except(*excluded_for_peer_to_peer)
end
def user_reason_for_supporting
if reason_for_supporting.present?
reason_for_supporting
else
default_reason_for_supporting
end
end
end

View file

@ -38,18 +38,16 @@
</div>
<div class='group'>
<fieldset class='field col-4'>
<label>Add a profile image</label>
<div class='image-upload u-margin--0' style='background-image: url("<%= @profile.picture %>");'>
<fieldset class='field col-12'>
<label>
Add a profile image
</label>
<small>Uploading your picture will greatly increase the chances of a successful campaign.</small>
<div class='image-upload u-marginTop--15' style='background-image: url("<%= @profile.picture %>");'>
<span><i class='fa fa-image'></i> Upload</span>
<input type='file' name='profile[picture]' >
</div>
</fieldset>
<fieldset class='col-right-8'>
<label>What's your reason for supporting <%= @campaign.name %>?</label>
<textarea rows='4' name='campaign[reason_for_supporting]' placeholder='' required></textarea>
</fieldset>
</div>
<%= render 'components/forms/submit_button', button_text: 'Next', scope: 'new_p2p_campaign_wiz', branded: true %>
@ -64,6 +62,13 @@
<!--= log new_p2p_campaign -->
<div class='u-margin--auto'>
<fieldset class='col-right-12'>
<label>What's your reason for supporting <%= @campaign.name %>?</label>
<small>Be concise and honest about your intentions.</small>
<textarea class='u-marginTop--15' rows='4' name='campaign[reason_for_supporting]' value='campaign[reason_for_supporting]' required></textarea>
</fieldset>
<fieldset class='group u-marginBottom--0'>
<label class='u-paddingTop--5'>Goal Amount</label>
<div class='prepend--dollar'>

View file

@ -0,0 +1,5 @@
class AddDefaultReasonForSupportingToCampaigns < ActiveRecord::Migration
def change
add_column :campaigns, :default_reason_for_supporting, :text
end
end

File diff suppressed because it is too large Load diff