Skip to content
Browse files

Merge branch 'release/0.1.8'

  • Loading branch information...
2 parents 46520fa + a9c7df5 commit 92d1883a5053abc2ac1aab6154ecf152846cac44 @jeffkreeftmeijer jeffkreeftmeijer committed Jun 25, 2011
View
1 Gemfile
@@ -21,6 +21,7 @@ gem 'omniauth'
gem 'gravtastic'
+gem 'wufoo'
gem 'gust', :path => 'vendor/gems/gust'
gem 'rpm_contrib'
View
5 Gemfile.lock
@@ -92,6 +92,8 @@ GEM
hoptoad_notifier (2.4.11)
activesupport
builder
+ httparty (0.2.2)
+ json (~> 1.1)
i18n (0.6.0)
jquery-rails (1.0.7)
railties (~> 3.0)
@@ -247,6 +249,8 @@ GEM
multi_json (>= 1.0.2)
vcr (1.10.0)
watchr (0.7)
+ wufoo (0.2.0)
+ httparty (= 0.2.2)
xpath (0.1.4)
nokogiri (~> 1.3)
@@ -284,3 +288,4 @@ DEPENDENCIES
uglifier
vcr
watchr
+ wufoo
View
33 app/assets/stylesheets/sass/application.sass.erb
@@ -229,20 +229,29 @@ strong
font-weight: 900
#footer
- margin: 10px 5px
- font-size: 10px
- color: #eee
+ color: #666
+ padding: 0 10px 0 5px
- span
- padding-left: 5px
- color: #666
+ .left
+ width: 50%
+ float: left
- a
- background-image: url(<%= asset_path '6sync.png' %>)
- text-indent: -9999px
- height: 28px
- width: 73px
- display: block
+ span
+ font-size: 10px
+ padding-left: 5px
+
+ a
+ background-image: url(<%= asset_path '6sync.png' %>)
+ text-indent: -9999px
+ height: 28px
+ width: 73px
+ display: block
+
+ .right
+ width: 50%
+ float: right
+ text-align: right
+ padding-top: 5px
span#submitter
font-size: 12px
View
19 app/controllers/submissions_controller.rb
@@ -0,0 +1,19 @@
+require 'wufoo'
+
+class SubmissionsController < ApplicationController
+ def new
+ redirect_to "/auth/github?origin=#{request.env['PATH_INFO']}" unless logged_in?
+ end
+
+ def create
+ client = Wufoo::Client.new(Codebrawl.config['wufoo']['url'], Codebrawl.config['wufoo']['api_key'])
+ submission = Wufoo::Submission.new(client, Codebrawl.config['wufoo']['form'])
+
+ response = submission.add_params({
+ '1' => current_user.login,
+ '103' => params['idea'],
+ }).process
+
+ redirect_to root_path, :notice => 'Thanks for your submission! We\'ll check it out and let you know if we decide to use it.'
+ end
+end
View
9 app/views/layouts/application.haml
@@ -34,8 +34,13 @@
= yield
#footer
- %span hosted by
- %a{:href => 'http://6sync.com'} 6Sync
+ .left
+ %span
+ hosted by
+ =link_to '6sync', 'http://6sync.com'
+ .right
+ =link_to 'Submit a contest idea', [:new, :submission]
+ %hr
:javascript
var woo_settings = {idle_timeout:'300000', domain:'codebrawl.com'};
View
6 app/views/submissions/new.haml
@@ -0,0 +1,6 @@
+%h2 Submit your contest idea
+
+= form_tag '/submissions' do
+ = text_area_tag :idea
+
+ = submit_tag 'Submit'
View
4 config/codebrawl.yml
@@ -0,0 +1,4 @@
+wufoo:
+ url: 'http://codebrawl.wufoo.com'
+ api_key: '8LIS-8G83-GDCD-TVY6'
+ form: 'contest-submission'
View
5 config/initializers/codebrawl.rb
@@ -0,0 +1,5 @@
+module Codebrawl
+ def self.config
+ @config ||= YAML.load_file(File.expand_path('../../codebrawl.yml', __FILE__))
+ end
+end
View
1 config/routes.rb
@@ -6,6 +6,7 @@
end
resources :users, :only => :show
+ resources :submissions, :only => [:new, :create]
resource :session, :only => [:create, :destroy]
View
8 spec/acceptance/contest_index_spec.rb
@@ -1,7 +1,7 @@
require 'acceptance/acceptance_helper'
feature 'Homepage' do
-
+
scenario 'be redirected to the homepage when accessing /contests' do
# TODO: Move this one to a controller spec
visit '/contests'
@@ -79,6 +79,12 @@
end
end
+ scenario 'visit the submissions page' do
+ click_link 'Submit a contest idea'
+ page.should have_content 'Submit your contest idea'
+ page.should have_content 'charlie'
+ end
+
context 'after logging in' do
background { login_via_github }
View
14 spec/acceptance/submissions_spec.rb
@@ -0,0 +1,14 @@
+require 'acceptance/acceptance_helper'
+
+feature 'Submissions' do
+ background { visit '/submissions/new' }
+
+ scenario 'successfully submit a submission' do
+ VCR.use_cassette(:wufoo) do
+ fill_in 'idea', :with => 'Building an RSpec formatter'
+ click_button 'Submit'
+ end
+
+ page.should have_content 'Thanks for your submission! We\'ll check it out and let you know if we decide to use it.'
+ end
+end
View
35 spec/fixtures/vcr_cassettes/wufoo.yml
@@ -0,0 +1,35 @@
+---
+- !ruby/struct:VCR::HTTPInteraction
+ request: !ruby/struct:VCR::Request
+ method: :post
+ uri: http://codebrawl.wufoo.com:80/api/insert/?1=charlie&103=Building%20an%20RSpec%20formatter&w_form=contest-submission&w_api_key=8LIS-8G83-GDCD-TVY6
+ body: 1=charlie&103=Building%20an%20RSpec%20formatter&w_form=contest-submission&w_api_key=8LIS-8G83-GDCD-TVY6
+ headers: !!null
+ response: !ruby/struct:VCR::Response
+ status: !ruby/struct:VCR::ResponseStatus
+ code: 200
+ message: OK
+ headers:
+ date:
+ - Sat, 25 Jun 2011 13:42:47 GMT
+ server:
+ - Apache
+ x-powered-by:
+ - PHP/5.2.16
+ set-cookie:
+ - PHPSESSID=qpv7igrbff9frcbiua3mjidd11; path=/; domain=.wufoo.com
+ expires:
+ - Thu, 19 Nov 1981 08:52:00 GMT
+ cache-control:
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
+ pragma:
+ - no-cache
+ vary:
+ - Accept-Encoding
+ content-length:
+ - '154'
+ content-type:
+ - text/xml
+ body: ! '{"wufoo_submit":[{"success":"true", "entry_id":"4", "redirect_url":"",
+ "confirmation_message":"Success! Thanks for filling out my form!", "merchant":""}]}'
+ http_version: '1.1'

0 comments on commit 92d1883

Please sign in to comment.
Something went wrong with that request. Please try again.