-
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.
added models added haml plugins
- Loading branch information
Showing
23 changed files
with
223 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,12 @@ | ||
class AccountController < ApplicationController | ||
before_filter :login_required | ||
|
||
def index | ||
|
||
end | ||
|
||
def notebooks | ||
@notebooks = User.find(session[:user_id]).notebooks | ||
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
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,31 @@ | ||
class SessionController < ApplicationController | ||
skip_before_filter :login_required, :only => [:new, :create] | ||
|
||
def new | ||
consumer = get_consumer | ||
request_token = consumer.get_request_token( {}, {:scope => "https://www.google.com/base/feeds/ https://www.google.com/m8/feeds/"}) | ||
session[:oauth_secret] = request_token.secret | ||
next_url = "http://localhost:3000/session/create" | ||
redirect_to request_token.authorize_url + "&oauth_callback=#{next_url}" | ||
end | ||
|
||
def create | ||
request_token = OAuth::RequestToken.new(get_consumer, params[:oauth_token], session[:oauth_secret]) | ||
access_token = request_token.get_access_token | ||
xml = XmlSimple.xml_in(access_token.get("https://www.google.com/m8/feeds/contacts/default/full/").body) | ||
email = xml["author"].first["email"].first | ||
user = User.find_or_create_by_email(email) | ||
user.name = xml["author"].first["name"].first | ||
user.oauth_token = access_token.token | ||
user.oauth_secret = access_token.secret | ||
user.save | ||
session[:user_id] = user.id | ||
redirect_to :controller => 'account' | ||
end | ||
|
||
def delete | ||
reset_session | ||
flash[:notice] = "You have been logged out" | ||
redirect_to :action => 'new' | ||
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 AccountHelper | ||
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 SessionHelper | ||
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 @@ | ||
class Annoter < ActiveRecord::Base | ||
|
||
belongs_to :notebook | ||
belongs_to :user | ||
|
||
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 Notebook < ActiveRecord::Base | ||
|
||
belongs_to :creator, :class_name => "User" | ||
|
||
has_many :annoters | ||
|
||
has_many :users, :through => :annoters | ||
|
||
has_many :readers, :through => :annoters, :source => :user, :conditions => "status = 'READER' " | ||
has_many :writers, :through => :annoters, :source => :user, :conditions => "status = 'WRITER' " | ||
|
||
validates_presence_of :name, :creator_id | ||
|
||
def after_create | ||
# create the notebook_user entry | ||
self.writers << self.creator | ||
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,8 @@ | ||
class User < ActiveRecord::Base | ||
validates_presence_of :email, :oauth_token, :oauth_secret | ||
validates_uniqueness_of :email | ||
|
||
has_many :annoters | ||
has_many :notebooks, :through => :annoters | ||
|
||
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 @@ | ||
- for notebook in @notebooks | ||
%li | ||
%a{:href=> "/notebook/notebook.name"}=notebook.name |
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 @@ | ||
#sidebar | ||
= render_component :controller => 'account', :action => 'notebooks' |
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,17 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICpDCCAg2gAwIBAgIJAKZCTXXCnDupMA0GCSqGSIb3DQEBBQUAMEExCzAJBgNV | ||
BAYTAkZSMQ4wDAYDVQQIEwVQYXJpczEOMAwGA1UEBxMFUGFyaXMxEjAQBgNVBAoT | ||
CU1haGktTWFoaTAeFw0wOTA0MDYwNjU5NDJaFw0xMDA0MDYwNjU5NDJaMEExCzAJ | ||
BgNVBAYTAkZSMQ4wDAYDVQQIEwVQYXJpczEOMAwGA1UEBxMFUGFyaXMxEjAQBgNV | ||
BAoTCU1haGktTWFoaTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyTHvRk96 | ||
YeaupMCahVsG+oqzqunkbtpIqnT77JfWfhI67BbY2aBl6f6ZwSMIW2cyT6ti57bV | ||
jqqAZLC9O9dIXIXuay7PoFVdlJoVRknkYjJrYZVRNqJCAg/hdxzzBIzBdIE6V7Dh | ||
96nbKzjZUaFKxIzA9swQlNqPYtKbeYzSbJ8CAwEAAaOBozCBoDAdBgNVHQ4EFgQU | ||
rJ6kcXLDIQOIXDNuDDEl3Jq/MCowcQYDVR0jBGowaIAUrJ6kcXLDIQOIXDNuDDEl | ||
3Jq/MCqhRaRDMEExCzAJBgNVBAYTAkZSMQ4wDAYDVQQIEwVQYXJpczEOMAwGA1UE | ||
BxMFUGFyaXMxEjAQBgNVBAoTCU1haGktTWFoaYIJAKZCTXXCnDupMAwGA1UdEwQF | ||
MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAuRyBerksnVISvryfPzspMr5kD+cDsrs3 | ||
yqjHe2uCT8+zBx+BJx9RUOaTWwa8x9WHkZh2Qvl2dwJs5arcvY85M4Af4TCuYEKH | ||
XbxhNnmy9++FcB+28oymYo/8nc2ofcHTssVCgUz0YX6GqG/9+kER3NfT4gY1xImw | ||
0in/Lnp5m5U= | ||
-----END CERTIFICATE----- |
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,15 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIICXQIBAAKBgQDJMe9GT3ph5q6kwJqFWwb6irOq6eRu2kiqdPvsl9Z+EjrsFtjZ | ||
oGXp/pnBIwhbZzJPq2LnttWOqoBksL0710hche5rLs+gVV2UmhVGSeRiMmthlVE2 | ||
okICD+F3HPMEjMF0gTpXsOH3qdsrONlRoUrEjMD2zBCU2o9i0pt5jNJsnwIDAQAB | ||
AoGAXrkixQCQRt17pdeEKHrVy0lYE4Sw5rvgcFhJb3eBJbPhh9ut1rAcq1ESBItA | ||
2P+6ASZYl21OGDAP6NgJD85oo0khuDwt7yWOUy8hFT51QPFx3lVhQFLnloriKbSa | ||
9bYSw9ZoloFscwj+jLS04Bq9etBllqik9cgaaj0+rktGl/kCQQDqFap7wEI+2G54 | ||
1BgMvLm9CjDgZ/t+c1Vn4GiyfeqUQBhDvBeXLRZM+ei2/ZyxRJihwN/2ogFE4liM | ||
aZU6dRTTAkEA3AgAGMDePMXofzkHrcfkZ+pW4wdNJI4FgOllpI4OSdgJ2c+eWDDQ | ||
sNKkqDn4GH3Mr/95iihXBnhkxWDZA3IZhQJBAKTkUCxOGRwV73Ozy6ElTB1K0XUy | ||
Kik/6xh6LqYVJqn5oF4OX/vA6eWdYP2OFtOUQ4Qlzl34brZsTv3R3inIkbsCQGEP | ||
rms8+Uw5yXwFvltsqFcmyrlPiTos5ESfsNTMTYVJpd7NdX5V2lmGMlh7afPz2o1w | ||
1z6Y2PrjtSBUvqaEeLkCQQCAJ7TsqeQ02gY6qz/LFP1QRJTxG3jdUigQRKPyl9Tr | ||
typsKkQFW0xBp5TXCcAY2yyeUg7UiOkB0G3Y/4SoEu8M | ||
-----END RSA PRIVATE KEY----- |
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 @@ | ||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
|
||
# one: | ||
# column: value | ||
# | ||
# two: | ||
# column: value |
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 @@ | ||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
|
||
# one: | ||
# column: value | ||
# | ||
# two: | ||
# column: value |
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 @@ | ||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
|
||
one: | ||
name: MyString | ||
oauth_token: MyString | ||
oauth_secret: MyString | ||
email: MyString | ||
|
||
two: | ||
name: MyString | ||
oauth_token: MyString | ||
oauth_secret: MyString | ||
email: MyString |
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,8 @@ | ||
require 'test_helper' | ||
|
||
class AccountControllerTest < ActionController::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
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,8 @@ | ||
require 'test_helper' | ||
|
||
class SessionControllerTest < ActionController::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
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,8 @@ | ||
require 'test_helper' | ||
|
||
class AnnotersTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
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,4 @@ | ||
require 'test_helper' | ||
|
||
class AccountHelperTest < ActionView::TestCase | ||
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 @@ | ||
require 'test_helper' | ||
|
||
class SessionHelperTest < ActionView::TestCase | ||
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,8 @@ | ||
require 'test_helper' | ||
|
||
class NotebookTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
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,8 @@ | ||
require 'test_helper' | ||
|
||
class UserTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
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,8 @@ | ||
begin | ||
require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here | ||
rescue LoadError | ||
require 'haml' # From gem | ||
end | ||
|
||
# Load Haml and Sass | ||
Haml.init_rails(binding) |