Permalink
Browse files

Twitter-bootstrap added with theme

  • Loading branch information...
1 parent 4612afb commit 6b568522a87787ae4c639ed416601824175f6f7e @safalmj committed Mar 18, 2013
View
@@ -19,6 +19,14 @@ end
gem 'jquery-rails', '2.0.2'
+#### View Related #####
+#gem 'slim'
+
+gem "therubyracer"
+gem "less-rails"
+gem "twitter-bootstrap-rails"
+#gem 'kaminari'
+
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
View
@@ -37,6 +37,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.6.1)
+ commonjs (0.2.6)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
@@ -47,6 +48,12 @@ GEM
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.7)
+ less (2.3.1)
+ commonjs (~> 0.2.6)
+ less-rails (2.3.2)
+ actionpack (>= 3.1)
+ less (~> 2.3.1)
+ libv8 (3.11.8.13)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -79,6 +86,7 @@ GEM
rake (10.0.3)
rdoc (3.12.2)
json (~> 1.4)
+ ref (1.0.2)
sass (3.2.7)
sass-rails (3.2.6)
railties (~> 3.2.0)
@@ -90,11 +98,18 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
+ therubyracer (0.11.4)
+ libv8 (~> 3.11.8.12)
+ ref
thor (0.17.0)
tilt (1.3.5)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
+ twitter-bootstrap-rails (2.2.6)
+ actionpack (>= 3.1)
+ execjs
+ railties (>= 3.1)
tzinfo (0.3.37)
uglifier (1.3.0)
execjs (>= 0.3.0)
@@ -106,7 +121,10 @@ PLATFORMS
DEPENDENCIES
coffee-rails (~> 3.2.1)
jquery-rails (= 2.0.2)
+ less-rails
rails (= 3.2.12)
sass-rails (~> 3.2.3)
sqlite3 (= 1.3.5)
+ therubyracer
+ twitter-bootstrap-rails
uglifier (>= 1.2.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,33 @@
+@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)
+// Note: If you use asset_path() here, your compiled bootstrap_and_overrides.css will not
+// have the proper paths. So for now we use the absolute path.
+@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot?v=3.0.2");
+@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot?#iefix&v=3.0.2");
+@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff?v=3.0.2");
+@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf?v=3.0.2");
+
+// Font Awesome
+@import "fontawesome";
+
+// Glyphicons
+//@import "twitter/bootstrap/sprites.less";
+
+// 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/customize.html#variables for their names and documentation
+//
+// Example:
+// @linkColor: #ff0000;
@@ -0,0 +1,3 @@
+// Place all the styles related to the Students controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,83 @@
+class StudentsController < ApplicationController
+ # GET /students
+ # GET /students.json
+ def index
+ @students = Student.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @students }
+ end
+ end
+
+ # GET /students/1
+ # GET /students/1.json
+ def show
+ @student = Student.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @student }
+ end
+ end
+
+ # GET /students/new
+ # GET /students/new.json
+ def new
+ @student = Student.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @student }
+ end
+ end
+
+ # GET /students/1/edit
+ def edit
+ @student = Student.find(params[:id])
+ end
+
+ # POST /students
+ # POST /students.json
+ def create
+ @student = Student.new(params[:student])
+
+ respond_to do |format|
+ if @student.save
+ format.html { redirect_to @student, notice: 'Student was successfully created.' }
+ format.json { render json: @student, status: :created, location: @student }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @student.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /students/1
+ # PUT /students/1.json
+ def update
+ @student = Student.find(params[:id])
+
+ respond_to do |format|
+ if @student.update_attributes(params[:student])
+ format.html { redirect_to @student, notice: 'Student was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @student.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /students/1
+ # DELETE /students/1.json
+ def destroy
+ @student = Student.find(params[:id])
+ @student.destroy
+
+ respond_to do |format|
+ format.html { redirect_to students_url }
+ format.json { head :no_content }
+ end
+ end
+end
@@ -0,0 +1,2 @@
+module StudentsHelper
+end
@@ -0,0 +1,3 @@
+class Student < ActiveRecord::Base
+ attr_accessible :address, :gender, :name
+end
@@ -5,10 +5,31 @@
<%= stylesheet_link_tag "application", :media => "all" %>
<%= 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">
+ <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>
+ <a class="brand" href="#">HGST</a>
+ <div class="nav-collapse">
+ <ul class="nav">
+ <li><%= link_to "Students", students_path %></li>
+ <li><%= link_to "Subject" %></li>
+ <li><%= link_to "Help" %></li>
+ <li><%= link_to "Admin" %></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</div>
+<div class="container">
<%= yield %>
-
+</div>
</body>
</html>
@@ -0,0 +1,26 @@
+<%= form_for @student, :html => { :class => 'form-horizontal' } do |f| %>
+ <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 :gender, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :gender, :class => 'text_field' %>
+ </div>
+ </div>
+ <div class="control-group">
+ <%= f.label :address, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :address, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
+ students_path, :class => 'btn' %>
+ </div>
+<% end %>
@@ -0,0 +1,5 @@
+<%- model_class = Student -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human %></h1>
+</div>
+<%= render :partial => 'form' %>
@@ -0,0 +1,43 @@
+<%- model_class = Student -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => model_class.model_name.human.pluralize %></h1>
+</div>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th><%= model_class.human_attribute_name(:id) %></th>
+ <th><%= model_class.human_attribute_name(:name) %></th>
+ <th><%= model_class.human_attribute_name(:gender) %></th>
+ <th><%= model_class.human_attribute_name(:address) %></th>
+ <th><%= model_class.human_attribute_name(:created_at) %></th>
+ <th><%=t '.actions', :default => t("helpers.actions") %></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @students.each do |student| %>
+ <tr>
+ <td><%= link_to student.id, student_path(student) %></td>
+ <td><%= student.name %></td>
+ <td><%= student.gender %></td>
+ <td><%= student.address %></td>
+ <td><%=l student.created_at %></td>
+ <td>
+ <%= link_to t('.edit', :default => t("helpers.links.edit")),
+ edit_student_path(student), :class => 'btn btn-mini' %>
+ <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
+ student_path(student),
+ :method => :delete,
+ :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
+ :class => 'btn btn-mini btn-danger' %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<%#= link_to t('.new', :default => t("helpers.links.new")),
+ new_student_path,
+ :class => 'btn btn-primary' %>
+<%= link_to "Add New Student",
+ new_student_path,
+ :class => 'btn btn-primary' %>
@@ -0,0 +1,5 @@
+<%- model_class = Student -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human %></h1>
+</div>
+<%= render :partial => 'form' %>
@@ -0,0 +1,25 @@
+<%- model_class = Student -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => model_class.model_name.human %></h1>
+</div>
+
+<dl class="dl-horizontal">
+ <dt><strong><%= model_class.human_attribute_name(:name) %>:</strong></dt>
+ <dd><%= @student.name %></dd>
+ <dt><strong><%= model_class.human_attribute_name(:gender) %>:</strong></dt>
+ <dd><%= @student.gender %></dd>
+ <dt><strong><%= model_class.human_attribute_name(:address) %>:</strong></dt>
+ <dd><%= @student.address %></dd>
+</dl>
+
+<div class="form-actions">
+ <%= link_to t('.back', :default => t("helpers.links.back")),
+ students_path, :class => 'btn' %>
+ <%= link_to t('.edit', :default => t("helpers.links.edit")),
+ edit_student_path(@student), :class => 'btn' %>
+ <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
+ student_path(@student),
+ :method => 'delete',
+ :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
+ :class => 'btn btn-danger' %>
+</div>
@@ -0,0 +1,17 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ helpers:
+ actions: "Actions"
+ links:
+ back: "Back"
+ cancel: "Cancel"
+ confirm: "Are you sure?"
+ destroy: "Delete"
+ new: "New"
+ titles:
+ edit: "Edit"
+ save: "Save"
+ new: "New"
+ delete: "Delete"
View
@@ -1,5 +1,9 @@
HGST::Application.routes.draw do
- # The priority is based upon order of creation:
+ resources :students
+
+ root :to => "Students#index"
+
+ # The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
Oops, something went wrong.

0 comments on commit 6b56852

Please sign in to comment.