Permalink
Browse files

initial set up, have items showing

  • Loading branch information...
1 parent 32bb813 commit 2409161bfc61b3693c47fcb7017eb868d1a27aac @drapergeek committed Apr 23, 2012
View
@@ -1,8 +1,9 @@
source 'https://rubygems.org'
gem 'rails', '3.2.3'
-
gem 'sqlite3'
+gem 'jquery-rails'
+gem "twitter-bootstrap-rails"
group :assets do
@@ -11,14 +12,14 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
end
-gem 'jquery-rails'
group :development, :test do
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'rspec-rails'
gem 'cucumber-rails', :require => false
gem 'factory_girl_rails'
gem 'spork', '~> 1.0rc'
+ gem 'shoulda'
gem 'mocha'
gem 'pry'
gem 'database_cleaner'
@@ -31,6 +32,4 @@ group :development, :test do
gem 'guard-cucumber'
gem 'guard-rspec'
gem 'growl'
-
-
end
View
@@ -50,6 +50,7 @@ GEM
execjs
coffee-script-source (1.2.0)
columnize (0.3.6)
+ commonjs (0.2.5)
cucumber (1.1.9)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
@@ -97,6 +98,13 @@ GEM
json (1.6.6)
launchy (2.1.0)
addressable (~> 2.2.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)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.4.4)
@@ -174,6 +182,11 @@ GEM
ffi (~> 1.0)
multi_json (~> 1.0)
rubyzip
+ shoulda (3.0.1)
+ shoulda-context (~> 1.0.0)
+ shoulda-matchers (~> 1.0.0)
+ shoulda-context (1.0.0)
+ shoulda-matchers (1.0.0)
slop (2.4.4)
spork (1.0.0rc2)
sprockets (2.1.2)
@@ -182,11 +195,17 @@ GEM
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
term-ansicolor (1.0.7)
+ 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)
@@ -216,6 +235,8 @@ DEPENDENCIES
rspec-rails
ruby-debug19
sass-rails (~> 3.2.3)
+ shoulda
spork (~> 1.0rc)
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,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,9 @@
+class ItemsController < ApplicationController
+ def index
+ @items = Item.all
+ end
+
+ def show
+ @item = Item.find(params[:id])
+ end
+end
View
@@ -0,0 +1,4 @@
+class Item < ActiveRecord::Base
+ attr_accessible :description, :name
+ validates :name, uniqueness: true, presence: true
+end
@@ -0,0 +1,16 @@
+<h2>All Items</h2>
+<table class = "items">
+ <thead>
+ <th>Name</th>
+ </thead>
+
+ <% @items.each do |item| %>
+ <tbody>
+ <td class="item_name"> <%= link_to item.name, item %></td>
+ <td> <%= link_to "Download" %> </td>
+ </tbody>
+ <% end %>
+
+
+</table>
+
@@ -0,0 +1,4 @@
+<h1 class="item_name"><%= @item.name %></h1>
+
+<h2>Description</h2>
+<p class="item_description"><%= @item.description %></p>
@@ -1,14 +1,75 @@
<!DOCTYPE html>
-<html>
-<head>
- <title>Geekshelf</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) : "Geekshelf" %></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="#">Geekshelf</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>
View
@@ -1,58 +1,4 @@
Geekshelf::Application.routes.draw do
- # The priority is based upon order of creation:
- # first created -> highest priority.
-
- # Sample of regular route:
- # match 'products/:id' => 'catalog#view'
- # Keep in mind you can assign values other than :controller and :action
-
- # Sample of named route:
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- # This route can be invoked with purchase_url(:id => product.id)
-
- # Sample resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
-
- # Sample resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
-
- # Sample resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
-
- # Sample resource route with more complex sub-resources
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', :on => :collection
- # end
- # end
-
- # Sample resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
-
- # You can have the root of your site routed with "root"
- # just remember to delete public/index.html.
- # root :to => 'welcome#index'
-
- # See how all your routes lay out with "rake routes"
-
- # This is a legacy wild controller route that's not recommended for RESTful applications.
- # Note: This route will make all actions in every controller accessible via GET requests.
- # match ':controller(/:action(/:id))(.:format)'
+ resources :items, only: [:index, :show]
+ root to: 'items#index'
end
@@ -0,0 +1,10 @@
+class CreateItems < ActiveRecord::Migration
+ def change
+ create_table :items do |t|
+ t.string :name
+ t.text :description
+
+ t.timestamps
+ end
+ end
+end
View
@@ -0,0 +1,23 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20120419132053) do
+
+ create_table "items", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+end
@@ -0,0 +1,18 @@
+Feature:
+ In order to easily find resources
+ As a user
+ I want to bee able to search, upload and view items in the library
+
+ Scenario: Listing books
+ Given I am signed in as a user
+ Given there are 5 items in that library
+ When I visit the homepage
+ Then I should see 5 items
+
+ Scenario: Viewing a single book
+ Given I am signed in as a user
+ Given an item exists with a name of "Ruby 1.9"
+ When I visit the homepage
+ And I click on "Ruby 1.9"
+ Then I should see the name "Ruby 1.9" and a description
+
Oops, something went wrong.

0 comments on commit 2409161

Please sign in to comment.