Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: safalmj/sample_app
base: 95ba7d8156
...
head fork: safalmj/sample_app
compare: b765c0f07d
Checking mergeability… Don't worry, you can still create the pull request.
  • 6 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
View
57 app/assets/stylesheets/custom.css.scss
@@ -1,5 +1,8 @@
@import "bootstrap";
+/* mixins, variables, etc. */
+$grayLight: #999;
+
/* universal */
html {
@@ -28,6 +31,7 @@ textarea {
/* typography */
+
h1, h2, h3, h4, h5, h6 {
line-height: 1;
}
@@ -45,7 +49,7 @@ h2 {
margin-bottom: 30px;
text-align: center;
font-weight: normal;
- color: #999;
+ color: $grayLight;
}
p {
@@ -65,12 +69,13 @@ p {
padding-top: 9px;
font-weight: bold;
line-height: 1;
+ &:hover {
+ color: #fff;
+ text-decoration: none
+ }
}
-#logo:hover {
- color: #fff;
- text-decoration: none;
-}
+
/* footer */
@@ -78,27 +83,23 @@ footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid #eaeaea;
- color: #999;
-}
-
-footer a {
- color: #555;
-}
-
-footer a:hover {
- color: #222;
-}
-
-footer small {
- float: left;
-}
-
-footer ul {
- float: right;
- list-style: none;
-}
-
-footer ul li {
- float: left;
- margin-left: 10px;
+ color: $grayLight;
+ a {
+ color: #555;
+ &:hover {
+ color: #222;
+ }
+ }
+ small {
+ float: left;
+ }
+
+ ul {
+ float: right;
+ list-style: none;
+ li {
+ float: left;
+ margin-left: 10px;
+ }
+ }
}
View
3  app/controllers/static_pages_controller.rb
@@ -7,4 +7,7 @@ def help
def about
end
+
+ def contact
+ end
end
View
4 app/views/layouts/_footer.html.erb
@@ -5,8 +5,8 @@
</small>
<nav>
<ul>
- <li><%= link_to "About", '#' %></li>
- <li><%= link_to "Contact", '#' %></li>
+ <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>
View
6 app/views/layouts/_header.html.erb
@@ -1,11 +1,11 @@
<header class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
- <%= link_to "sample app", '#', :id => "logo" %>
+ <%= link_to "sample app", root_path, :id => "logo" %>
<nav>
<ul class="nav pull-right">
- <li><%= link_to "Home", '#' %></li>
- <li><%= link_to "Help", '#' %></li>
+ <li><%= link_to "Home", root_path %></li>
+ <li><%= link_to "Help", help_path %></li>
<li><%= link_to "Sign in", '#' %></li>
</ul>
</nav>
View
0  app/views/layouts/gemfile
No changes.
View
0  app/views/layouts/route
No changes.
View
0  app/views/layouts/route.rb
No changes.
View
7 app/views/static_pages/contact.html.erb
@@ -0,0 +1,7 @@
+<% provide(:title, "Contact") %>
+<h1>Contact</h1>
+<p>
+<p>
+ Contact Ruby on Rails Tutorial about the sample app at the
+ <a href="http://railstutorial.org/contact">contact page</a>.
+</p>
View
9 config/routes.rb
@@ -1,8 +1,9 @@
SampleApp::Application.routes.draw do
- root :to => "staticPages#home"
- get "static_pages/home"
- get "static_pages/help"
- get "/static_pages/about"
+ root :to => "static_pages#home"
+
+ match "/help", :to => "static_pages#help"
+ match "/about", :to => "static_pages#about"
+ match "/contact", :to => "static_pages#contact"
# The priority is based upon order of creation:
# first created -> highest priority.
View
241 public/index.html
@@ -1,241 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Ruby on Rails: Welcome aboard</title>
- <style type="text/css" media="screen">
- body {
- margin: 0;
- margin-bottom: 25px;
- padding: 0;
- background-color: #f0f0f0;
- font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
- font-size: 13px;
- color: #333;
- }
-
- h1 {
- font-size: 28px;
- color: #000;
- }
-
- a {color: #03c}
- a:hover {
- background-color: #03c;
- color: white;
- text-decoration: none;
- }
-
-
- #page {
- background-color: #f0f0f0;
- width: 750px;
- margin: 0;
- margin-left: auto;
- margin-right: auto;
- }
-
- #content {
- float: left;
- background-color: white;
- border: 3px solid #aaa;
- border-top: none;
- padding: 25px;
- width: 500px;
- }
-
- #sidebar {
- float: right;
- width: 175px;
- }
-
- #footer {
- clear: both;
- }
-
- #header, #about, #getting-started {
- padding-left: 75px;
- padding-right: 30px;
- }
-
-
- #header {
- background-image: url("assets/rails.png");
- background-repeat: no-repeat;
- background-position: top left;
- height: 64px;
- }
- #header h1, #header h2 {margin: 0}
- #header h2 {
- color: #888;
- font-weight: normal;
- font-size: 16px;
- }
-
-
- #about h3 {
- margin: 0;
- margin-bottom: 10px;
- font-size: 14px;
- }
-
- #about-content {
- background-color: #ffd;
- border: 1px solid #fc0;
- margin-left: -55px;
- margin-right: -10px;
- }
- #about-content table {
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 11px;
- border-collapse: collapse;
- }
- #about-content td {
- padding: 10px;
- padding-top: 3px;
- padding-bottom: 3px;
- }
- #about-content td.name {color: #555}
- #about-content td.value {color: #000}
-
- #about-content ul {
- padding: 0;
- list-style-type: none;
- }
-
- #about-content.failure {
- background-color: #fcc;
- border: 1px solid #f00;
- }
- #about-content.failure p {
- margin: 0;
- padding: 10px;
- }
-
-
- #getting-started {
- border-top: 1px solid #ccc;
- margin-top: 25px;
- padding-top: 15px;
- }
- #getting-started h1 {
- margin: 0;
- font-size: 20px;
- }
- #getting-started h2 {
- margin: 0;
- font-size: 14px;
- font-weight: normal;
- color: #333;
- margin-bottom: 25px;
- }
- #getting-started ol {
- margin-left: 0;
- padding-left: 0;
- }
- #getting-started li {
- font-size: 18px;
- color: #888;
- margin-bottom: 25px;
- }
- #getting-started li h2 {
- margin: 0;
- font-weight: normal;
- font-size: 18px;
- color: #333;
- }
- #getting-started li p {
- color: #555;
- font-size: 13px;
- }
-
-
- #sidebar ul {
- margin-left: 0;
- padding-left: 0;
- }
- #sidebar ul h3 {
- margin-top: 25px;
- font-size: 16px;
- padding-bottom: 10px;
- border-bottom: 1px solid #ccc;
- }
- #sidebar li {
- list-style-type: none;
- }
- #sidebar ul.links li {
- margin-bottom: 5px;
- }
-
- .filename {
- font-style: italic;
- }
- </style>
- <script type="text/javascript">
- function about() {
- info = document.getElementById('about-content');
- if (window.XMLHttpRequest)
- { xhr = new XMLHttpRequest(); }
- else
- { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
- xhr.open("GET","rails/info/properties",false);
- xhr.send("");
- info.innerHTML = xhr.responseText;
- info.style.display = 'block'
- }
- </script>
- </head>
- <body>
- <div id="page">
- <div id="sidebar">
- <ul id="sidebar-items">
- <li>
- <h3>Browse the documentation</h3>
- <ul class="links">
- <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
- <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
- <li><a href="http://www.ruby-doc.org/core/">Ruby core</a></li>
- <li><a href="http://www.ruby-doc.org/stdlib/">Ruby standard library</a></li>
- </ul>
- </li>
- </ul>
- </div>
-
- <div id="content">
- <div id="header">
- <h1>Welcome aboard</h1>
- <h2>You&rsquo;re riding Ruby on Rails!</h2>
- </div>
-
- <div id="about">
- <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3>
- <div id="about-content" style="display: none"></div>
- </div>
-
- <div id="getting-started">
- <h1>Getting started</h1>
- <h2>Here&rsquo;s how to get rolling:</h2>
-
- <ol>
- <li>
- <h2>Use <code>rails generate</code> to create your models and controllers</h2>
- <p>To see all available options, run it without parameters.</p>
- </li>
-
- <li>
- <h2>Set up a default route and remove <span class="filename">public/index.html</span></h2>
- <p>Routes are set up in <span class="filename">config/routes.rb</span>.</p>
- </li>
-
- <li>
- <h2>Create your database</h2>
- <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>
- </li>
- </ol>
- </div>
- </div>
-
- <div id="footer">&nbsp;</div>
- </div>
- </body>
-</html>
View
53 spec/requests/static_pages_spec.rb
@@ -5,54 +5,59 @@
describe "Home page" do
it "should have the h1 'Sample App'" do
- visit '/static_pages/home'
+ visit root_path
#page.should have_content('Sample App')
page.should have_selector('h1',
:text => 'Sample App')
end
- # it "should have title page 'Home'" do
- # visit '/static_pages/home'
- # page.should have_selector('title',
- # :text => "#{base_title} | Home")
- # end
-
- it "should have base title" do
- visit '/static_pages/home'
+ it "should have the title 'Home'" do
+ visit root_path
page.should have_selector('title',
- :text => "#{base_title}")
- end
-
- it "shoudl have custom page title" do
- visit '/static_pages/home'
- page.should have_selector('title', :text => 'Home')
+ :text => "#{base_title} | Home")
end
end
describe "Help page" do
it "should have the h1 'Help'" do
- visit '/static_pages/help'
+ visit help_path
page.should have_selector('h1',
:text => 'Help')
end
- it "should have title 'Help'" do
- visit '/static_pages/help'
+ it "should have the title 'Help'" do
+ visit help_path
page.should have_selector('title',
:text => "#{base_title} | Help")
end
end
describe "About Us" do
- it "should have the content 'About us'" do
- visit "/static_pages/about"
- page.should have_content('About Us')
+ it "should have the h1 'About us'" do
+ visit about_path
+ page.should have_selector('h1',
+ :text => "About")
end
- it "should have title 'About Us'" do
- visit "/static_pages/about"
+ it "should have the title 'About Us'" do
+ visit about_path
page.should have_selector('title',
- :text =>"#{base_title} | About")
+ :text => "#{base_title} | About")
end
end
+
+ describe "Contact Page" do
+ it "should have the h1 'Contact'" do
+ visit contact_path
+ page.should have_selector('h1',
+ :text => "Contact")
+ end
+
+ it "should have the title 'Contact'" do
+ visit contact_path
+ page.should have_selector('title',
+ :text => "#{base_title} | Contact")
+ end
+
+ end
end

No commit comments for this range

Something went wrong with that request. Please try again.