Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 22 files changed
  • 0 comments
  • 1 contributor
6 Gemfile
... ... @@ -1,6 +1,7 @@
1 1 source 'https://rubygems.org'
2 2
3   -gem 'rails', '3.2.1'
  3 +gem 'rails', '3.2.2'
  4 +gem 'bootstrap-sass', '2.0.0'
4 5
5 6 group :development, :test do
6 7 gem 'sqlite3', '1.3.5'
@@ -18,7 +19,10 @@ end
18 19 gem 'jquery-rails', '2.0.0'
19 20
20 21 group :test do
  22 + gem 'rspec-rails', '2.8.1'
21 23 gem 'capybara', '1.1.2'
  24 + gem 'rb-inotify', '0.8.8'
  25 + gem 'libnotify', '0.5.9'
22 26 end
23 27
24 28 group :production do
67 Gemfile.lock
... ... @@ -1,12 +1,12 @@
1 1 GEM
2 2 remote: https://rubygems.org/
3 3 specs:
4   - actionmailer (3.2.1)
5   - actionpack (= 3.2.1)
  4 + actionmailer (3.2.2)
  5 + actionpack (= 3.2.2)
6 6 mail (~> 2.4.0)
7   - actionpack (3.2.1)
8   - activemodel (= 3.2.1)
9   - activesupport (= 3.2.1)
  7 + actionpack (3.2.2)
  8 + activemodel (= 3.2.2)
  9 + activesupport (= 3.2.2)
10 10 builder (~> 3.0.0)
11 11 erubis (~> 2.7.0)
12 12 journey (~> 1.0.1)
@@ -14,21 +14,22 @@ GEM
14 14 rack-cache (~> 1.1)
15 15 rack-test (~> 0.6.1)
16 16 sprockets (~> 2.1.2)
17   - activemodel (3.2.1)
18   - activesupport (= 3.2.1)
  17 + activemodel (3.2.2)
  18 + activesupport (= 3.2.2)
19 19 builder (~> 3.0.0)
20   - activerecord (3.2.1)
21   - activemodel (= 3.2.1)
22   - activesupport (= 3.2.1)
23   - arel (~> 3.0.0)
  20 + activerecord (3.2.2)
  21 + activemodel (= 3.2.2)
  22 + activesupport (= 3.2.2)
  23 + arel (~> 3.0.2)
24 24 tzinfo (~> 0.3.29)
25   - activeresource (3.2.1)
26   - activemodel (= 3.2.1)
27   - activesupport (= 3.2.1)
28   - activesupport (3.2.1)
  25 + activeresource (3.2.2)
  26 + activemodel (= 3.2.2)
  27 + activesupport (= 3.2.2)
  28 + activesupport (3.2.2)
29 29 i18n (~> 0.6)
30 30 multi_json (~> 1.0)
31 31 arel (3.0.2)
  32 + bootstrap-sass (2.0.0)
32 33 builder (3.0.0)
33 34 capybara (1.1.2)
34 35 mime-types (>= 1.16)
@@ -58,38 +59,41 @@ GEM
58 59 railties (>= 3.2.0.beta, < 5.0)
59 60 thor (~> 0.14)
60 61 json (1.6.5)
61   - mail (2.4.1)
  62 + libnotify (0.5.9)
  63 + mail (2.4.3)
62 64 i18n (>= 0.4.0)
63 65 mime-types (~> 1.16)
64 66 treetop (~> 1.4.8)
65 67 mime-types (1.17.2)
66 68 multi_json (1.1.0)
67   - nokogiri (1.5.0)
  69 + nokogiri (1.5.2)
68 70 pg (0.12.2)
69 71 polyglot (0.3.3)
70 72 rack (1.4.1)
71   - rack-cache (1.1)
  73 + rack-cache (1.2)
