Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

chapter 5, till 5.1.3 but with not clean interface

  • Loading branch information...
commit b20edae202c898455455ea0e9a8c34d098801702 1 parent 880f683
Hakim Hanif authored
6 Gemfile
View
@@ -1,9 +1,11 @@
source 'https://rubygems.org'
-ruby '2.0.0'
+ruby '2.1.1'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.5'
+gem 'bootstrap-sass', '3.1.1'
+
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
@@ -16,7 +18,7 @@ group :test do
gem 'capybara', '2.1.0'
end
-gem 'sass-rails', '4.0.1'
+gem 'sass-rails', '4.0.3'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
16 Gemfile.lock
View
@@ -26,6 +26,8 @@ GEM
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.2)
+ bootstrap-sass (3.1.1.0)
+ sass (~> 3.2)
builder (3.1.4)
capybara (2.1.0)
mime-types (>= 1.16)
@@ -136,11 +138,12 @@ GEM
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rubyzip (0.9.9)
- sass (3.3.7)
- sass-rails (4.0.1)
+ sass (3.2.19)
+ sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
- sass (>= 3.1.10)
- sprockets-rails (~> 2.0.0)
+ sass (~> 3.2.0)
+ sprockets (~> 2.8, <= 2.11.0)
+ sprockets-rails (~> 2.0)
sdoc (0.3.20)
json (>= 1.1.3)
rdoc (~> 3.10)
@@ -154,7 +157,7 @@ GEM
spork-rails (4.0.0)
rails (>= 3.0.0, < 5)
spork (>= 1.0rc0)
- sprockets (2.12.1)
+ sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
@@ -185,6 +188,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ bootstrap-sass (= 3.1.1)
capybara (= 2.1.0)
coffee-rails (= 4.0.1)
guard-rspec (= 2.5.0)
@@ -194,7 +198,7 @@ DEPENDENCIES
rails (= 4.0.5)
rails_12factor (= 0.0.2)
rspec-rails (= 2.13.1)
- sass-rails (= 4.0.1)
+ sass-rails (= 4.0.3)
sdoc (= 0.3.20)
selenium-webdriver (= 2.35.1)
spork-rails (= 4.0.0)
BIN  app/assets/images/rails.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 app/assets/stylesheets/custom.css.scss
View
@@ -0,0 +1,105 @@
+@import "bootstrap";
+
+/* universal */
+
+html {
+ overflow-y: scroll;
+}
+
+body {
+ padding-top: 50px;
+}
+
+section {
+ overflow: auto;
+}
+
+textarea {
+ resize: vertical;
+}
+
+.center {
+ text-align: center;
+}
+
+.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.2em;
+ letter-spacing: -1px;
+ margin-bottom: 30px;
+ text-align: center;
+ font-weight: normal;
+ color: #999;
+}
+
+p {
+ font-size: 1.1em;
+ line-height: 1.7em;
+}
+
+/* header */
+
+#logo {
+ float: left;
+ margin-right: 10px;
+ font-size: 1.7em;
+ color: #fff;
+ text-transform: uppercase;
+ letter-spacing: -1px;
+ padding-top: 9px;
+ font-weight: bold;
+ line-height: 1;
+}
+
+#logo:hover {
+ color: #fff;
+ text-decoration: none;
+}
+
+/* footer */
+
+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;
+}
13 app/views/layouts/_footer.html.erb
View
@@ -0,0 +1,13 @@
+
+<footer class="footer">
+ <small>
+ <a href="http://railstutorial.org/">Rails Tutorial</a>
+ </small>
+ <nav>
+ <ul>
+ <li><%= link_to "About", '#' %></li>
+ <li><%= link_to "Contact", '#' %></li>
+ <li><a href="http://news.railstutorial.org/">News</a></li>
+ </ul>
+ </nav>
+</footer>
14 app/views/layouts/_header.html.erb
View
@@ -0,0 +1,14 @@
+<header class="navbar navbar-fixed-top navbar-inverse">
+ <div class="navbar-inner">
+ <div class="container">
+ <%= link_to "sample app", '#', id: "logo" %>
+ <nav>
+ <ul class="nav pull-right">
+ <li><%= link_to "Home", '#' %></li>
+ <li><%= link_to "Help", '#' %></li>
+ <li><%= link_to "Sign in", '#' %></li>
+ </ul>
+ </nav>
+ </div>
+ </div>
+</header>
3  app/views/layouts/_shim.html.erb
View
@@ -0,0 +1,3 @@
+<!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+<![endif]-->
26 app/views/layouts/application.html.erb
View
@@ -1,14 +1,18 @@
<!DOCTYPE html>
<html>
-<head>
- <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
- <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
- <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
- <%= csrf_meta_tags %>
-</head>
-<body>
-
-<%= yield %>
-
-</body>
+ <head>
+ <title><%= yield(:title) %></title>
+ <%= stylesheet_link_tag "application", media: "all",
+ "data-turbolinks-track" => true %>
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
+ <%= csrf_meta_tags %>
+ <%= render 'layouts/shim' %>
+ </head>
+ <body>
+ <%= render 'layouts/header' %>
+ <div class="container">
+ <%= yield %>
+ <%= render 'layouts/footer' %>
+ </div>
+ </body>
</html>
17 app/views/static_pages/home.html.erb
View
@@ -1,7 +1,12 @@
<% provide(:title, 'Home') %>
-<h1>Sample App</h1>
-<p>
- This is the home page for the
- <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
- sample application.
-</p>
+<div class="center hero-unit">
+ <h1>Welcome to the Sample App</h1>
+ <h2>
+ This is the home page for the
+ <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
+ sample application.
+ </h2>
+ <%= link_to "Sign up now!", '#', class: "btn btn-large btn-primary" %>
+</div>
+
+<%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org/' %>
1  config/application.rb
View
@@ -24,5 +24,6 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
+ config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.