Permalink
Browse files

bootstrap and index page

  • Loading branch information...
1 parent b49a3bb commit 9bd138fd61d73d70f26e97a650ab68533928ca91 @felixtsai committed Oct 4, 2012
View
@@ -2,8 +2,8 @@ source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'rspec-rails'
-gem 'bootstrap-rails'
gem 'bootstrap-sass'
+gem 'twitter-bootstrap-rails'
gem 'thin'
gem 'haml'
gem 'haml-rails'
View
@@ -30,8 +30,6 @@ GEM
multi_json (~> 1.0)
addressable (2.3.2)
arel (3.0.2)
- bootstrap-rails (0.0.7)
- railties (~> 3.1)
bootstrap-sass (2.1.0.0)
builder (3.0.3)
capybara (1.1.2)
@@ -50,6 +48,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.3.3)
+ commonjs (0.2.6)
daemons (1.1.9)
diff-lcs (1.1.3)
erubis (2.7.0)
@@ -88,6 +87,12 @@ GEM
json (1.7.5)
launchy (2.1.2)
addressable (~> 2.3)
+ less (2.2.2)
+ commonjs (~> 0.2.6)
+ less-rails (2.2.3)
+ actionpack (>= 3.1)
+ less (~> 2.2.0)
+ libv8 (3.3.10.4)
libwebsocket (0.1.5)
addressable
listen (0.5.3)
@@ -164,6 +169,8 @@ GEM
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
sys-proctable (0.9.1)
+ therubyracer (0.10.2)
+ libv8 (~> 3.3.10)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@@ -173,6 +180,11 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
+ twitter-bootstrap-rails (2.1.3)
+ actionpack (>= 3.1)
+ less-rails (~> 2.2.3)
+ railties (>= 3.1)
+ therubyracer (~> 0.10.2)
tzinfo (0.3.33)
uglifier (1.3.0)
execjs (>= 0.3.0)
@@ -184,7 +196,6 @@ PLATFORMS
ruby
DEPENDENCIES
- bootstrap-rails
bootstrap-sass
capybara
coffee-rails (~> 3.2.1)
@@ -208,4 +219,5 @@ DEPENDENCIES
spork
sqlite3
thin
+ twitter-bootstrap-rails
uglifier (>= 1.0.3)
@@ -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/
@@ -0,0 +1,47 @@
+@import "bootstrap";
+
+.container {
+ width: 1000px;
+ margin-left : auto;
+ margin-right : auto;
+}
+
+body {
+ padding-top: 60px;
+}
+
+#error_explanation {
+ padding-top: 5px;
+ color: #f00;
+ ul {
+ list-style: none;
+ margin: 0 0 18px 0;
+ }
+}
+
+.span9 {
+ margin-left: 50px
+}
+
+
+.label a {
+ color: white;
+ text-decoration: none;
+ &:visited {
+ color: #FFF;
+ }
+}
+
+.btn-group {
+ display:inline-block;
+}
+
+#person_table {
+ height: 30px;
+ width: 400px;
+ text-align: left;
+}
+
+#person_button {
+ margin: 0px;
+}
@@ -0,0 +1,3 @@
+// Place all the styles related to the People controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,69 @@
+body {
+ background-color: #fff;
+ color: #333;
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px;
+}
+
+p, ol, ul, td {
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px;
+}
+
+pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px;
+}
+
+a {
+ color: #000;
+ &:visited {
+ color: #666;
+ }
+ &:hover {
+ color: #fff;
+ background-color: #000;
+ }
+}
+
+div {
+ &.field, &.actions {
+ margin-bottom: 10px;
+ }
+}
+
+#notice {
+ color: green;
+}
+
+.field_with_errors {
+ padding: 2px;
+ background-color: red;
+ display: table;
+}
+
+#error_explanation {
+ width: 450px;
+ border: 2px solid red;
+ padding: 7px;
+ padding-bottom: 0;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 5px 5px 15px;
+ font-size: 12px;
+ margin: -7px;
+ margin-bottom: 0px;
+ background-color: #c00;
+ color: #fff;
+ }
+ ul li {
+ font-size: 12px;
+ list-style: square;
+ }
+}
@@ -0,0 +1,83 @@
+class PeopleController < ApplicationController
+ # GET /people
+ # GET /people.json
+ def index
+ @people = Person.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @people }
+ end
+ end
+
+ # GET /people/1
+ # GET /people/1.json
+ def show
+ @person = Person.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @person }
+ end
+ end
+
+ # GET /people/new
+ # GET /people/new.json
+ def new
+ @person = Person.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @person }
+ end
+ end
+
+ # GET /people/1/edit
+ def edit
+ @person = Person.find(params[:id])
+ end
+
+ # POST /people
+ # POST /people.json
+ def create
+ @person = Person.new(params[:person])
+
+ respond_to do |format|
+ if @person.save
+ format.html { redirect_to @person, notice: 'Person was successfully created.' }
+ format.json { render json: @person, status: :created, location: @person }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @person.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /people/1
+ # PUT /people/1.json
+ def update
+ @person = Person.find(params[:id])
+
+ respond_to do |format|
+ if @person.update_attributes(params[:person])
+ format.html { redirect_to @person, notice: 'Person was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @person.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /people/1
+ # DELETE /people/1.json
+ def destroy
+ @person = Person.find(params[:id])
+ @person.destroy
+
+ respond_to do |format|
+ format.html { redirect_to people_url }
+ format.json { head :no_content }
+ end
+ end
+end
@@ -0,0 +1,2 @@
+module PeopleHelper
+end
View
@@ -0,0 +1,3 @@
+class Person < ActiveRecord::Base
+ attr_accessible :height, :name, :sex, :weight
+end
@@ -7,8 +7,30 @@
<%= csrf_meta_tags %>
</head>
<body>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <%= link_to "Miss Cleo", root_path, class: 'brand' %>
+ <ul class="nav">
-<%= yield %>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ Assignments
+ <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li><%= link_to "People List", people_path %></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+<div class="span9">
+ <%= yield %>
+</div>
+</div>
</body>
</html>
@@ -0,0 +1,22 @@
+= form_for @person do |f|
+ - if @person.errors.any?
+ #error_explanation
+ %h2= "#{pluralize(@person.errors.count, "error")} prohibited this person from being saved:"
+ %ul
+ - @person.errors.full_messages.each do |msg|
+ %li= msg
+
+ .field
+ = f.label :name
+ = f.text_field :name
+ .field
+ = f.label :height
+ = f.number_field :height
+ .field
+ = f.label :weight
+ = f.number_field :weight
+ .field
+ = f.label :sex
+ = f.text_field :sex
+ .actions
+ = f.submit 'Save'
@@ -0,0 +1,7 @@
+%h1 Editing person
+
+= render 'form'
+
+= link_to 'Show', @person
+\|
+= link_to 'Back', people_path
@@ -0,0 +1,30 @@
+%h3 Height, Weight and Gender Data Set
+
+%table.table-striped#person_table
+ %thead
+ %tr
+ %th Name
+ %th Height
+ %th Weight
+ %th Sex
+
+ - @people.each do |person|
+ %tr
+ %td= person.name
+ %td= person.height
+ %td= person.weight
+ %td= person.sex
+ %td
+ .span.label.label-success
+ = link_to 'Show', person
+ %td
+ .span.label.label-info
+ = link_to 'Edit', edit_person_path(person)
+ %td
+ .span.label.label-important
+ = link_to 'Destroy', person, method: :delete, data: { confirm: 'Are you sure?' }
+
+%br
+
+.span.label.label-inverse#person_button
+ = link_to 'New Person', new_person_path
@@ -0,0 +1,5 @@
+%h1 New person
+
+= render 'form'
+
+= link_to 'Back', people_path
Oops, something went wrong.

0 comments on commit 9bd138f

Please sign in to comment.