72 74 rack (>= 0.4)
73 75 rack-ssl (1.3.2)
74 76 rack
75 77 rack-test (0.6.1)
76 78 rack (>= 1.0)
77   - rails (3.2.1)
78   - actionmailer (= 3.2.1)
79   - actionpack (= 3.2.1)
80   - activerecord (= 3.2.1)
81   - activeresource (= 3.2.1)
82   - activesupport (= 3.2.1)
  79 + rails (3.2.2)
  80 + actionmailer (= 3.2.2)
  81 + actionpack (= 3.2.2)
  82 + activerecord (= 3.2.2)
  83 + activeresource (= 3.2.2)
  84 + activesupport (= 3.2.2)
83 85 bundler (~> 1.0)
84   - railties (= 3.2.1)
85   - railties (3.2.1)
86   - actionpack (= 3.2.1)
87   - activesupport (= 3.2.1)
  86 + railties (= 3.2.2)
  87 + railties (3.2.2)
  88 + actionpack (= 3.2.2)
  89 + activesupport (= 3.2.2)
88 90 rack-ssl (~> 1.3.2)
89 91 rake (>= 0.8.7)
90 92 rdoc (~> 3.4)
91 93 thor (~> 0.14.6)
92 94 rake (0.9.2.2)
  95 + rb-inotify (0.8.8)
  96 + ffi (>= 0.5.0)
93 97 rdoc (3.12)
94 98 json (~> 1.4)
95 99 rspec (2.8.0)
@@ -126,7 +130,7 @@ GEM
126 130 treetop (1.4.10)
127 131 polyglot
128 132 polyglot (>= 0.3.1)
129   - tzinfo (0.3.31)
  133 + tzinfo (0.3.32)
130 134 uglifier (1.2.3)
131 135 execjs (>= 0.3.0)
132 136 multi_json (>= 1.0.2)
@@ -137,11 +141,14 @@ PLATFORMS
137 141 ruby
138 142
139 143 DEPENDENCIES
  144 + bootstrap-sass (= 2.0.0)
140 145 capybara (= 1.1.2)
141 146 coffee-rails (= 3.2.2)
142 147 jquery-rails (= 2.0.0)
  148 + libnotify (= 0.5.9)
143 149 pg (= 0.12.2)
144   - rails (= 3.2.1)
  150 + rails (= 3.2.2)
  151 + rb-inotify (= 0.8.8)
145 152 rspec-rails (= 2.8.1)
146 153 sass-rails (= 3.2.3)
147 154 sqlite3 (= 1.3.5)
3  app/assets/javascripts/users.js.coffee
... ... @@ -0,0 +1,3 @@
  1 +# Place all the behaviors and hooks related to the matching controller here.
  2 +# All this logic will automatically be available in application.js.
  3 +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
102 app/assets/stylesheets/custom.css.scss
... ... @@ -0,0 +1,102 @@
  1 +@import "bootstrap";
  2 +
  3 +/* mixins, variables, etc. */
  4 +
  5 +$grayMediumLight: #eaeaea;
  6 +
  7 +/* universal */
  8 +
  9 +html {
  10 + overflow-y: scroll;
  11 +}
  12 +
  13 +body {
  14 + padding-top: 60px;
  15 +}
  16 +
  17 +section {
  18 + overflow: auto;
  19 +}
  20 +
  21 +textarea {
  22 + resize: vertical;
  23 +}
  24 +
  25 +.center {
  26 + text-align: center;
  27 + h1 {
  28 + margin-bottom: 10px;
  29 + }
  30 +}
  31 +
  32 +/* typography */
  33 +
  34 +h1, h2, h3, h4, h5, h6 {
  35 + line-height: 1;
  36 +}
  37 +
  38 +h1 {
  39 + font-size: 3em;
  40 + letter-spacing: -2px;
  41 + margin-bottom: 30px;
  42 + text-align: center;
  43 +}
  44 +
  45 +h2 {
  46 + font-size: 1.7em;
  47 + letter-spacing: -1px;
  48 + margin-bottom: 30px;
  49 + text-align: center;
  50 + font-weight: normal;
  51 + color: $grayLight;
  52 +}
  53 +
  54 +p {
  55 + font-size: 1.1em;
  56 + line-height: 1.7em;
  57 +}
  58 +
  59 +
  60 +/* header */
  61 +
  62 +#logo {
  63 + float: left;
  64 + margin-right: 10px;
  65 + font-size: 1.7em;
  66 + color: white;
  67 + text-transform: uppercase;
  68 + letter-spacing: -1px;
  69 + padding-top: 9px;
  70 + font-weight: bold;
  71 + line-height: 1;
  72 + &:hover {
  73 + color: white;
  74 + text-decoration: none;
  75 + }
  76 +}
  77 +
  78 +/* footer */
  79 +
  80 +footer {
  81 + margin-top: 45px;
  82 + padding-top: 5px;
  83 + border-top: 1px solid $grayMediumLight;
  84 + color: $grayLight;
  85 + a {
  86 + color: $gray;
  87 + &:hover {
  88 + color: $grayDarker;
  89 + }
  90 + }
  91 + small {
  92 + float: left;
  93 + }
  94 + ul {
  95 + float: right;
  96 + list-style: none;
  97 + li {
  98 + float: left;
  99 + margin-left: 10px;
  100 + }
  101 + }
  102 +}
