Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kormie committed Apr 22, 2011
0 parents commit 39e963b
Show file tree
Hide file tree
Showing 152 changed files with 44,579 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.bundle
db/*.sqlite3
log/*.log
tmp/**/*
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--colour
49 changes: 49 additions & 0 deletions .rvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory

# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.2-p180@jotlocker"

#
# First we attempt to load the desired environment directly from the environment
# file. This is very fast and efficicent compared to running through the entire
# CLI and selector. If you want feedback on which environment was used then
# insert the word 'use' after --create as this triggers verbose mode.
#
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"

[[ -s ".rvm/hooks/after_use" ]] && . ".rvm/hooks/after_use"
else
# If the environment file has not yet been created, use the RVM CLI to select.
rvm --create "$environment_id"
fi

#
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
# it be automatically loaded. Uncomment the following and adjust the filename if
# necessary.
#
# filename=".gems"
# if [[ -s "$filename" ]] ; then
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
# fi

#
# If you use bundler and would like to run bundle each time you enter the
# directory, you can uncomment the following code.
#
# # Ensure that Bundler is installed. Install it if it is not.
if ! command -v bundle >/dev/null; then
printf "The rubygem 'bundler' is not installed. Installing it now.\n"
gem install bundler
fi
#
# # Bundle while reducing excess noise.
# printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
# bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
#

23 changes: 23 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
source 'http://rubygems.org'

gem 'rails', '3.0.3'
gem 'sqlite3'
gem 'jquery-rails'
gem 'formtastic'

gem 'sitemap_generator'

gem "devise", '~> 1.2'
gem "oa-oauth"


# rails generate jquery:install --ui if you want jQuery UI

gem 'rails-footnotes', '>= 3.7', :group => :development

group :development, :test do
gem 'webrat'
gem "rspec-rails", "~> 2.4"
gem "ZenTest", "~> 4.4.2"
gem "annotate-models"
end
142 changes: 142 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
GEM
remote: http://rubygems.org/
specs:
ZenTest (4.4.2)
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (= 3.0.3)
mail (~> 2.2.9)
actionpack (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.6)
tzinfo (~> 0.3.23)
activemodel (3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
addressable (2.2.5)
annotate-models (1.0.4)
arel (2.0.9)
bcrypt-ruby (2.1.4)
builder (2.1.2)
devise (1.3.3)
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
rack (>= 1.1.0, < 2)
formtastic (1.2.3)
actionpack (>= 2.3.7)
activesupport (>= 2.3.7)
i18n (~> 0.4)
i18n (0.5.0)
jquery-rails (0.2.7)
rails (~> 3.0)
thor (~> 0.14.4)
mail (2.2.17)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
multi_json (0.0.5)
multipart-post (1.1.0)
nokogiri (1.4.4)
oa-core (0.2.3)
rack (~> 1.1)
oa-oauth (0.2.3)
faraday (~> 0.6.1)
multi_json (>= 0.0.5)
nokogiri (~> 1.4.2)
oa-core (= 0.2.3)
oauth (~> 0.4.0)
oauth2 (~> 0.3.0)
oauth (0.4.4)
oauth2 (0.3.0)
faraday (~> 0.6.0)
multi_json (~> 0.0.4)
orm_adapter (0.0.4)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.3)
actionmailer (= 3.0.3)
actionpack (= 3.0.3)
activerecord (= 3.0.3)
activeresource (= 3.0.3)
activesupport (= 3.0.3)
bundler (~> 1.0)
railties (= 3.0.3)
rails-footnotes (3.7.0)
rails (>= 3.0.0)
railties (3.0.3)
actionpack (= 3.0.3)
activesupport (= 3.0.3)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
rspec-rails (2.5.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.5.0)
sitemap_generator (1.5.2)
sqlite3 (1.3.3)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.26)
warden (1.0.3)
rack (>= 1.0.0)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)

PLATFORMS
ruby

DEPENDENCIES
ZenTest (~> 4.4.2)
annotate-models
devise (~> 1.2)
formtastic
jquery-rails
oa-oauth
rails (= 3.0.3)
rails-footnotes (>= 3.7)
rspec-rails (~> 2.4)
sitemap_generator
sqlite3
webrat
Empty file added Icon
Empty file.
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Jot Locker
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

JotLocker::Application.load_tasks
40 changes: 40 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
class ApplicationController < ActionController::Base
protect_from_forgery
layout :layout_by_resource
before_filter :nav_spots

def layout_by_resource
if devise_controller?
"intro"
else
"application"
end
end

def after_sign_out_path_for(resource_or_scope)
intro_index_path
end
def after_update_path_for(resource_or_scope)
users_index_path
end
def find_current_user
current_user
@user = User.find(current_user.id)
@courses = @user.courses.all
end

def nav_spots
if @courses != nil
@nav_spots = [{:image => "my_jots/slash", :path => courses_path}]
@nav_spots << {:image => "new_jot", :path => new_course_jot_path(@course ||= @user.courses.first)}
else
@nav_spots = [{:image => "my_jots", :path => jots_path }]
end
return @nav_spots
end

@welcome_message ||= "Welcome to Jot Locker"
@day_number = DateTime.now.strftime('%d')
@long_day = DateTime.now.strftime('%A, %m.%d')
@today = DateTime.now
end
104 changes: 104 additions & 0 deletions app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
class CoursesController < ApplicationController
before_filter :authenticate_user!
before_filter :find_current_user
before_filter :breadcrumbs, :except => [:index]

def one
@departments = @user.university.departments
render :layout => nil
end

def index
@courses = @user.courses.order("name ASC")
@column1 = @courses.limit(2)
@column2 = @courses.limit(2).offset(2)
@column3 = @courses.offset(4)
@page_title = "#{current_user.first_name}'s Courses"
@welcome_message = "#{@user.name}'s Courses"
@breadcrumbs = [{:image => "jot_locker", :path => courses_path}]
render :layout => "tall_pics"
end

def show
@course = Course.find(params[:id])
@courses = @user.courses.where("id != ?", params[:id]).order("name")
@jots = @course.jots.order("updated_at DESC")
@page_title = "#{@course.name}"
@welcome_message = @page_title

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @course }
end
end

def new
@course = Course.new
@page_title = "New Course"
@welcome_message = @page_title

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @course }
end
end

def edit
@course = Course.find(params[:id])
end

def create
@course = Course.new(params[:course])

respond_to do |format|
if @course.save
format.html { redirect_to(edit_user_registration_path, :anchor => "Courses", :notice => 'Course was successfully created.') }
format.xml { render :xml => @course, :status => :created, :location => @course }
else
format.html { render :action => "new" }
format.xml { render :xml => @course.errors, :status => :unprocessable_entity }
end
end
end

def update
@course = Course.find(params[:id])

respond_to do |format|
if @course.update_attributes(params[:course])
format.html { redirect_to(@course, :notice => 'Course was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @course.errors, :status => :unprocessable_entity }
end
end
end

def destroy
@course = Course.find(params[:id])
@course.destroy

respond_to do |format|
format.html { redirect_to(courses_url) }
format.xml { head :ok }
end
end
def course_column
@course = Course.all
end

private

def breadcrumbs
@breadcrumbs =[{:image => "jot_locker/arrow", :path => courses_path}]
end








end
9 changes: 9 additions & 0 deletions app/controllers/intro_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class IntroController < ApplicationController

def index
if current_user
redirect_to :controller => "users", :action => "index"
end
end

end
Loading

0 comments on commit 39e963b

Please sign in to comment.