Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bootstrap added with Application layout set to work with bootstrap

  • Loading branch information...
commit 123f73a96265804f0082ee89505a38f88f5e1bc8 1 parent 3dc592f
shardul mohite authored
View
2  Gemfile
@@ -14,6 +14,8 @@ group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
+ gem 'twitter-bootstrap-rails','2.0.4'
+
end
gem 'jquery-rails'
View
15 Gemfile.lock
@@ -39,6 +39,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
+ commonjs (0.2.5)
erubis (2.7.0)
execjs (1.3.0)
multi_json (~> 1.0)
@@ -48,6 +49,13 @@ GEM
railties (~> 3.0)
thor (~> 0.14)
json (1.6.6)
+ less (2.0.11)
+ commonjs (~> 0.2.0)
+ therubyracer (~> 0.9.9)
+ less-rails (2.1.8)
+ actionpack (>= 3.1)
+ less (~> 2.0.7)
+ libv8 (3.3.10.4)
mail (2.3.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -93,6 +101,8 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
+ therubyracer (0.9.10)
+ libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
@@ -100,6 +110,10 @@ GEM
polyglot (>= 0.3.1)
turn (0.8.3)
ansi
+ twitter-bootstrap-rails (2.0.4)
+ actionpack (>= 3.1)
+ less-rails (~> 2.1.8)
+ railties (>= 3.1)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
@@ -115,4 +129,5 @@ DEPENDENCIES
rails (= 3.1.3)
sass-rails (~> 3.1.5)
turn (~> 0.8.3)
+ twitter-bootstrap-rails (= 2.0.4)
uglifier (>= 1.0.3)
View
1  app/assets/javascripts/application.js
@@ -6,4 +6,5 @@
//
//= require jquery
//= require jquery_ujs
+//= require twitter/bootstrap
//= require_tree .
View
4 app/assets/javascripts/bootstrap.js.coffee
@@ -0,0 +1,4 @@
+jQuery ->
+ $("a[rel=popover]").popover()
+ $(".tooltip").tooltip()
+ $("a[rel=tooltip]").tooltip()
View
3  app/assets/javascripts/projects.js.coffee
@@ -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/
View
19 app/assets/stylesheets/bootstrap_and_overrides.css.less
@@ -0,0 +1,19 @@
+@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');
+
+// 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;
View
3  app/assets/stylesheets/projects.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the projects controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
View
0  app/assets/stylesheets/scaffolds.css.scss
No changes.
View
83 app/controllers/projects_controller.rb
@@ -0,0 +1,83 @@
+class ProjectsController < ApplicationController
+ # GET /projects
+ # GET /projects.json
+ def index
+ @projects = Project.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @projects }
+ end
+ end
+
+ # GET /projects/1
+ # GET /projects/1.json
+ def show
+ @project = Project.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @project }
+ end
+ end
+
+ # GET /projects/new
+ # GET /projects/new.json
+ def new
+ @project = Project.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @project }
+ end
+ end
+
+ # GET /projects/1/edit
+ def edit
+ @project = Project.find(params[:id])
+ end
+
+ # POST /projects
+ # POST /projects.json
+ def create
+ @project = Project.new(params[:project])
+
+ respond_to do |format|
+ if @project.save
+ format.html { redirect_to @project, notice: 'Project was successfully created.' }
+ format.json { render json: @project, status: :created, location: @project }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @project.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /projects/1
+ # PUT /projects/1.json
+ def update
+ @project = Project.find(params[:id])
+
+ respond_to do |format|
+ if @project.update_attributes(params[:project])
+ format.html { redirect_to @project, notice: 'Project was successfully updated.' }
+ format.json { head :ok }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @project.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /projects/1
+ # DELETE /projects/1.json
+ def destroy
+ @project = Project.find(params[:id])
+ @project.destroy
+
+ respond_to do |format|
+ format.html { redirect_to projects_url }
+ format.json { head :ok }
+ end
+ end
+end
View
2  app/helpers/projects_helper.rb
@@ -0,0 +1,2 @@
+module ProjectsHelper
+end
View
2  app/models/project.rb
@@ -0,0 +1,2 @@
+class Project < ActiveRecord::Base
+end
View
53 app/views/layouts/application.html.erb
@@ -1,14 +1,57 @@
<!DOCTYPE html>
<html>
<head>
- <title>AppLauncher</title>
- <%= stylesheet_link_tag "application" %>
- <%= javascript_include_tag "application" %>
- <%= csrf_meta_tags %>
+ <title>AppLauncher</title>
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
+ <![endif]-->
+ <%= stylesheet_link_tag "application" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </a>
-<%= yield %>
+ <!-- Be sure to leave the brand out there if you want it shown -->
+ <%= link_to "AppLauncher" , projects_path , :class => "brand" %>
+
+ <!-- Everything you want hidden at 940px or less, place within here -->
+ <div class="nav-collapse">
+ <ul class="nav">
+ <li><%= link_to "My Projects" , projects_path %></li>
+ <li><%= link_to "Create New Projects" , new_project_path %></li>
+ <li><%= link_to "Accounts "%></li>
+ </ul>
+
+ <!-- .nav, .navbar-search, .navbar-form, etc -->
+ </div>
+
+ </div>
+ </div>
+ </div>
+ <div class="container">
+ <div class="row">
+ <div class="span9">
+ <%= yield %>
+ </div>
+ <div class="span3">
+ <h2>About AppLauncher</h2>
+ <p>
+ AppLauncher would save you atleast a day efforts ! If you are agile Practitioner and App Engineering and Development Company like Us , It would give you more time to write some good code instead of setting up all required thigns like Basecamp project, git repo , gitignore , pivotaltracker project etc.
+ </p>
+ </div>
+ </div>
+
+ </div>
</body>
</html>
View
24 app/views/projects/_form.html.erb
@@ -0,0 +1,24 @@
+<%= form_for @project, :html => { :class => 'form-horizontal' } do |f| %>
+ <fieldset>
+ <legend><%= controller.action_name.capitalize %> /Project</legend>
+
+ <div class="control-group">
+ <%= f.label :name, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :name, :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 'Cancel', projects_path, :class => 'btn' %>
+ </div>
+ </fieldset>
+<% end %>
View
1  app/views/projects/edit.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
View
26 app/views/projects/index.html.erb
@@ -0,0 +1,26 @@
+<h1>Projects</h1>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Created at</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @projects.each do |project| %>
+ <tr>
+ <td><%= project.id %></td>
+ <td><%= link_to project.name, project_path(project) %></td>
+ <td><%= project.created_at %></td>
+ <td>
+ <%= link_to 'Edit', edit_project_path(project), :class => 'btn btn-mini' %>
+ <%= link_to 'Destroy', project_path(project), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<%= link_to 'New', new_project_path, :class => 'btn btn-primary' %>
View
1  app/views/projects/new.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
View
17 app/views/projects/show.html.erb
@@ -0,0 +1,17 @@
+<h1>/Project</h1>
+
+<p>
+ <b>Name</b><br>
+ <%= @project.name %>
+</p>
+
+<p>
+ <b>Description</b><br>
+ <%= @project.description %>
+</p>
+
+<div class="form-actions">
+ <%= link_to 'Back', projects_path, :class => 'btn' %>
+ <%= link_to 'Edit', edit_project_path(@project), :class => 'btn' %>
+ <%= link_to 'Delete', project_path(@project), :method => 'delete', :confirm => 'Are you sure?', :class => 'btn btn-danger' %>
+</div>
View
2  config/routes.rb
@@ -1,4 +1,6 @@
AppLauncher::Application.routes.draw do
+ resources :projects
+
# The priority is based upon order of creation:
# first created -> highest priority.
View
10 db/migrate/20120327143730_create_projects.rb
@@ -0,0 +1,10 @@
+class CreateProjects < ActiveRecord::Migration
+ def change
+ create_table :projects do |t|
+ t.string :name
+ t.text :description
+
+ t.timestamps
+ end
+ end
+end
View
9 db/schema.rb
@@ -11,6 +11,13 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 0) do
+ActiveRecord::Schema.define(:version => 20120327143730) do
+
+ create_table "projects", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
end
View
9 test/fixtures/projects.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+ description: MyText
+
+two:
+ name: MyString
+ description: MyText
View
49 test/functional/projects_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class ProjectsControllerTest < ActionController::TestCase
+ setup do
+ @project = projects(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:projects)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create project" do
+ assert_difference('Project.count') do
+ post :create, project: @project.attributes
+ end
+
+ assert_redirected_to project_path(assigns(:project))
+ end
+
+ test "should show project" do
+ get :show, id: @project.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @project.to_param
+ assert_response :success
+ end
+
+ test "should update project" do
+ put :update, id: @project.to_param, project: @project.attributes
+ assert_redirected_to project_path(assigns(:project))
+ end
+
+ test "should destroy project" do
+ assert_difference('Project.count', -1) do
+ delete :destroy, id: @project.to_param
+ end
+
+ assert_redirected_to projects_path
+ end
+end
View
4 test/unit/helpers/projects_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class ProjectsHelperTest < ActionView::TestCase
+end
View
7 test/unit/project_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class ProjectTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.