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
end end
def advertise_campaign_progress(campaign, &block)
if campaign && campaign.advertised?
campaign_progress(campaign, &block)
end
end
def campaign_progress(campaign, &block) def campaign_progress(campaign, &block)
if campaign if campaign
if block_given? 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 - content_for :title_category do
#{t 'infinite_closet'}: #{t '.title_tagline'} #{t 'infinite_closet'}: #{t '.title_tagline'}
- content_for :before_flashes do - content_for :before_flashes do

View file

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

View file

@ -1,5 +1,5 @@
- title(@outfit.name || t('.default_outfit_name')) - 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), - open_graph :type => 'openneo-impress:outfit', :title => yield(:title),
:url => outfit_url(@outfit) :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. # 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| create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false t.string "short_name", :limit => 10, :null => false
@ -38,6 +38,7 @@ ActiveRecord::Schema.define(:version => 20140910204043) do
t.boolean "active", :null => false t.boolean "active", :null => false
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.boolean "advertised", :default => true, :null => false
end end
create_table "campaigns_old", :force => true do |t| create_table "campaigns_old", :force => true do |t|