3  app/assets/stylesheets/users.css.scss
... ... @@ -0,0 +1,3 @@
  1 +// Place all the styles related to the Users controller here.
  2 +// They will automatically be included in application.css.
  3 +// You can use Sass (SCSS) here: http://sass-lang.com/
3  app/controllers/static_pages_controller.rb
@@ -7,4 +7,7 @@ def help
7 7
8 8 def about
9 9 end
  10 +
  11 + def contact
  12 + end
10 13 end
4 app/controllers/users_controller.rb
... ... @@ -0,0 +1,4 @@
  1 +class UsersController < ApplicationController
  2 + def new
  3 + end
  4 +end
12 app/helpers/application_helper.rb
... ... @@ -1,2 +1,12 @@
1 1 module ApplicationHelper
2   -end
  2 +
  3 + # Returns the full title on a per-page basis.
  4 + def full_title(page_title)
  5 + base_title = "Ruby on Rails Tutorial Sample App"
  6 + if page_title.empty?
  7 + base_title
  8 + else
  9 + "#{base_title} | #{page_title}"
  10 + end
  11 + end
  12 +end
2  app/helpers/users_helper.rb
... ... @@ -0,0 +1,2 @@
  1 +module UsersHelper
  2 +end
13 app/views/layouts/_footer.html.erb
... ... @@ -0,0 +1,13 @@
14 app/views/layouts/_header.html.erb
... ... @@ -0,0 +1,14 @@
  1 +<header class="navbar navbar-fixed-top">
  2 + <div class="navbar-inner">
  3 + <div class="container">
  4 + <%= link_to "sample app", '#', id: "logo" %>
  5 + <nav>
  6 + <ul class="nav pull-right">
  7 + <li><%= link_to "Home", root_path %></li>
  8 + <li><%= link_to "Help", help_path %></li>
  9 + <li><%= link_to "Sign in", '#' %></li>
  10 + </ul>
  11 + </nav>
  12 + </div>
  13 + </div>
  14 +</header>
3  app/views/layouts/_shim.html.erb
... ... @@ -0,0 +1,3 @@
  1 +<!--[if lt IE 9]>
  2 +<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  3 +<![endif]-->
13 app/views/layouts/application.html.erb
... ... @@ -1,12 +1,17 @@
1 1 <!DOCTYPE html>
2 2 <html>
3 3 <head>
4   - <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
5   - <%= stylesheet_link_tag "application", :media => "all" %>
  4 + <title><%= full_title(yield(:title)) %></title>
  5 + <%= stylesheet_link_tag "application", media: "all" %>
6 6 <%= javascript_include_tag "application" %>
7 7 <%= csrf_meta_tags %>
  8 + <%= render 'layouts/shim' %>
