Skip to content

Commit

Permalink
Eliminated more here docs. Merged grid and stylesheets partials.
Browse files Browse the repository at this point in the history
  • Loading branch information
greendog99 committed Feb 13, 2011
1 parent 1eed978 commit 48542fc
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 132 deletions.
2 changes: 1 addition & 1 deletion _boilerplate.rb
Expand Up @@ -7,4 +7,4 @@
run "compass init rails --require html5-boilerplate -u html5-boilerplate --syntax sass -c config/compass.rb --force"

git :add => '.'
git :commit => "-am 'Initialized Compass.'"
git :commit => "-aqm 'Initialized Compass.'"
2 changes: 1 addition & 1 deletion _devise.rb
Expand Up @@ -7,4 +7,4 @@
run "#{@rvm} exec rails generate devise:views"

git :add => '.'
git :commit => "-am 'Generated user auth layer with devise.'"
git :commit => "-aqm 'Generated user auth layer with devise.'"
2 changes: 1 addition & 1 deletion _forgery.rb
Expand Up @@ -5,4 +5,4 @@
run "#{@rvm} exec rails generate forgery"

git :add => '.'
git :commit => "-am 'Generated forgery override dirs.'"
git :commit => "-aqm 'Generated forgery override dirs.'"
2 changes: 1 addition & 1 deletion _friendly_id.rb
Expand Up @@ -5,4 +5,4 @@
run "#{@rvm} exec rails generate friendly_id"

git :add => '.'
git :commit => "-am 'Generated friendly_id migration.'"
git :commit => "-aqm 'Generated friendly_id migration.'"
98 changes: 0 additions & 98 deletions _grid.rb

This file was deleted.

8 changes: 8 additions & 0 deletions _helpers.rb
@@ -0,0 +1,8 @@
puts "Adding helpers, shared views, and other miscellany ...".magenta

copy_static_file 'app/helpers/application_helper.rb'
copy_static_file 'app/views/shared/_error_messages.html.haml'
# copy_static_file 'config/initializers/sass_config.rb'

git :add => '.'
git :commit => "-aqm 'Added helpers, shared views, and other miscellany.'"
29 changes: 4 additions & 25 deletions _layouts.rb
Expand Up @@ -28,28 +28,7 @@
HAML

# This needs to be kept up to date as the boilerplate and sporkd gem get updated
remove_file 'app/views/layouts/application.html.haml'
file 'app/views/layouts/application.html.haml', <<-HAML.gsub(/^ {2}/, '')
!!! 5
-# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
-ie_html :lang => 'en', :class => 'no-js' do
= render :partial => 'layouts/head'
%body{ :class => "\#{controller.controller_name}" }
#container
%header#header
.row
= render :partial => 'layouts/header'
%nav#nav
.row
= render :partial => 'layouts/nav'
#main
.row
= render :partial => 'layouts/flashes'
-# You MUST enclose your yielded content in at least one .row
= yield
%footer#footer
.row
= render :partial => 'layouts/footer'
-# Javascript at the bottom for fast page loading
= render :partial => 'layouts/javascripts'
HAML
copy_static_file 'app/views/layouts/application.html.haml'

