-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeffrey Wilcke
committed
Aug 18, 2010
1 parent
0af5342
commit 531ad7c
Showing
95 changed files
with
2,841 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.bundle | ||
db/*.sqlite3 | ||
log/*.log | ||
tmp/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
source 'http://rubygems.org' | ||
gem 'formtastic', :git => "http://github.com/justinfrench/formtastic.git", :branch => "rails3" | ||
gem 'rails', '3.0.0.rc' | ||
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3' | ||
gem 'inherited_resources', '1.1.2' | ||
|
||
# Bundle edge Rails instead: | ||
# gem 'rails', :git => 'git://github.com/rails/rails.git' | ||
|
||
gem 'sqlite3-ruby', :require => 'sqlite3' | ||
|
||
# Use unicorn as the web server | ||
# gem 'unicorn' | ||
|
||
# Deploy with Capistrano | ||
# gem 'capistrano' | ||
|
||
# To use debugger | ||
# gem 'ruby-debug' | ||
|
||
# Bundle the extra gems: | ||
# gem 'bj' | ||
# gem 'nokogiri', '1.4.1' | ||
# gem 'sqlite3-ruby', :require => 'sqlite3' | ||
# gem 'aws-s3', :require => 'aws/s3' | ||
|
||
# Bundle gems for the local environment. Make sure to | ||
# put test-only gems in this group so their generators | ||
# and rake tasks are available in development mode: | ||
# group :development, :test do | ||
# gem 'webrat' | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
GIT | ||
remote: git://github.com/odorcicd/authlogic.git | ||
revision: a087ad0 | ||
branch: rails3 | ||
specs: | ||
authlogic (2.1.3) | ||
activesupport | ||
|
||
GIT | ||
remote: http://github.com/justinfrench/formtastic.git | ||
revision: 42b4eb8 | ||
branch: rails3 | ||
specs: | ||
formtastic (1.0.0) | ||
actionpack (>= 2.3.0) | ||
activesupport (>= 2.3.0) | ||
i18n (>= 0.4.0) | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
abstract (1.0.0) | ||
actionmailer (3.0.0.rc) | ||
actionpack (= 3.0.0.rc) | ||
mail (~> 2.2.5) | ||
actionpack (3.0.0.rc) | ||
activemodel (= 3.0.0.rc) | ||
activesupport (= 3.0.0.rc) | ||
builder (~> 2.1.2) | ||
erubis (~> 2.6.6) | ||
i18n (~> 0.4.1) | ||
rack (~> 1.2.1) | ||
rack-mount (~> 0.6.9) | ||
rack-test (~> 0.5.4) | ||
tzinfo (~> 0.3.22) | ||
activemodel (3.0.0.rc) | ||
activesupport (= 3.0.0.rc) | ||
builder (~> 2.1.2) | ||
i18n (~> 0.4.1) | ||
activerecord (3.0.0.rc) | ||
activemodel (= 3.0.0.rc) | ||
activesupport (= 3.0.0.rc) | ||
arel (~> 0.4.0) | ||
tzinfo (~> 0.3.22) | ||
activeresource (3.0.0.rc) | ||
activemodel (= 3.0.0.rc) | ||
activesupport (= 3.0.0.rc) | ||
activesupport (3.0.0.rc) | ||
arel (0.4.0) | ||
activesupport (>= 3.0.0.beta) | ||
builder (2.1.2) | ||
erubis (2.6.6) | ||
abstract (>= 1.0.0) | ||
has_scope (0.5.0) | ||
i18n (0.4.1) | ||
inherited_resources (1.1.2) | ||
has_scope (~> 0.5.0) | ||
responders (~> 0.6.0) | ||
mail (2.2.5) | ||
activesupport (>= 2.3.6) | ||
mime-types | ||
treetop (>= 1.4.5) | ||
mime-types (1.16) | ||
polyglot (0.3.1) | ||
rack (1.2.1) | ||
rack-mount (0.6.9) | ||
rack (>= 1.0.0) | ||
rack-test (0.5.4) | ||
rack (>= 1.0) | ||
rails (3.0.0.rc) | ||
actionmailer (= 3.0.0.rc) | ||
actionpack (= 3.0.0.rc) | ||
activerecord (= 3.0.0.rc) | ||
activeresource (= 3.0.0.rc) | ||
activesupport (= 3.0.0.rc) | ||
bundler (>= 1.0.0.rc.1) | ||
railties (= 3.0.0.rc) | ||
railties (3.0.0.rc) | ||
actionpack (= 3.0.0.rc) | ||
activesupport (= 3.0.0.rc) | ||
rake (>= 0.8.3) | ||
thor (~> 0.14.0) | ||
rake (0.8.7) | ||
responders (0.6.2) | ||
sqlite3-ruby (1.3.1) | ||
thor (0.14.0) | ||
treetop (1.4.8) | ||
polyglot (>= 0.3.1) | ||
tzinfo (0.3.22) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
authlogic! | ||
formtastic! | ||
inherited_resources (= 1.1.2) | ||
rails (= 3.0.0.rc) | ||
sqlite3-ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
|
||
Globy::Application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class ApplicationController < ActionController::Base | ||
before_filter :require_auth | ||
|
||
protect_from_forgery | ||
helper :all | ||
helper_method :current_user | ||
helper_method :current_user_session | ||
|
||
# Returns the current logged in candidate | ||
def current_user_session | ||
return @current_user_session if defined?(@current_user_session) | ||
@current_user_session = UserSession.find | ||
end | ||
|
||
def current_user | ||
return @current_user if defined?(@current_user) | ||
@current_user = current_user_session && current_user_session.user | ||
end | ||
|
||
def require_auth | ||
return true if(current_user.present?) | ||
|
||
redirect_to root_path, :notice => t('.action_requires_login') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class DashboardsController < ApplicationController | ||
def show | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class HomeController < ApplicationController | ||
skip_before_filter :require_auth | ||
|
||
def index | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class ProjectsController < InheritedResource::Base | ||
belongs_to :user, :optional => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class UserSessionsController < ApplicationController | ||
skip_before_filter :require_auth, :only => [:new, :create] | ||
|
||
def new | ||
@user_session = UserSession.new | ||
end | ||
|
||
def create | ||
@user_session = UserSession.new(params[:user_session]) | ||
if @user_session.save | ||
redirect_to dashboard_url, :notice => t(".logged_in_success") | ||
else | ||
redirect_to root_url, :notice => t(".logged_in_fail") | ||
end | ||
end | ||
|
||
def destroy | ||
current_user_session.destroy | ||
redirect_to root_url | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class UsersController < InheritedResources::Base | ||
actions :all | ||
|
||
def create | ||
create! do |success, failure| | ||
success.html { redirect_to dashboard_url} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module ApplicationHelper | ||
def clear_div | ||
return raw "<div class='clear_div'></div>" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ProjectsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module UserSessionsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module UsersHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Project < ActiveRecord::Base | ||
belongs_to :owner, :class_name => User | ||
has_many :subscribers, :through => :user_subscriptions | ||
|
||
scope :owned_by, ->(owner_id) { | ||
joins(:users). | ||
where("owner_id = ?", owner_id) | ||
} | ||
|
||
validates :name, :presence => true, :uniqueness => true | ||
|
||
before_create :generate_api_key | ||
|
||
protected | ||
def generate_api_key | ||
require 'active_support/secure_random' | ||
self.api_key = ActiveSupport::SecureRandom.hex(32) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class User < ActiveRecord::Base | ||
acts_as_authentic do |c| | ||
c.login_field = :email | ||
end | ||
|
||
has_many :user_subscriptions | ||
has_many :subscriptions, :through => :user_subscriptions | ||
has_many :projects, :foreign_key => :owner_id | ||
|
||
validates :email, :uniqueness => true, :presence => true | ||
validates :firstname, :lastname, :presence => true | ||
validates :password, :password_confirmation, :presence => true, :if => ->(user) { ((user.password.present? || user.password_confirmation) && user.new_record?)} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class UserSession < Authlogic::Session::Base | ||
login_field :email | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class UserSubscription < ActiveRecord::Base | ||
belongs_to :user | ||
belongs_to :project | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<h1>Dashboard</h1> | ||
|
||
<h2>Overview of projects</h2> | ||
<% current_user.subscriptions.each do |project| %> | ||
<%= render :partial => 'projects/overview', :locals => {:project => project} %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<%= content_for :head do %> | ||
<script type="text/javascript"> | ||
$(function() { | ||
$('#new-user-dialog').dialog({ | ||
autoOpen:false, | ||
modal:true, | ||
draggable:false, | ||
resizeable:false, | ||
closeOnEscape:true, | ||
width: 500, | ||
height: 350 | ||
}); | ||
$('#new-user').click(function(){ | ||
$('#new-user-dialog').dialog('open'); | ||
}); | ||
}); | ||
</script> | ||
<% end %> | ||
|
||
|
||
<div class"fl w300"> | ||
<h1>Welcome to Globy</h1> | ||
Globy is a free GPS location service. Free in the sense of; we love OpenSource and/or free software. So is your software free? Then Globy is free for you. | ||
But if you're one of the baddies, well, hand is the doe! But we're not expensive, we're rather cheap and offer several kinds blah blah | ||
</div> | ||
|
||
<div id="login-home" class="fl rounded-corner large-border"> | ||
<div class"upper">Please <span class="highlight">login</span> or create a <%= link_to_function t('.new'), new_user_url, :id => 'new-user' %> account</div> | ||
<%= semantic_form_for UserSession.new do |f| %> | ||
<%= f.inputs do %> | ||
<%= f.input :email, :html => {:class => 'large-input'} %> | ||
<%= f.input :password %> | ||
<% end %> | ||
|
||
<%= f.buttons do %> | ||
<%= f.submit %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
|
||
<%= clear_div %> | ||
|
||
<div id="new-user-dialog" title="<%= t('.register') %>"> | ||
<%= semantic_form_for User.new do |f| %> | ||
<%= render :partial => 'users/form', :locals => {:f => f}%> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Globy, the cute GPS service</title> | ||
<%= stylesheet_link_tag :all %> | ||
<%#= javascript_include_tag :defaults %> | ||
<%= javascript_include_tag '/javascripts/jquery.js' %> | ||
<%= javascript_include_tag '/javascripts/jquery-ui.js' %> | ||
<%= stylesheet_link_tag '/stylesheets/jquery-ui.css' %> | ||
<%= csrf_meta_tag %> | ||
<%= yield :head %> | ||
</head> | ||
<body> | ||
<div class="wrapper"> | ||
<div id="header"> | ||
<h1>Globy</h1> | ||
<div id="menu"> | ||
<div id="utils"> | ||
<%= button_to(t('.logout'), user_session_path(current_user), :method => :delete) if current_user.present? %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id="main"> | ||
<% if flash[:notice].present? %> | ||
<%= flash[:notice] %> | ||
<% end %> | ||
|
||
<% if flash[:error].present? %> | ||
<div class="ui-icon ui-icon-alert"> | ||
<strong>Error</strong><%= flash[:error] %> | ||
</div> | ||
<% end %> | ||
|
||
<%= yield %> | ||
</div> | ||
<div class="push"></div> | ||
</div> | ||
|
||
<div id="footer"> | ||
<div class="inner">Globy (c) 2010</div> | ||
</div> | ||
</body> | ||
</html> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<h1>Login</h1> | ||
<%= semantic_form_for @user_session do |f| %> | ||
<%= f.inputs do %> | ||
<%= f.input :email %> | ||
<%= f.input :password %> | ||
<% end %> | ||
|
||
<% f.buttons do %> | ||
<%= f.submit t(".submit") %> | ||
<% end %> | ||
<% end %> |
Oops, something went wrong.