Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make the homepage prettier and more dynamic.

The homepage will now automatically add link blocks for each non-body page
part. The block will automatically link to a page with url that's the
camelized page part title, i.e

    About -> /about

The default page parts are included in db/seeds.rb.

Also pretty up the home page with a new concept logo and gradienty
banner.
  • Loading branch information...
commit 0622b3d5b87c6955b3252b8d04163045a9a899bd 1 parent a9eddde
@wjbuys wjbuys authored robertfall committed
View
BIN  app/assets/images/big_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
26 app/assets/stylesheets/application.scss
@@ -1,10 +1,30 @@
+@import "bourbon";
@import "bootstrap";
body {
- margin-top: 60px;
+ margin-top: 40px;
}
-.hero-unit.logo {
- background: none;
+.navbar img {
+ float: left;
+ margin-right: 10px;
}
+a.link-block {
+ color: inherit;
+ text-decoration: none;
+
+ @extend .thumbnail;
+}
+
+.banner {
+ text-align: center;
+
+ border-bottom: 2px solid darken($blue, 10%);
+ max-height: 281px;
+ margin-bottom: 1em;
+ @include linear-gradient(lighten($blue, 40%), lighten($blue, 30%));
+ background-color: darken($blue, 10%);
+}
+
+
View
14 app/decorators/models/refinery/page_decorator.rb
@@ -0,0 +1,14 @@
+Refinery::Page.class_eval do
+ def extra_parts
+ parts.reject do |part|
+ part.title && part.title == "Body"
+ end
+ end
+
+ def extra_part_names
+ extra_parts.map do |part|
+ part.title.downcase.gsub(" ", "_")
+ end
+ end
+end
+
View
1  app/views/layouts/application.slim
@@ -4,6 +4,7 @@ html
body
header
= render '/refinery/header'
+ = yield :banner
.container
= yield
= render '/refinery/footer'
View
22 app/views/refinery/pages/home.slim
@@ -1,18 +1,12 @@
-.hero-unit.logo
- =raw @page.content_for(:banner)
+- content_for :banner do
+ .banner
+ = image_tag "big_logo.png"
.row
- .span12
- ul.thumbnails
- li.span4
- a.thumbnail href="/about"
- =raw @page.content_for(:about)
- li.span4
- a.thumbnail href="/social"
- =raw @page.content_for(:social)
- li.span4
- a.thumbnail href="/concerts"
- =raw @page.content_for(:concerts)
-
+ - width = 12 / @page.extra_parts.size
+ - @page.extra_part_names.each do |part|
+ div class="span#{width}"
+ a.link-block href="/#{part}"
+ =raw @page.content_for(part)
.row
.span12
=raw @page.content_for(:body)
View
79 db/seeds.rb
@@ -1,10 +1,69 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-#
-# Examples:
-#
-# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
-# Mayor.create(name: 'Emanuel', city: cities.first)
-
-# Added by Refinery CMS Pages extension
-Refinery::Pages::Engine.load_seed
+if Refinery::Page.where(:menu_match => "^/$").empty?
+ home_page = Refinery::Page.create!({:title => "Home",
+ :deletable => false,
+ :link_url => "/",
+ :menu_match => "^/$"})
+ home_page.parts.create({
+ :title => "About",
+ :body => %{
+<h3>Who are you?</h3>
+<img src="http://placehold.it/360x200"/>
+<p>The Cape Town Youth Choir (formerly known as <i>Pro Cantu</i>) is a world class choir based out of the beautiful city of Cape Town and conducted by Leon Starker.</p>
+ },
+ :position => 0
+ })
+
+ home_page.parts.create({
+ :title => "Social",
+ :body => %{
+<h3>What are you up to?</h3>
+<img src="http://placehold.it/360x360"/>
+<p>Visit our Facebook Page for up-to-the second news, photos and posts from our members, and to participate in our community.</p>
+ },
+ :position => 1
+ })
+
+ home_page.parts.create({
+ :title => "Concerts",
+ :body => %{
+<h3>Where can I see you?</h3>
+<img src="http://placehold.it/360x200"/>
+<p>Take a look at our concert calendar. We perform several times a year in venues around Cape Town <i>(City Hall, the Centre for the Book, St. George's Cathedral)</i>, around South Africa, and - every so often - around the world.</p>
+ },
+ :position => 2
+ })
+
+ home_page_position = -1
+
+ page_not_found_page = home_page.children.create(:title => "Page not found",
+ :menu_match => "^/404$",
+ :show_in_menu => false,
+ :deletable => false)
+ page_not_found_page.parts.create({
+ :title => "Body",
+ :body => "<h2>Sorry, there was a problem...</h2><p>The page you requested was not found.</p><p><a href='/'>Return to the home page</a></p>",
+ :position => 0
+ })
+end
+
+if Refinery::Page.by_title("About").empty?
+ about_us_page = ::Refinery::Page.create(:title => "About")
+ about_us_page.parts.create({
+ :title => "Body",
+ :position => 0
+ })
+end
+
+if Refinery::Page.by_title("Social").empty?
+ ::Refinery::Page.create(
+ :title => "Social",
+ :link_url => "https://www.facebook.com/CPTYC"
+ )
+end
+
+if Refinery::Page.by_title("Concerts").empty?
+ ::Refinery::Page.create(
+ :title => "Concerts",
+ :link_url => "https://www.facebook.com/CPTYC/events"
+ )
+end
Please sign in to comment.
Something went wrong with that request. Please try again.