git :add => '.'
git :commit => "-aqm 'Added layouts.'"
4 changes: 3 additions & 1 deletion _stylesheets.rb
Expand Up @@ -7,8 +7,10 @@
gsub_file 'app/stylesheets/style.sass', %r{//@include html5-boilerplate;}, '@include html5-boilerplate'
gsub_file 'app/stylesheets/style.sass', %r{@import partials/example}, '//@import partials/example'

%w{page buttons flashes forms tables}.each do |component|
%w{grid page buttons flashes forms tables}.each do |component|
copy_static_file "app/stylesheets/partials/_#{component}.sass"
append_file "app/stylesheets/style.sass", "@import partials/#{component}\n"
end

git :add => '.'
git :commit => "-aqm 'Added stylesheets.'"
1 change: 1 addition & 0 deletions files/Gemfile
Expand Up @@ -17,6 +17,7 @@ gem 'haml-rails'
# HTML/CSS framework and boilerplate
gem 'compass'
gem 'html5-boilerplate'
# gem 'compass-960-plugin'

# Human readable URLs
gem 'friendly_id', '~> 3.2'
Expand Down
84 changes: 84 additions & 0 deletions files/app/stylesheets/partials/_grid.sass
@@ -0,0 +1,84 @@
/* From http://www.1kbgrid.com/
$columns: 12
$col_width: 60px
$gutter: 20px
$margin = $gutter / 2
$width = $columns * ($col_width + $gutter)

=row
width: $width
margin: 0 auto
overflow: hidden

=inner_row
margin: 0 ($margin * -1)
width: auto
display: inline-block

=col($n: 1)
margin: 0 $margin
overflow: hidden
float: left
display: inline
width: ($n - 1) * ($col_width + $gutter) + $col_width

=prepend($n: 1)
margin-left: $n * ($col_width + $gutter) + $margin

=append($n: 1)
margin-right: $n * ($col_width + $gutter) + $margin

// Add the .row class to a div to start a new row. Can be nested
.row
+row

.row .row
+inner_row

// Some sample classes to get started with columns. You should create
// your own semantic classes (e.g. section.welcome, div.blog, div.post...)
.non_semantic_12col
+col(12)

.non_semantic_8col
+col(8)

.non_semantic_4col
+col(4)

.non_semantic_4col_tall
+col(4)
p
line-height: 170px

//
// Sample HAML to draw a grid
//
// .row
// .non_semantic_12col
// %p 12
//
// .row
// .non_semantic_8col
// %p 8
// .row
// .non_semantic_4col
// %p 4
// .non_semantic_4col
// %p 4
// .non_semantic_4col_tall
// %p 4
//
// ---------------------------------------------------
// | 12 |
// ---------------------------------------------------
// ---------------------------------- ----------------
// | 8 | | |
// ---------------------------------- | 4 |
// ----------------- ---------------- | |
// | 4 | | 4 | | |
// ----------------- ---------------- ----------------
//
22 changes: 22 additions & 0 deletions files/app/views/layouts/application.html.haml
@@ -0,0 +1,22 @@
!!! 5
-# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
-ie_html :lang => 'en', :class => 'no-js' do
= render :partial => 'layouts/head'
%body{ :class => "#{controller.controller_name}" }
#container
%header#header
.row
= render :partial => 'layouts/header'
%nav#nav
.row
= render :partial => 'layouts/nav'
#main
.row
= render :partial => 'layouts/flashes'
-# You MUST enclose your yielded content in at least one .row
= yield
%footer#footer
.row
= render :partial => 'layouts/footer'
-# Javascript at the bottom for fast page loading
= render :partial => 'layouts/javascripts'
5 changes: 1 addition & 4 deletions template.rb
Expand Up @@ -32,12 +32,9 @@ def copy_static_file(path)
copy_static_file 'Gemfile'
apply "#{@partials}/_rvm.rb" # Must be after gemfile since it runs bundler
apply "#{@partials}/_boilerplate.rb"
apply "#{@partials}/_grid.rb" # Must be after boilerplate since it modifies SASS files
apply "#{@partials}/_stylesheets.rb" # Must be after boilerplate since it modifies SASS files
apply "#{@partials}/_layouts.rb" # Must be after boilerplate since it modifies HAML files
copy_static_file 'app/helpers/application_helper.rb'
copy_static_file 'app/views/shared/_error_messages.html.haml'
# copy_static_file 'config/initializers/sass_config.rb'
apply "#{@partials}/_helpers.rb"
apply "#{@partials}/_appconfig.rb"
apply "#{@partials}/_rspec.rb"
apply "#{@partials}/_capistrano.rb"
Expand Down

0 comments on commit 48542fc

Please sign in to comment.