Permalink
Browse files

There are projects

  • Loading branch information...
1 parent 59718ef commit 4ad755214db9f1941effea50a70eb748fbbbc7c5 @iain committed Jan 15, 2012
View
10 Gemfile
@@ -6,19 +6,21 @@ gem 'rails', '3.2.0.rc2'
gem 'sqlite3'
gem 'haml'
+gem 'friendly_id'
group :assets do
gem 'compass', '~> 0.12.alpha.4'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
+ gem 'jquery-rails'
end
-gem 'jquery-rails'
-
-gem 'jbuilder'
-
group :development, :test do
gem 'rspec-rails'
gem 'factory_girl_rails'
end
+
+group :test do
+ gem 'shoulda-matchers'
+end
View
@@ -29,7 +29,6 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.0)
- blankslate (2.1.2.4)
builder (3.0.0)
chunky_png (1.2.5)
coffee-rails (3.2.1)
@@ -52,13 +51,11 @@ GEM
factory_girl_rails (1.5.0)
factory_girl (~> 2.4.0)
railties (>= 3.0.0)
+ friendly_id (4.0.0)
fssm (0.2.8.1)
haml (3.1.4)
hike (1.2.1)
i18n (0.6.0)
- jbuilder (0.3)
- activesupport (>= 3.0.0)
- blankslate (>= 2.1.2.4)
journey (1.0.0)
jquery-rails (2.0.0)
railties (>= 3.2.0.beta, < 5.0)
@@ -114,6 +111,7 @@ GEM
railties (~> 3.2.0.beta)
sass (>= 3.1.10)
tilt (~> 1.3)
+ shoulda-matchers (1.0.0)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
@@ -136,11 +134,12 @@ DEPENDENCIES
coffee-rails
compass (~> 0.12.alpha.4)
factory_girl_rails
+ friendly_id
haml
- jbuilder
jquery-rails
rails (= 3.2.0.rc2)
rspec-rails
sass-rails
+ shoulda-matchers
sqlite3
uglifier
@@ -1,15 +0,0 @@
-// This is a manifest file that'll be compiled into application.js, which will include all the files
-// listed below.
-//
-// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
-// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
-//
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// the compiled file.
-//
-// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
-// GO AFTER THE REQUIRES BELOW.
-//
-//= require jquery
-//= require jquery_ujs
-//= require_tree .
@@ -0,0 +1,3 @@
+#= require jquery
+#= require jquery_ujs
+#= require highcharts
@@ -0,0 +1,5 @@
+#main
+ margin-top: 60px
+
+table.projects
+ @extend .zebra-striped
@@ -1,13 +0,0 @@
-/*
- * This is a manifest file that'll be compiled into application.css, which will include all the files
- * listed below.
- *
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
- *
- * You're free to add application-wide styles to this file and they'll appear at the top of the
- * compiled file, but it's generally better to create a new file per style scope.
- *
- *= require_self
- *= require_tree .
-*/
@@ -0,0 +1,3 @@
+@import compass
+@import bootstrap
+@import layout
@@ -1,3 +1,9 @@
class ApplicationController < ActionController::Base
protect_from_forgery
+
+ def projects
+ @projects ||= Project.all
+ end
+ helper_method :projects
+
end
@@ -0,0 +1,6 @@
+class ProjectsController < ApplicationController
+
+ def index
+ end
+
+end
View
@@ -0,0 +1,7 @@
+class Project < ActiveRecord::Base
+ extend FriendlyId
+ friendly_id :name, :use => :slugged
+
+ validates_presence_of :name
+
+end
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Stots</title>
- <%= stylesheet_link_tag "application", :media => "all" %>
- <%= javascript_include_tag "application" %>
- <%= csrf_meta_tags %>
-</head>
-<body>
-
-<%= yield %>
-
-</body>
-</html>
@@ -0,0 +1,17 @@
+!!!
+%html
+ %head
+ %title Stots
+ = stylesheet_link_tag "application"
+ = javascript_include_tag "application"
+ = csrf_meta_tags
+ %body
+ %header.topbar
+ .topbar-inner
+ .container
+ = link_to "Stots", root_path, :class => "brand"
+ %ul.nav
+ - projects.each do |project|
+ %li= link_to project.name, project
+ #main.container
+ = yield
@@ -0,0 +1,16 @@
+%h2 Projects
+
+%table.projects
+ %thead
+ %tr
+ %th Project
+ %th Errors
+ %th Warnings
+ %th Events
+ %tbody
+ - projects.each do |project|
+ %tr[project]
+ %td= link_to project.name, project
+ %td 1
+ %td 1
+ %td 1
View
@@ -1,2 +1,4 @@
Stots::Application.routes.draw do
+ root :to => "projects#index"
+ resources :projects
end
@@ -0,0 +1,12 @@
+class CreateProjects < ActiveRecord::Migration
+ def change
+ create_table :projects do |t|
+ t.string :project
+ t.string :name
+ t.string :slug
+
+ t.timestamps
+ end
+ add_index :projects, :slug
+ end
+end
View
@@ -0,0 +1,26 @@
+# 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 => 20120115162215) do
+
+ create_table "projects", :force => true do |t|
+ t.string "project"
+ t.string "name"
+ t.string "slug"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "projects", ["slug"], :name => "index_projects_on_slug"
+
+end
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe ApplicationController do
+
+ describe "#projects" do
+
+ it "gets all projects" do
+ Project.should_receive(:all)
+ controller.projects
+ end
+
+ end
+
+end
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe ProjectsController do
+
+ describe "#index" do
+
+ it "renders the index template" do
+ get :index
+ response.should render_template(:index)
+ end
+
+ end
+
+end
@@ -0,0 +1,8 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :project do
+ project "MyString"
+ name "MyString"
+ end
+end
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe Project do
+
+ it { should validate_presence_of(:name) }
+
+ it "finds by slug" do
+ project = Factory :project, :name => "Pretty title"
+ Project.find("pretty-title").should == project
+ end
+
+end

0 comments on commit 4ad7552

Please sign in to comment.