8 9 </head>
9 10 <body>
10   - <%= yield %>
  11 + <%= render 'layouts/header' %>
  12 + <div class="container">
  13 + <%= yield %>
  14 + <%= render 'layouts/footer' %>
  15 + </div>
11 16 </body>
12   -</html>
  17 +</html>
6 app/views/static_pages/contact.html.erb
... ... @@ -0,0 +1,6 @@
  1 +<% provide(:title, 'Contact') %>
  2 +<h1>Contact</h1>
  3 +<p>
  4 + Contact Ruby on Rails Tutorial about the sample app at the
  5 + <a href="http://railstutorial.org/contact">contact page</a>.
  6 +</p>
20 app/views/static_pages/home.html.erb
... ... @@ -1,7 +1,13 @@
1   -<% provide(:title, 'Home') %>
2   -<h1>Sample App</h1>
3   -<p>
4   - This is the home page for the
5   - <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
6   - sample application.
7   -</p>
  1 +<div class="center hero-unit">
  2 + <h1>Welcome to the Sample App</h1>
  3 +
  4 + <h2>
  5 + This is the home page for the
  6 + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  7 + sample application.
  8 + </h2>
  9 +
  10 + <%= link_to "Sign up now!", signup_path, class: "btn btn-large btn-primary" %>
  11 +</div>
  12 +
  13 +<%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org/' %>
3  app/views/users/new.html.erb
... ... @@ -0,0 +1,3 @@
  1 +<% provide(:title, 'Sign up') %>
  2 +<h1>Sign up</h1>
  3 +<p>Find me in app/views/users/new.html.erb</p>
11 config/routes.rb
... ... @@ -1,8 +1,13 @@
1 1 SampleApp::Application.routes.draw do
  2 + get "users/new"
  3 +
  4 + root to: 'static_pages#home'
  5 +
  6 + match '/signup', to: 'users#new'
2 7
3   - get "static_pages/home"
4   - get "static_pages/help"
5   - get "static_pages/about"
  8 + match '/help', to: 'static_pages#help'
  9 + match '/about', to: 'static_pages#about'
  10 + match '/contact', to: 'static_pages#contact'
