Skip to content

Commit

Permalink
Finish layout and routes
Browse files Browse the repository at this point in the history
  • Loading branch information
vidushee1awasthi committed May 7, 2012
1 parent f93c2c9 commit b5f4f85
Show file tree
Hide file tree
Showing 22 changed files with 296 additions and 56 deletions.
2 changes: 2 additions & 0 deletions Gemfile
@@ -1,6 +1,7 @@
source 'https://rubygems.org'

gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
Expand Down Expand Up @@ -31,6 +32,7 @@ group :test do
gem 'capybara', '1.1.2'
gem 'rb-inotify', '0.8.8'
gem 'libnotify', '0.5.9'
gem 'launchy'
end

group :production do
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Expand Up @@ -30,6 +30,7 @@ GEM
multi_json (~> 1.0)
addressable (2.2.7)
arel (3.0.2)
bootstrap-sass (2.0.0)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
Expand Down Expand Up @@ -67,6 +68,8 @@ GEM
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.6)
launchy (2.1.0)
addressable (~> 2.2.6)
libnotify (0.5.9)
libv8 (3.3.10.4)
libwebsocket (0.1.3)
Expand Down Expand Up @@ -156,12 +159,14 @@ PLATFORMS
ruby

DEPENDENCIES
bootstrap-sass (= 2.0.0)
capybara (= 1.1.2)
coffee-rails (~> 3.2.1)
execjs
guard-rspec (= 0.5.5)
guard-spork (= 0.3.2)
jquery-rails
launchy
libnotify (= 0.5.9)
mysql2
pg
Expand Down
34 changes: 34 additions & 0 deletions Guardfile
@@ -0,0 +1,34 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme


guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }

# Rails example
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end


guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/spec_helper.rb')
watch('test/test_helper.rb')
end
3 changes: 3 additions & 0 deletions app/assets/javascripts/users.js.coffee
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
104 changes: 104 additions & 0 deletions app/assets/stylesheets/custom.css.scss
@@ -0,0 +1,104 @@

@import "bootstrap";

/* mixins, variables, etc. */

$grayMediumLight: #eaeaea;

/* universal */

html {
overflow-y: scroll;
}

body {
padding-top: 60px;
}

section {
overflow: auto;
}

textarea {
resize: vertical;
}

.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}

/* typography */

h1, h2, h3, h4, h5, h6 {
line-height: 1;
}

h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}

h2 {
font-size: 1.7em;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: $grayLight;
}

p {
font-size: 1.1em;
line-height: 1.7em;
}


/* header */

#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: white;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
line-height: 1;
&:hover {
color: white;
text-decoration: none;
}
}

/* footer */

footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid $grayMediumLight;
color: $grayLight;
a {
color: $gray;
&:hover {
color: $grayDarker;
}
}
small {
float: left;
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 10px;
}
}
}

3 changes: 3 additions & 0 deletions app/assets/stylesheets/users.css.scss
@@ -0,0 +1,3 @@
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
9 changes: 7 additions & 2 deletions app/controllers/static_pages_controller.rb
@@ -1,11 +1,16 @@
class StaticPagesController < ApplicationController

def home
end

def help
end

def about
end

def about
def contact
end
end
end


4 changes: 4 additions & 0 deletions app/controllers/users_controller.rb
@@ -0,0 +1,4 @@
class UsersController < ApplicationController
def new
end
end
1 change: 0 additions & 1 deletion app/helpers/application_helper.rb
Expand Up @@ -5,7 +5,6 @@ def full_title(page_title)
base_title
else
"#{base_title} | #{page_title}"

end
end
end
2 changes: 2 additions & 0 deletions app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
module UsersHelper
end
13 changes: 13 additions & 0 deletions app/views/layouts/_footer.html.erb
@@ -0,0 +1,13 @@
<footer class="footer">
<small>
<a href="http://railstutorial.org/">Rails Tutorial</a>
by Michael Hartl
</small>
<nav>
<ul>
<li><%= link_to "About", about_path %></li>
<li><%= link_to "Contact", contact_path %></li>
<li><a href="http://news.railstutorial.org/">News</a></li>
</ul>
</nav>
</footer>
14 changes: 14 additions & 0 deletions app/views/layouts/_header.html.erb
@@ -0,0 +1,14 @@
<header class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<%= link_to "sample app", root_path, id: "logo" %>
<nav>
<ul class="nav pull-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Help", help_path %></li>
<li><%= link_to "Sign in", '#' %></li>
</ul>
</nav>
</div>
</div>
</header>
Empty file.
27 changes: 15 additions & 12 deletions app/views/layouts/application.html.erb
@@ -1,14 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class = "container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions app/views/static_pages/contact.html.erb
@@ -0,0 +1,7 @@
<% provide(:title, 'Contact') %>
<h1>Contact</h1>
<p>
Contact Ruby on Rails Tutorial about the sample app at the
<a href="http://railstutorial.org/contact">contact page</a>
</p>

17 changes: 9 additions & 8 deletions app/views/static_pages/home.html.erb
@@ -1,12 +1,13 @@
<div class="center hero-unit">
<h1>Welcome to the Sample App</h1>

<h1>Sample App</h1>
<p>

This is the home page for the
<a href ="http://railstutorial.org/">Ruby on Rails Tutorial</a>
<h2>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>


</h2>

<%= link_to "Sign up now!", signup_path, class: "btn btn-large btn-primary" %>
</div>

<%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org/' %>
4 changes: 4 additions & 0 deletions app/views/users/new.html.erb
@@ -0,0 +1,4 @@
<%provide(:title,'Sign up') %>
<h1>Sign up</h1>
<p>Find me in app/views/users/new.html.erb</p>
16 changes: 11 additions & 5 deletions config/routes.rb
@@ -1,11 +1,17 @@
SampleApp::Application.routes.draw do
get "static_pages/home", :as => :home
get "users/new"

get "static_pages/help", :as => :help
get "static_pages/about", :as => :about
get "static_pages/contact",:as=> :contact
root :to => 'static_pages#home'

root :to => 'static_pages#home'
match '/', to: 'static_pages#home'

match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/signup', to: 'users#new'




# The priority is based upon order of creation:
# first created -> highest priority.
Expand Down
16 changes: 16 additions & 0 deletions db/schema.rb
@@ -0,0 +1,16 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 0) do

end

0 comments on commit b5f4f85

Please sign in to comment.