toggle whether a donation campaign is advertised

This commit is contained in:
Emi Matchu 2015-02-25 13:49:18 -06:00
parent a11140f9e1
commit 0e6f823154
6 changed files with 21 additions and 9 deletions

View file

@ -20,6 +20,12 @@ module ApplicationHelper
end
end
def advertise_campaign_progress(campaign, &block)
if campaign && campaign.advertised?
campaign_progress(campaign, &block)
end
end
def campaign_progress(campaign, &block)
if campaign
if block_given?

View file

@ -1,4 +1,4 @@
- content_for :before_title, campaign_progress(@campaign)
- content_for :before_title, advertise_campaign_progress(@campaign)
- content_for :title_category do
#{t 'infinite_closet'}: #{t '.title_tagline'}
- content_for :before_flashes do

View file

@ -1,6 +1,6 @@
- hide_home_link
= campaign_progress @campaign
= advertise_campaign_progress @campaign
%p#pet-not-found.alert= t 'pets.load.not_found'
%p#neopia-error.alert= t 'pets.load.neopia_error'

View file

@ -1,5 +1,5 @@
- title(@outfit.name || t('.default_outfit_name'))
- content_for :before_title, campaign_progress(@campaign)
- content_for :before_title, advertise_campaign_progress(@campaign)
- open_graph :type => 'openneo-impress:outfit', :title => yield(:title),
:url => outfit_url(@outfit)

View file

@ -0,0 +1,5 @@
class AddAdvertisedToCampaign < ActiveRecord::Migration
def change
add_column :campaigns, :advertised, :boolean, null: false, default: true
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140910204043) do
ActiveRecord::Schema.define(:version => 20150225194522) do
create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false
@ -33,11 +33,12 @@ ActiveRecord::Schema.define(:version => 20140910204043) do
add_index "campaign_translations", ["locale"], :name => "index_campaign_translations_on_locale"
create_table "campaigns", :force => true do |t|
t.integer "progress", :null => false
t.integer "goal", :null => false
t.boolean "active", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "progress", :null => false
t.integer "goal", :null => false
t.boolean "active", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "advertised", :default => true, :null => false
end
create_table "campaigns_old", :force => true do |t|