6 11
7 12 # The priority is based upon order of creation:
8 13 # first created -> highest priority.
241 public/index.html
... ... @@ -1,241 +0,0 @@
1   -<!DOCTYPE html>
2   -<html>
3   - <head>
4   - <title>Ruby on Rails: Welcome aboard</title>
5   - <style type="text/css" media="screen">
6   - body {
7   - margin: 0;
8   - margin-bottom: 25px;
9   - padding: 0;
10   - background-color: #f0f0f0;
11   - font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
12   - font-size: 13px;
13   - color: #333;
14   - }
15   -
16   - h1 {
17   - font-size: 28px;
18   - color: #000;
19   - }
20   -
21   - a {color: #03c}
22   - a:hover {
23   - background-color: #03c;
24   - color: white;
25   - text-decoration: none;
26   - }
27   -
28   -
29   - #page {
30   - background-color: #f0f0f0;
31   - width: 750px;
32   - margin: 0;
33   - margin-left: auto;
34   - margin-right: auto;
35   - }
36   -
37   - #content {
38   - float: left;
39   - background-color: white;
40   - border: 3px solid #aaa;
41   - border-top: none;
42   - padding: 25px;
43   - width: 500px;
44   - }
45   -
46   - #sidebar {
47   - float: right;
48   - width: 175px;
49   - }
50   -
51   - #footer {
52   - clear: both;
53   - }
54   -
55   - #header, #about, #getting-started {
56   - padding-left: 75px;
57   - padding-right: 30px;
58   - }
59   -
60   -
61   - #header {
62   - background-image: url("assets/rails.png");
63   - background-repeat: no-repeat;
64   - background-position: top left;
65   - height: 64px;
66   - }
67   - #header h1, #header h2 {margin: 0}
68   - #header h2 {
69   - color: #888;
70   - font-weight: normal;
71   - font-size: 16px;
72   - }
73   -
74   -
75   - #about h3 {
76   - margin: 0;
77   - margin-bottom: 10px;
78   - font-size: 14px;
79   - }
80   -
81   - #about-content {
82   - background-color: #ffd;
83   - border: 1px solid #fc0;
84   - margin-left: -55px;
85   - margin-right: -10px;
86   - }
87   - #about-content table {
88   - margin-top: 10px;
89   - margin-bottom: 10px;
90   - font-size: 11px;
91   - border-collapse: collapse;
92   - }
93   - #about-content td {
94   - padding: 10px;
95   - padding-top: 3px;
96   - padding-bottom: 3px;
97   - }
98   - #about-content td.name {color: #555}
99   - #about-content td.value {color: #000}
100   -
101   - #about-content ul {
102   - padding: 0;
103   - list-style-type: none;
104   - }
105   -
106   - #about-content.failure {
107   - background-color: #fcc;
108   - border: 1px solid #f00;
109   - }
110   - #about-content.failure p {
111   - margin: 0;
112   - padding: 10px;
113   - }
114   -
115   -
116   - #getting-started {
117   - border-top: 1px solid #ccc;
118   - margin-top: 25px;
119   - padding-top: 15px;
120   - }
121   - #getting-started h1 {
122   - margin: 0;
123   - font-size: 20px;
124   - }
125   - #getting-started h2 {
126   - margin: 0;
127   - font-size: 14px;
128   - font-weight: normal;
129   - color: #333;
130   - margin-bottom: 25px;
131   - }
132   - #getting-started ol {
133   - margin-left: 0;
134   - padding-left: 0;
135   - }
136   - #getting-started li {
137   - font-size: 18px;
138   - color: #888;
139   - margin-bottom: 25px;
140   - }
141   - #getting-started li h2 {
142   - margin: 0;
143   - font-weight: normal;
144   - font-size: 18px;
145   - color: #333;
146   - }
147   - #getting-started li p {
148   - color: #555;
149   - font-size: 13px;
150   - }
151   -
152   -
153   - #sidebar ul {
154   - margin-left: 0;
155   - padding-left: 0;
156   - }
157   - #sidebar ul h3 {
158   - margin-top: 25px;
159   - font-size: 16px;
160   - padding-bottom: 10px;
161   - border-bottom: 1px solid #ccc;
162   - }
163   - #sidebar li {
164   - list-style-type: none;
165   - }
166   - #sidebar ul.links li {
167   - margin-bottom: 5px;
168   - }
169   -
170   - .filename {
171   - font-style: italic;
172   - }
173   - </style>
174   - <script type="text/javascript">
175   - function about() {
176   - info = document.getElementById('about-content');
177   - if (window.XMLHttpRequest)
178   - { xhr = new XMLHttpRequest(); }
179   - else
180   - { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
181   - xhr.open("GET","rails/info/properties",false);
182   - xhr.send("");
183   - info.innerHTML = xhr.responseText;
184   - info.style.display = 'block'
185   - }
186   - </script>
187   - </head>
188   - <body>
189   - <div id="page">
190   - <div id="sidebar">
191   - <ul id="sidebar-items">
192   - <li>
193   - <h3>Browse the documentation</h3>
194   - <ul class="links">
195   - <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
196   - <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
197   - <li><a href="http://www.ruby-doc.org/core/">Ruby core</a></li>
198   - <li><a href="http://www.ruby-doc.org/stdlib/">Ruby standard library</a></li>
199   - </ul>
200   - </li>
201   - </ul>
202   - </div>
203   -
204   - <div id="content">
205   - <div id="header">
206   - <h1>Welcome aboard</h1>
207   - <h2>You&rsquo;re riding Ruby on Rails!</h2>
208   - </div>
209   -
210   - <div id="about">
211   - <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3>
212   - <div id="about-content" style="display: none"></div>
213   - </div>
214   -
215   - <div id="getting-started">
216   - <h1>Getting started</h1>
217   - <h2>Here&rsquo;s how to get rolling:</h2>
218   -
219   - <ol>
220   - <li>
221   - <h2>Use <code>rails generate</code> to create your models and controllers</h2>
222   - <p>To see all available options, run it without parameters.</p>
223   - </li>
224   -
225   - <li>
226   - <h2>Set up a default route and remove <span class="filename">public/index.html</span></h2>
227   - <p>Routes are set up in <span class="filename">config/routes.rb</span>.</p>
228   - </li>
229   -
230   - <li>
231   - <h2>Create your database</h2>
232   - <p>Run <code>rake db:create</code> to create your database. If you're not using SQLite (the default), edit <span class="filename">config/database.yml</span> with your username and password.</p>
233   - </li>
234   - </ol>
235   - </div>
236   - </div>
237   -
238   - <div id="footer">&nbsp;</div>
239   - </div>
240   - </body>
241   -</html>
0  script/rails 100755 → 100644
File mode changed
47 spec/requests/static_pages_spec.rb
@@ -2,45 +2,34 @@
2 2
3 3 describe "Static pages" do
4 4
5   - describe "Home page" do
  5 + subject { page }
6 6
7   - it "should have the h1 'Sample App'" do
8   - visit '/static_pages/home'
9   - page.should have_selector('h1', :text => 'Sample App')
10   - end
  7 + describe "Home page" do
  8 + before { visit root_path }
11 9
12   - it "should have the title 'Home'" do
13   - visit '/static_pages/home'
14   - page.should have_selector('title',
15   - :text => "Ruby on Rails Tutorial Sample App | Home")
16   - end
  10 + it { should have_selector('h1', text: 'Sample App') }
  11 + it { should have_selector('title', text: full_title('')) }
  12 + it { should_not have_selector 'title', text: '| Home' }
17 13 end
18 14
19 15 describe "Help page" do
  16 + before { visit help_path }
20 17
21   - it "should have the h1 'Help'" do
22   - visit '/static_pages/help'
23   - page.should have_selector('h1', :text => 'Help')
24   - end
25   -
26   - it "should have the title 'Help'" do
27   - visit '/static_pages/help'
28   - page.should have_selector('title',
29   - :text => "Ruby on Rails Tutorial Sample App | Help")
30   - end
  18 + it { should have_selector('h1', text: 'Help') }
  19 + it { should have_selector('title', text: full_title('Help')) }
31 20 end
32 21
33 22 describe "About page" do
  23 + before { visit about_path }
  24 +
  25 + it { should have_selector('h1', text: 'About') }
  26 + it { should have_selector('title', text: full_title('About Us')) }
  27 + end
34 28
35   - it "should have the h1 'About'" do
36   - visit '/static_pages/about'
37   - page.should have_selector('h1', :text => 'About Us')
38   - end
  29 + describe "Contact page" do
  30 + before { visit contact_path }
39 31
40   - it "should have the title 'About Us'" do
41   - visit '/static_pages/about'
42   - page.should have_selector('title',
43   - :text => "Ruby on Rails Tutorial Sample App | About Us")
44   - end
  32 + it { should have_selector('h1', text: 'Contact') }
  33 + it { should have_selector('title', text: full_title('Contact')) }
45 34 end
46 35 end
11 spec/requests/user_pages_spec.rb
... ... @@ -0,0 +1,11 @@
  1 +require 'spec_helper'
  2 +
  3 +describe "UserPages" do
  4 + describe "GET /user_pages" do
  5 + # it "works! (now write some real specs)" do
  6 + # # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
  7 + # get user_pages_index_path
  8 + # response.status.should be(200)
  9 + # end
  10 + end
  11 +end
8 spec/support/utilities.rb
... ... @@ -0,0 +1,8 @@
  1 +def full_title(page_title)
  2 + base_title = "Ruby on Rails Tutorial Sample App"
  3 + if page_title.empty?
  4 + base_title
  5 + else
  6 + "#{base_title} | #{page_title}"
  7 + end
  8 +end

No commit comments for this range

Something went wrong with that request. Please try again.