Permalink
Browse files

after-party spike

  • Loading branch information...
1 parent 887adee commit 568c8c10c718cc0be89d2f8a279d906f71b7daf7 @croaky croaky committed Feb 4, 2011
View
@@ -9,6 +9,7 @@ gem "formtastic"
gem "pg"
gem "flutie", "1.1.3"
gem "dynamic_form"
+gem "omniauth"
# RSpec needs to be in :development group to expose generators
# and rake tasks without having to type RAILS_ENV=test.
View
@@ -36,6 +36,7 @@ GEM
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
+ addressable (2.2.4)
archive-tar-minitar (0.5.2)
arel (2.0.7)
bourne (1.0)
@@ -71,6 +72,10 @@ GEM
factory_girl (~> 1.3)
railties (>= 3.0.0)
fakeweb (1.3.0)
+ faraday (0.5.4)
+ addressable (~> 2.2.2)
+ multipart-post (~> 1.1.0)
+ rack (>= 1.1.0, < 2)
ffi (0.6.3)
rake (>= 0.8.7)
flutie (1.1.3)
@@ -103,12 +108,52 @@ GEM
mime-types (1.16)
mocha (0.9.8)
rake
+ multi_json (0.0.5)
+ multipart-post (1.1.0)
+ net-ldap (0.1.1)
nokogiri (1.4.4)
+ oa-basic (0.1.6)
+ multi_json (~> 0.0.2)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.1.6)
+ rest-client (~> 1.6.0)
+ oa-core (0.1.6)
+ rack (~> 1.1)
+ oa-enterprise (0.1.6)
+ net-ldap (~> 0.1.1)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.1.6)
+ pyu-ruby-sasl (~> 0.0.3.1)
+ rubyntlm (~> 0.1.1)
+ oa-oauth (0.1.6)
+ multi_json (~> 0.0.2)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.1.6)
+ oauth (~> 0.4.0)
+ oauth2 (~> 0.1.0)
+ oa-openid (0.1.6)
+ oa-core (= 0.1.6)
+ rack-openid (~> 1.2.0)
+ ruby-openid-apps-discovery
+ oauth (0.4.4)
+ oauth2 (0.1.1)
+ faraday (~> 0.5.0)
+ multi_json (~> 0.0.4)
+ omniauth (0.1.6)
+ oa-basic (= 0.1.6)
+ oa-core (= 0.1.6)
+ oa-enterprise (= 0.1.6)
+ oa-oauth (= 0.1.6)
+ oa-openid (= 0.1.6)
pg (0.10.1)
polyglot (0.3.1)
+ pyu-ruby-sasl (0.0.3.2)
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
+ rack-openid (1.2.0)
+ rack (>= 1.1.0)
+ ruby-openid (>= 2.1.8)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.3)
@@ -125,6 +170,8 @@ GEM
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
+ rest-client (1.6.1)
+ mime-types (>= 1.16)
rspec (2.4.0)
rspec-core (~> 2.4.0)
rspec-expectations (~> 2.4.0)
@@ -151,8 +198,12 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
+ ruby-openid (2.1.8)
+ ruby-openid-apps-discovery (1.2.0)
+ ruby-openid (>= 2.1.7)
ruby_core_source (0.1.4)
archive-tar-minitar (>= 0.5.2)
+ rubyntlm (0.1.1)
rubyzip (0.9.4)
selenium-webdriver (0.1.2)
childprocess (~> 0.1.5)
@@ -186,6 +237,7 @@ DEPENDENCIES
hoptoad_notifier
launchy
nokogiri
+ omniauth
pg
rack
rails (>= 3.0)
@@ -2,4 +2,14 @@ class ApplicationController < ActionController::Base
protect_from_forgery
helper :all
has_mobile_fu
+
+ helper_method :current_user
+
+ private
+
+ def current_user
+ if session[:user_id]
+ @current_user ||= User.find(session[:user_id])
+ end
+ end
end
@@ -0,0 +1,6 @@
+class PartiesController < ApplicationController
+ def show
+ @partiers = User.partiers
+ @bostonians = User.bostonians
+ end
+end
@@ -1,7 +1,6 @@
class RegistrationsController < ApplicationController
def new
unless is_mobile_device?
- @registration = Registration.new
@developers = Registration.developers
@designers = Registration.designers
@startups = Startup.alphabetical
@@ -0,0 +1,8 @@
+class SessionsController < ApplicationController
+ def create
+ auth = request.env["omniauth.auth"]
+ user = User.find_or_create_by_auth(auth)
+ session[:user_id] = user.id
+ redirect_to party_url
+ end
+end
@@ -0,0 +1,5 @@
+class UsersController < ApplicationController
+ def update
+
+ end
+end
View
@@ -0,0 +1,20 @@
+class User < ActiveRecord::Base
+ def self.find_or_create_by_auth(auth)
+ find_by_provider_and_uid(auth["provider"], auth["uid"]) ||
+ create do |user|
+ user.provider = auth["provider"]
+ user.uid = auth["uid"]
+ user.name = auth["user_info"]["name"]
+ user.twitter = auth["user_info"]["nickname"]
+ user.description = auth["user_info"]["description"]
+ end
+ end
+
+ def self.partiers
+ where(:partying => true).order('name asc')
+ end
+
+ def self.bostonians
+ where(:partying => false).order('name asc')
+ end
+end
@@ -0,0 +1,16 @@
+<div id="after-party" class="clearfix">
+ <div class="wreath left">
+ <img src="/images/angel-investors.png" alt="angel-investors" width="215" height="200" />
+ </div>
+ <div id="after-party-description">
+ <%= link_to "http://maps.google.com/maps?cid=11425628393869581370" do %>
+ <h1>the after party</h1>
+ <h2>The Cavern Club</h2>
+ <h3>hard rock cafe faneuil hall</h3>
+ <h4>4-8pm saturday february 5th</h4>
+ <% end %>
+ </div>
+ <div class="wreath right">
+ <img src="/images/venture-capitalists.png" alt="venture-capitalists" width="215" height="200" />
+ </div>
+</div>
@@ -0,0 +1,64 @@
+<% content_for :header do %>
+ <%= render 'party' %>
+<% end %>
+
+<section id="main">
+ <% if current_user %>
+ <%= twitter_avatar current_user.twitter, 48 %>
+
+ <%= semantic_form_for current_user, :remote => true do |form| %>
+ <ol class="form">
+ <%= form.input :description, :label => "Tell local students about yourself" %>
+ <li id="radio">
+ <label>Are you attending the after-party?<abbr title="required">*</abbr></label>
+ <p class="radio partying">
+ <%= form.radio_button :partying, "Partying" %>
+ <%= form.label :partying, "Partying", :for => "user_partying_partying" %>
+ </p>
+ <p class="radio not-partying">
+ <%= form.radio_button :partying, "Not Partying" %>
+ <%= form.label :partying, "Not Partying... This Time", :for => "user_partying_not_partying" %>
+ </p>
+ </li>
+ <li id="submit-button">
+ <%= form.submit "Change RSVP", :disable_with => "Please wait..." %>
+ </li>
+ </ol>
+ <% end %>
+ <% else %>
+ <%= link_to "RSVP via Twitter", "/auth/twitter" %>
+ <% end %>
+
+ <section id="attendees">
+ <header>
+ <h1>Bostonians</h1>
+ </header>
+ <h2 id="developer-title">Partying</h2><h2 id="designer-title">not partying... this time</h2>
+ <div id="developer-attendees" class="left">
+ <ul>
+ <% @partiers.each do |partier| %>
+ <li>
+ <%= twitter_avatar partier.twitter, 48 %>
+ <hgroup>
+ <h3><%= partier.name %></h3>
+ <h4><%= partier.description %></h4>
+ </hgroup>
+ </li>
+ <% end %>
+ </ul>
+ </div>
+ <div id="designer-attendees" class="right">
+ <ul>
+ <% @bostonians.each do |bostonian| %>
+ <li>
+ <%= twitter_avatar bostonian.twitter, 48 %>
+ <hgroup>
+ <h3><%= bostonian.name %></h3>
+ <h4><%= bostonian.description %></h4>
+ </hgroup>
+ </li>
+ <% end %>
+ </ul>
+ </div>
+ </section>
+</section>
@@ -1,7 +1,7 @@
<header id="registration-banner">
<img src="/images/registration-banner.png" alt="registration-banner" width="422" height="145" />
</header>
-<%= semantic_form_for @registration, :remote => true,
+<%= semantic_form_for Registration.new, :remote => true,
:html => { :name => "Event Registration",
:id => "event-registration",
'data-type' => 'html' } do |form| %>
@@ -161,22 +161,8 @@
</div>
<hr class="bottom"/>
- <div id="after-party" class="clearfix">
- <div class="wreath left">
- <img src="/images/angel-investors.png" alt="angel-investors" width="215" height="200" />
- </div>
- <div id="after-party-description">
- <%= link_to "http://maps.google.com/maps?cid=11425628393869581370" do %>
- <h1>after party</h1>
- <h2>The Cavern Club</h2>
- <h3>hard rock cafe</h3>
- <h4>four o'clock in fanueil hall</h4>
- <% end %>
- </div>
- <div class="wreath right">
- <img src="/images/venture-capitalists.png" alt="venture-capitalists" width="215" height="200" />
- </div>
- </div>
+
+ <%= render :partial => 'party' %>
<hr class="top"/>
<section id="startup-tables">
@@ -16,7 +16,11 @@
</div>
</div>
<hr class="top" />
- <div id="dddd-logo">
- <a href="/"><img src="/images/DDDD-logo.png" alt="DDDD-logo" width="778" height="284" /></a>
- </div>
+ <% if content_for?(:header) %>
+ <%= yield :header %>
+ <% else %>
+ <div id="dddd-logo">
+ <a href="/"><img src="/images/DDDD-logo.png" alt="DDDD-logo" width="778" height="284" /></a>
+ </div>
+ <% end %>
</header>
@@ -0,0 +1,3 @@
+Rails.application.config.middleware.use OmniAuth::Builder do
+ provider :twitter, ENV['CONSUMER_KEY'], ENV['CONSUMER_SECRET']
+end
View
@@ -8,6 +8,10 @@
resources :startups, :only => [:index, :show]
resources :opportunities, :only => [:index]
resources :schools, :only => [:index]
+ resource :party, :only => [:show]
+ resources :users, :only => [:update]
match 'pages/what' => 'talks#index'
+
+ match "/auth/:provider/callback" => "sessions#create"
end
@@ -0,0 +1,21 @@
+class CreateUsers < ActiveRecord::Migration
+ def self.up
+ create_table :users do |t|
+ t.string :provider, :default => "", :null => false
+ t.string :uid, :default => "", :null => false
+ t.string :name, :default => "", :null => false
+ t.string :twitter, :default => "", :null => false
+ t.text :description, :default => "", :null => false
+ t.boolean :partying, :default => true
+
+ t.timestamps
+ end
+
+ add_index :users, [:provider, :uid]
+ add_index :users, :twitter
+ end
+
+ def self.down
+ drop_table :users
+ end
+end
@@ -0,0 +1,19 @@
+Feature: A Bostonian parties
+
+ In order to meet and mentor students
+ As a Bostonian in the web community
+ I want to attend the D8 after-party
+
+ Scenario: Bostonian RSVPs for after-party
+ Given I am on the after-party page
+ When I fill in "Full Name" with "Dan Croak"
+ And I fill in "Twitter Name" with "Croaky"
+ And I fill in "About" with "Developer at thoughtbot"
+ And I fill in "URL" with "http://thoughtbot.com"
+ And I press "RSVP"
+ Then I should see "It's only a party if you make it a party. See you there!"
+
+ Scenario: Bostonian does not fill in fields on after-party form
+ Given I am on the after-party page
+ And I press "RSVP"
+ Then I should see "can't be blank" on text inputs of the party form
@@ -12,6 +12,8 @@ def path_to(page_name)
'/'
when /the talks page/
talks_path
+ when /the after-party page/
+ party_path
# Add more mappings here.
when /the sign up page/i
Oops, something went wrong.

0 comments on commit 568c8c1

Please sign in to comment.