add home page

This commit is contained in:
2013-01-07 14:33:44 +08:00
parent 7b57c0639d
commit 76285d43db
39 changed files with 313 additions and 271 deletions
+6
View File
@@ -40,8 +40,14 @@ gem 'jquery-rails'
group :development, :test do
gem 'rspec-rails'
gem 'github'
gem 'tddium'
gem "rails_best_practices", "~> 1.11.1"
gem "flay"
gem 'simplecov'
gem 'machinist'
gem 'cucumber-rails' , :require => false
gem 'capybara'
gem 'database_cleaner'
gem 'selenium-webdriver'
end
+59
View File
@@ -28,9 +28,19 @@ GEM
activesupport (3.2.10)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
arel (3.0.2)
awesome_print (1.1.0)
builder (3.0.4)
capybara (2.0.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
childprocess (0.3.6)
ffi (~> 1.0, >= 1.0.6)
code_analyzer (0.3.0)
sexp_processor
coffee-rails (3.2.2)
@@ -41,22 +51,45 @@ GEM
execjs
coffee-script-source (1.4.0)
colored (1.2)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
cucumber-rails (1.3.0)
capybara (>= 1.1.2)
cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
daemons (1.1.9)
database_cleaner (0.9.1)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
multi_json (~> 1.0)
ffi (1.2.0)
flay (2.0.0)
ruby_parser (~> 3.0.0)
sexp_processor (~> 4.0)
gherkin (2.11.5)
json (>= 1.4.6)
github (0.1.1)
highline (1.6.15)
hike (1.2.1)
httparty (0.8.3)
multi_json (~> 1.0)
multi_xml
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.6)
launchy (2.1.2)
addressable (~> 2.3)
libwebsocket (0.1.7.1)
addressable
websocket
machinist (2.0)
mail (2.4.4)
i18n (>= 0.4.0)
@@ -64,6 +97,8 @@ GEM
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.5.0)
multi_xml (0.5.1)
nokogiri (1.5.5)
pg (0.14.1)
polyglot (0.3.3)
progressbar (0.11.0)
@@ -115,11 +150,17 @@ GEM
rspec (~> 2.11.0)
ruby_parser (3.0.1)
sexp_processor (~> 4.1)
rubyzip (0.9.9)
sass (3.2.5)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.27.2)
childprocess (>= 0.2.5)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
sexp_processor (4.1.2)
simplecov (0.7.1)
multi_json (~> 1.0)
@@ -133,6 +174,15 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
tddium (1.5.8)
highline
json
launchy
tddium_client (~> 0.2.0)
thor
tddium_client (0.2.0)
httparty (>= 0.8.1)
json
temple (0.4.1)
thin (1.5.0)
daemons (>= 1.0.9)
@@ -147,13 +197,20 @@ GEM
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
websocket (1.0.4)
xpath (1.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
capybara
coffee-rails (~> 3.2.1)
cucumber-rails
database_cleaner
flay
github
jquery-rails
machinist
pg
@@ -161,7 +218,9 @@ DEPENDENCIES
rails_best_practices (~> 1.11.1)
rspec-rails
sass-rails (~> 3.2.3)
selenium-webdriver
simplecov
slim
tddium
thin
uglifier (>= 1.0.3)
+3
View File
@@ -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/
+3
View File
@@ -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/
+3
View File
@@ -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/
+16 -13
View File
@@ -1,13 +1,16 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
body {
padding-top: 60px;
padding-bottom: 40px;
text-shadow: white 0 1px 0;
font-weight: 100;
}
.main{
min-height: 500px;
}
#footer{
background-color: whiteSmoke;
height: 60px;
padding-bottom: 0;
}
+3
View File
@@ -0,0 +1,3 @@
// Place all the styles related to the Book controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+3
View File
@@ -0,0 +1,3 @@
// Place all the styles related to the Home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+3
View File
@@ -0,0 +1,3 @@
// Place all the styles related to the User controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+2
View File
@@ -0,0 +1,2 @@
class BookController < ApplicationController
end
+6
View File
@@ -0,0 +1,6 @@
class HomeController < ApplicationController
def index
end
end
+2
View File
@@ -0,0 +1,2 @@
class UserController < ApplicationController
end
+2
View File
@@ -0,0 +1,2 @@
module BookHelper
end
+2
View File
@@ -0,0 +1,2 @@
module HomeHelper
end
+2
View File
@@ -0,0 +1,2 @@
module UserHelper
end
+3 -1
View File
@@ -1,3 +1,5 @@
class Book < ActiveRecord::Base
attr_accessible :author, :image, :isbn, :name
attr_accessible :author, :image, :isbn, :name, :users
has_many :users
end
+2 -1
View File
@@ -1,3 +1,4 @@
class User < ActiveRecord::Base
attr_accessible :email, :name
attr_accessible :email, :name, :books
has_many :books
end
+6
View File
@@ -0,0 +1,6 @@
class UserToBook < ActiveRecord::Base
belongs_to :user
belongs_to :book
end
+1
View File
@@ -0,0 +1 @@
p Hello
-14
View File
@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Libr</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
+35
View File
@@ -0,0 +1,35 @@
doctype html
html
head
title Ocelots
link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"
= stylesheet_link_tag '/bootstrap/css/bootstrap.min.css'
= stylesheet_link_tag '/bootstrap/css/bootstrap-responsive.min.css'
= stylesheet_link_tag 'application', media: 'all'
= csrf_meta_tags
= yield :style_includes
body
div.navbar.navbar-fixed-top
div.navbar-inner
div.container
a.brand href="/" Home
div.nav
ul.nav
li
a href="" books
ul.nav.pull-right
li
a href="" logout
div.container.main
= yield
div#footer
div.container
p.muted.credit 2013 ThoughtWorks
= javascript_include_tag 'application'
= javascript_include_tag '/bootstrap/js/bootstrap.min.js'
= yield :javascript_includes
+3
View File
@@ -1,4 +1,7 @@
Libr::Application.routes.draw do
root to:'home#index'
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -0,0 +1,10 @@
class CreateUserToBooks < ActiveRecord::Migration
def change
create_table :user_to_books do |t|
t.integer :user_id
t.integer :book_id
t.timestamps
end
end
end
+8 -1
View File
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130107031555) do
ActiveRecord::Schema.define(:version => 20130107052141) do
create_table "books", :force => true do |t|
t.string "name"
@@ -22,6 +22,13 @@ ActiveRecord::Schema.define(:version => 20130107031555) do
t.datetime "updated_at", :null => false
end
create_table "user_to_books", :force => true do |t|
t.integer "user_id"
t.integer "book_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|
t.string "email"
t.string "name"
-241
View File
@@ -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>
@@ -0,0 +1,5 @@
require 'spec_helper'
describe BookControllerController do
end
+5
View File
@@ -0,0 +1,5 @@
require 'spec_helper'
describe BookController do
end
@@ -0,0 +1,5 @@
require 'spec_helper'
describe HomeControllerController do
end
+5
View File
@@ -0,0 +1,5 @@
require 'spec_helper'
describe HomeController do
end
@@ -0,0 +1,5 @@
require 'spec_helper'
describe UserControllerController do
end
+5
View File
@@ -0,0 +1,5 @@
require 'spec_helper'
describe UserController do
end
@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the BookControllerHelper. For example:
#
# describe BookControllerHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe BookControllerHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
+15
View File
@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the BookHelper. For example:
#
# describe BookHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe BookHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the HomeControllerHelper. For example:
#
# describe HomeControllerHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe HomeControllerHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
+15
View File
@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the HomeHelper. For example:
#
# describe HomeHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe HomeHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the UserControllerHelper. For example:
#
# describe UserControllerHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe UserControllerHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
+15
View File
@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the UserHelper. For example:
#
# describe UserHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe UserHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
+5
View File
@@ -0,0 +1,5 @@
require 'spec_helper'
describe UserToBook do
pending "add some examples to (or delete) #{__FILE__}"
end
@@ -0,0 +1,5 @@
require 'spec_helper'
describe "user_controller/BookController.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end