Browse files

Fimmished layout && routes

  • Loading branch information...
1 parent c97e2a1 commit 629d49bd867d9aa40ac2ad31577bd0db9bf312ab @johnbpetersen committed Dec 27, 2011
View
BIN app/assets/images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3 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/
View
111 app/assets/stylesheets/custom.css
@@ -0,0 +1,111 @@
+.container {
+ width: 710px;
+}
+
+body {
+ background: #cff;
+}
+
+header {
+ padding-top: 20px;
+}
+
+header img {
+ padding: 1em;
+ background: #fff;
+}
+
+section {
+ margin-top: 1em;
+ font-size: 120%;
+ padding: 20px;
+ background: #fff;
+}
+
+section h1 {
+ font-size: 200%;
+}
+
+/* Links */
+
+a {
+ color: #09c;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #069;
+ text-decoration: underline;
+}
+
+a:visited {
+ color: #069;
+}
+
+/* Navigation */
+
+nav {
+ float: right;
+ background-color: white;
+ padding: 0 0.7em;
+ white-space: nowrap;
+}
+
+nav ul {
+ margin: 0;
+ padding: 0;
+}
+
+nav ul li {
+ list-style-type: none;
+ display: inline-block;
+ padding: 0.2em 0;
+}
+
+nav ul li a {
+ padding: 0 5px;
+ font-weight: bold;
+}
+
+nav ul li a:visited {
+ color: #09c;
+}
+
+nav ul li a:hover {
+ text-decoration: underline;
+}
+
+footer {
+ text-align: center;
+ margin-top: 10px;
+ width: 710px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+footer nav {
+ float: none;
+}
+
+/* Sign up button */
+
+a.signup_button {
+ margin-left: auto;
+ margin-right: auto;
+ display: block;
+ text-align: center;
+ width: 190px;
+ color: #fff;
+ background: #006990;
+ font-size: 150%;
+ font-weight: bold;
+ padding: 20px;
+}
+
+/* Round corners */
+
+.round {
+ -moz-border-radius: 10px;
+ -webkit-border-radius: 10px;
+ border-radius: 10px;
+}
View
3 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/
View
5 app/controllers/users_controller.rb
@@ -0,0 +1,5 @@
+class UsersController < ApplicationController
+ def new
+ @title = "Sign up"
+ end
+end
View
2 app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
View
10 app/views/layouts/_footer.html.erb
@@ -0,0 +1,10 @@
+<footer>
+ <nav class="round">
+ <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>
+ <li><a href="http://www.railstutorial.org/">Rails Tutorial</a></li>
+ </ul>
+ </nav>
+</footer>
View
11 app/views/layouts/_header.html.erb
@@ -0,0 +1,11 @@
+<header>
+ <% logo = image_tag("logo.png", :alt => "Sample App", :class => "round") %>
+ <%= link_to logo, root_path %>
+ <nav class="round">
+ <ul>
+ <li><%= link_to "Home", 'root_path' %></li>
+ <li><%= link_to "Help", 'help_path' %></li>
+ <li><%= link_to "Sign in", '#' %></li>
+ </ul>
+ </nav>
+</header>
View
7 app/views/layouts/_stylesheets.html.erb
@@ -0,0 +1,7 @@
+<!--[if lt IE 9]>
+<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+<![endif]-->
+<%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
+<%= stylesheet_link_tag 'blueprint/print', :media => 'print' %>
+<!--[if lt IE 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]-->
+<%= stylesheet_link_tag 'custom', :media => 'screen' %>
View
2 app/views/pages/home.html.erb
@@ -5,4 +5,4 @@
sample application.
</p>
- <%= link_to "Sign up now!", '#', :class => "signup_button round " %>
+ <%= link_to "Sign up now!", 'sign_up path', :class => "signup_button round " %>
View
2 app/views/users/new.html.erb
@@ -0,0 +1,2 @@
+<h1>Users#new</h1>
+<p>Find me in app/views/users/new.html.erb</p>
View
4 config/routes.rb
@@ -1,4 +1,8 @@
SampleApp::Application.routes.draw do
+ get "users/new"
+
+ match '/signup', :to => 'users#new'
+
match '/contact', :to => 'pages#contact'
match '/about', :to => 'pages#about'
match '/help', :to => 'pages#help'
View
17 spec/controllers/users_controller_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe UsersController do
+ render_views
+
+ describe "GET 'new'" do
+ it "should be successful" do
+ get 'new'
+ response.should be_success
+ end
+
+ it "should have the right title" do
+ get 'new'
+ response.should have_selector("title", :content => "Sign up")
+ end
+ end
+end
View
29 spec/requests/layout_links_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe "LayoutLinks" do
+
+ it "should have a Home page at '/'" do
+ get '/'
+ response.should have_selector('title', :content => "Home")
+ end
+
+ it "should have a Contact page at '/contact'" do
+ get '/contact'
+ response.should have_selector('title', :content => "Contact")
+ end
+
+ it "should have an About page at '/about'" do
+ get '/about'
+ response.should have_selector('title', :content => "About")
+ end
+
+ it "should have a Help page at '/help'" do
+ get '/help'
+ response.should have_selector('title', :content => "Help")
+ end
+
+ it "should have a signup page at '/signup'" do
+ get '/signup'
+ response.should have_selector('title', :content => "Sign up")
+ end
+end

0 comments on commit 629d49b

Please sign in to comment.