Permalink
Browse files

Ability to activate / deactivate the about page

  • Loading branch information...
1 parent 1af2776 commit 1f7159d25f2113d96c12fbf9c19ebad2d365ccb5 @marcgg committed Feb 20, 2012
View
@@ -48,7 +48,7 @@ GEM
faraday (0.5.7)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
- rack (< 2, >= 1.1.0)
+ rack (>= 1.1.0, < 2)
faraday_middleware (0.3.2)
faraday (~> 0.5.4)
fssm (0.2.7)
@@ -123,7 +123,7 @@ GEM
polyglot (>= 0.3.1)
tzinfo (0.3.29)
webmock (1.7.6)
- addressable (> 2.2.5, ~> 2.2)
+ addressable (~> 2.2, > 2.2.5)
crack (>= 0.1.7)
PLATFORMS
@@ -15,6 +15,7 @@ def single_photo
end
def about
+ redirect_to root_path unless @portfolio.about_page
end
private
@@ -3,5 +3,6 @@
.nav-link-wrapper{:class => ((!@category.nil? and @category.id == category.id) ? " selected " : "") + "category-order-#{i}"}
= link_to category.title, showcase_path(:slug => @portfolio.slug, :category_slug => category.slug)
- .nav-link-wrapper#about{:class => (@category.nil? ? "selected" : "")}
- = link_to "About", about_path(:slug => @portfolio.slug)
+ - if @portfolio.about_page
+ .nav-link-wrapper#about{:class => (@category.nil? ? "selected" : "")}
+ = link_to "About", about_path(:slug => @portfolio.slug)
@@ -4,6 +4,9 @@
= f.label :description
= f.text_area :description
+= f.label :about_page
+= f.check_box :about_page
+
- unless simple
= f.label :slug
= f.text_field :slug
View
@@ -228,6 +228,7 @@ en:
description: "Description used in the 'about' page*"
flickr_user_email: "Email used on Flickr*"
slug: Slug*
+ about_page: "Show the 'about' page"
google_analytics_code: "Google Analytics Code (e.g. UA-25132842-1)"
facebook_share: "Show a Facebook like button on the about page"
@@ -0,0 +1,9 @@
+class AddAboutPageToPortfolios < ActiveRecord::Migration
+ def self.up
+ add_column :portfolios, :about_page, :boolean, :default => false
+ end
+
+ def self.down
+ remove_column :portfolios, :about_page
+ end
+end
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20111016180006) do
+ActiveRecord::Schema.define(:version => 20120220190612) do
create_table "beta_codes", :force => true do |t|
t.string "code"
@@ -70,6 +70,7 @@
t.string "slug"
t.string "google_analytics_code"
t.boolean "facebook_share", :default => false
+ t.boolean "about_page", :default => false
end
create_table "remote_accounts", :force => true do |t|
@@ -17,12 +17,19 @@
describe "GET about" do
it "should display the about page" do
+ @portfolio.update_attributes(:about_page => true)
get "about", :slug => @portfolio.slug
response.should be_success
response.should render_template :about
assigns(:category).should be_nil
assigns(:portfolio).should == @portfolio
end
+
+ it "should not display the about page if deactivated" do
+ @portfolio.update_attributes(:about_page => false)
+ get "about", :slug => @portfolio.slug
+ response.should redirect_to root_path
+ end
end
describe "GET showcase" do

0 comments on commit 1f7159d

Please sign in to comment.