Permalink
Browse files

add bootstrap gem

  • Loading branch information...
1 parent 243be2a commit 2f72880ff49e2270ee3e1da0e45ad0512ffae64b @aunderwo committed Apr 24, 2012
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use ruby-1.9.3-p194@twitter_bootstrap_test
View
@@ -6,6 +6,10 @@ gem 'rails', '3.2.3'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
+gem "rake-compiler"
+gem "rspec"
+gem "twitter-bootstrap-rails"
+
# Gems used only for assets and not required
View
@@ -37,6 +37,8 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.3.1)
+ commonjs (0.2.6)
+ diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.3.0)
multi_json (~> 1.0)
@@ -47,6 +49,13 @@ GEM
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.6)
+ less (2.1.0)
+ commonjs (~> 0.2.0)
+ therubyracer (~> 0.10.0)
+ less-rails (2.2.1)
+ actionpack (>= 3.1)
+ less (~> 2.1.0)
+ libv8 (3.3.10.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -77,8 +86,18 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
+ rake-compiler (0.8.1)
+ rake
rdoc (3.12)
json (~> 1.4)
+ rspec (2.9.0)
+ rspec-core (~> 2.9.0)
+ rspec-expectations (~> 2.9.0)
+ rspec-mocks (~> 2.9.0)
+ rspec-core (2.9.0)
+ rspec-expectations (2.9.1)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.9.0)
sass (3.1.16)
sass-rails (3.2.5)
railties (~> 3.2.0)
@@ -89,11 +108,17 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
+ therubyracer (0.10.1)
+ libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
+ twitter-bootstrap-rails (2.0.6)
+ actionpack (>= 3.1)
+ less-rails (~> 2.2.0)
+ railties (>= 3.1)
tzinfo (0.3.33)
uglifier (1.2.4)
execjs (>= 0.3.0)
@@ -106,6 +131,9 @@ DEPENDENCIES
coffee-rails (~> 3.2.1)
jquery-rails
rails (= 3.2.3)
+ rake-compiler
+ rspec
sass-rails (~> 3.2.3)
sqlite3
+ twitter-bootstrap-rails
uglifier (>= 1.0.3)
@@ -12,4 +12,5 @@
//
//= require jquery
//= require jquery_ujs
+//= require twitter/bootstrap
//= require_tree .
@@ -0,0 +1,4 @@
+jQuery ->
+ $("a[rel=popover]").popover()
+ $(".tooltip").tooltip()
+ $("a[rel=tooltip]").tooltip()
@@ -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,29 @@
+@import "twitter/bootstrap/bootstrap";
+body { padding-top: 60px; }
+
+@import "twitter/bootstrap/responsive";
+
+// Set the correct sprite paths
+@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
+@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
+
+// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
+@fontAwesomeEotPath: asset-path('fontawesome-webfont.eot');
+@fontAwesomeWoffPath: asset-path('fontawesome-webfont.woff');
+@fontAwesomeTtfPath: asset-path('fontawesome-webfont.ttf');
+@fontAwesomeSvgzPath: asset-path('fontawesome-webfont.svgz');
+@fontAwesomeSvgPath: asset-path('fontawesome-webfont.svg');
+
+// Font Awesome
+@import "fontawesome";
+
+// Your custom LESS stylesheets goes here
+//
+// Since bootstrap was imported above you have access to its mixins which
+// you may use and inherit here
+//
+// If you'd like to override bootstrap's own variables, you can do so here as well
+// See http://twitter.github.com/bootstrap/less.html for their names and documentation
+//
+// Example:
+// @linkColor: #ff0000;
@@ -0,0 +1,3 @@
+// Place all the styles related to the posts controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,56 @@
+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: #000; }
+ &: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 PostsController < ApplicationController
+ # GET /posts
+ # GET /posts.json
+ def index
+ @posts = Post.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @posts }
+ end
+ end
+
+ # GET /posts/1
+ # GET /posts/1.json
+ def show
+ @post = Post.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @post }
+ end
+ end
+
+ # GET /posts/new
+ # GET /posts/new.json
+ def new
+ @post = Post.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @post }
+ end
+ end
+
+ # GET /posts/1/edit
+ def edit
+ @post = Post.find(params[:id])
+ end
+
+ # POST /posts
+ # POST /posts.json
+ def create
+ @post = Post.new(params[:post])
+
+ respond_to do |format|
+ if @post.save
+ format.html { redirect_to @post, notice: 'Post was successfully created.' }
+ format.json { render json: @post, status: :created, location: @post }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @post.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /posts/1
+ # PUT /posts/1.json
+ def update
+ @post = Post.find(params[:id])
+
+ respond_to do |format|
+ if @post.update_attributes(params[:post])
+ format.html { redirect_to @post, notice: 'Post was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @post.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /posts/1
+ # DELETE /posts/1.json
+ def destroy
+ @post = Post.find(params[:id])
+ @post.destroy
+
+ respond_to do |format|
+ format.html { redirect_to posts_url }
+ format.json { head :no_content }
+ end
+ end
+end
@@ -0,0 +1,2 @@
+module PostsHelper
+end
View
@@ -0,0 +1,3 @@
+class Post < ActiveRecord::Base
+ attr_accessible :description, :title
+end
@@ -1,14 +1,75 @@
<!DOCTYPE html>
-<html>
-<head>
- <title>TwitterBootstrapTest</title>
- <%= stylesheet_link_tag "application", :media => "all" %>
- <%= javascript_include_tag "application" %>
- <%= csrf_meta_tags %>
-</head>
-<body>
-
-<%= yield %>
-
-</body>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title><%= content_for?(:title) ? yield(:title) : "TwitterBootstrapTest" %></title>
+ <%= csrf_meta_tags %>
+
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
+ <![endif]-->
+
+ <%= stylesheet_link_tag "application", :media => "all" %>
+
+ <link href="images/favicon.ico" rel="shortcut icon">
+ <link href="images/apple-touch-icon.png" rel="apple-touch-icon">
+ <link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72">
+ <link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114">
+ </head>
+ <body>
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </a>
+ <a class="brand" href="#">TwitterBootstrapTest</a>
+ <div class="container nav-collapse">
+ <ul class="nav">
+ <li><%= link_to "Link1", "/path1" %></li>
+ <li><%= link_to "Link2", "/path2" %></li>
+ <li><%= link_to "Link3", "/path3" %></li>
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div>
+ </div>
+ </div>
+
+ <div class="container">
+ <div class="content">
+ <div class="row">
+ <div class="span9">
+ <%= yield %>
+ </div>
+ <div class="span3">
+ <div class="well sidebar-nav">
+ <h3>Sidebar</h3>
+ <ul class="nav nav-list">
+ <li class="nav-header">Sidebar</li>
+ <li><%= link_to "Link1", "/path1" %></li>
+ <li><%= link_to "Link2", "/path2" %></li>
+ <li><%= link_to "Link3", "/path3" %></li>
+ </ul>
+ </div><!--/.well -->
+ </div><!--/span-->
+ </div><!--/row-->
+ </div><!--/content-->
+
+ <footer>
+ <p>&copy; Company 2012</p>
+ </footer>
+
+ </div> <!-- /container -->
+
+ <!-- Javascripts
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <%= javascript_include_tag "application" %>
+
+ </body>
</html>
@@ -0,0 +1,20 @@
+<%= form_for @post, :html => { :class => 'form-horizontal' } do |f| %>
+ <div class="control-group">
+ <%= f.label :title, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :title, :class => 'text_field' %>
+ </div>
+ </div>
+ <div class="control-group">
+ <%= f.label :description, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_area :description, :class => 'text_area' %>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
+ posts_path, :class => 'btn' %>
+ </div>
+<% end %>
@@ -0,0 +1,4 @@
+<%- model_class = @post.class -%>
+<h1><%=t '.title', :default => t('helpers.titles.edit', :model => model_class.model_name.human,
+ :default => "Edit #{model_class.model_name.human}") %></h1>
+<%= render :partial => 'form' %>
Oops, something went wrong.

0 comments on commit 2f72880

Please sign in to comment.