thank-you message automatically deploys on campaign success
This commit is contained in:
parent
5466cc9301
commit
2ca784c3a2
4 changed files with 13 additions and 1 deletions
|
@ -11,6 +11,10 @@ class Campaign < ActiveRecord::Base
|
|||
goal - progress
|
||||
end
|
||||
|
||||
def complete?
|
||||
progress >= goal
|
||||
end
|
||||
|
||||
def self.current
|
||||
self.where(active: true).first or
|
||||
raise ActiveRecord::RecordNotFound.new("no current campaign")
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
= 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
|
||||
|
||||
- if @donations.present?
|
||||
|
|
5
db/migrate/20150923052017_add_thanks_to_campaign.rb
Normal file
5
db/migrate/20150923052017_add_thanks_to_campaign.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddThanksToCampaign < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :campaigns, :thanks, :text
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150905181350) do
|
||||
ActiveRecord::Schema.define(:version => 20150923052017) do
|
||||
|
||||
create_table "auth_servers", :force => true do |t|
|
||||
t.string "short_name", :limit => 10, :null => false
|
||||
|
@ -42,6 +42,7 @@ ActiveRecord::Schema.define(:version => 20150905181350) do
|
|||
t.text "description", :null => false
|
||||
t.string "name", :default => "our hosting costs this year", :null => false
|
||||
t.string "theme_id", :default => "hug", :null => false
|
||||
t.text "thanks"
|
||||
end
|
||||
|
||||
create_table "campaigns_old", :force => true do |t|
|
||||
|
|
Loading…
Reference in a new issue