Added a duration field to the talk submission page #83

Merged
merged 4 commits into from Apr 6, 2012
View
@@ -33,8 +33,17 @@ def self.talk_types
["Deep Dive", "Intro", "Survey", "Other"]
end
+ def self.talk_durations
+ ["50 Minutes", "20 Minutes"]
+ end
+
+ def duration
+ self[:duration] || Talk.talk_durations.first
+ end
+
validates_inclusion_of :video_approval, :in => video_approvals
validates_inclusion_of :talk_type, :in => talk_types
+ validates_inclusion_of :duration, :in => talk_durations, :allow_nil => true
validates_length_of :title, :maximum => 55
validates_length_of :abstract, :maximum => 2000
@@ -0,0 +1,9 @@
+class AddDurationToTalk < ActiveRecord::Migration
+ def self.up
+ add_column :talks, :duration, :string
+ end
+
+ def self.down
+ remove_column :talks, :duration
+ end
+end
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120215110221) do
+ActiveRecord::Schema.define(:version => 20120405014530) do
create_table "attendee_creds", :force => true do |t|
t.string "email", :default => "", :null => false
@@ -52,7 +52,6 @@
t.string "cached_slug"
t.string "company_url"
t.integer "attendee_cred_id"
- t.text "bio"
end
add_index "attendees", ["acct_activation_token"], :name => "index_attendees_on_acct_activation_token", :unique => true
@@ -138,12 +137,13 @@
t.integer "news_item_id"
t.string "locale"
t.text "body"
- t.string "external_url"
t.string "title"
+ t.string "external_url"
t.datetime "created_at"
t.datetime "updated_at"
end
+ add_index "news_item_translations", ["locale"], :name => "index_news_item_translations_on_locale"
add_index "news_item_translations", ["news_item_id"], :name => "index_news_item_translations_on_news_item_id"
create_table "news_items", :force => true do |t|
@@ -167,6 +167,7 @@
t.datetime "updated_at"
end
+ add_index "page_part_translations", ["locale"], :name => "index_page_part_translations_on_locale"
add_index "page_part_translations", ["page_part_id"], :name => "index_page_part_translations_on_page_part_id"
create_table "page_parts", :force => true do |t|
@@ -190,6 +191,7 @@
t.datetime "updated_at"
end
+ add_index "page_translations", ["locale"], :name => "index_page_translations_on_locale"
add_index "page_translations", ["page_id"], :name => "index_page_translations_on_page_id"
create_table "pages", :force => true do |t|
@@ -414,6 +416,7 @@
t.datetime "updated_at"
t.string "video_approval"
t.string "talk_type"
+ t.string "duration"
end
create_table "tracks", :force => true do |t|
@@ -25,13 +25,15 @@ Feature: As an anonymous user I can enter a talk along with
And I select "Deep Dive" in "Talk Type"
And I select "No" in "Video Approval"
And I select "United States" in "Country"
+ And I select "50 Minutes" in "Talk Duration"
And I fill in "Tags" with "theory, clojure"
And I should see "Max length: 2000 characters."
When I press "Send Talk Proposal"
Then I should see "Squashing NP Hard Problems with Clojure"
And I should see "Deep Dive"
+ And I should see "50 Minutes"
And I should see "Karp"
And I should see "projector"
And I should see "Clem Esterbill"
@@ -47,6 +49,53 @@ Feature: As an anonymous user I can enter a talk along with
And I should see "clojure"
And an email should be sent
+ Scenario: Users can enter a short talk
+ Given an admin exists
+ And I go to the talk submission page
+ And I fill in the following:
+ | Title | Squashing NP Hard Problems with Clojure |
+ | Abstract | Using only functions, sequences and three toothpicks I will make 3 SAT solvable in O(n) time |
+ | Reviewer Comments | Already have my solution approved by Karp |
+ | Prerequisites | Solving other NP-Hard problems in O(n) time |
+ | Audio/Video Requirement | Just need a projector capable of displaying two lines of code |
+ | First Name | Clem |
+ | Last Name | Esterbill |
+ | Email | clem_esterbill@fictionaldns.com |
+ | Twitter ID | clemtweets |
+ | Company | Clemalamadingdong |
+ | Company Website | http://clem.com |
+ | Bio | Background info here |
+ | Phone | 555-555-5555 |
+ | City | St. Louis |
+ | State | MO |
+
+ And I select "Deep Dive" in "Talk Type"
+ And I select "No" in "Video Approval"
+ And I select "United States" in "Country"
+ And I select "20 Minutes" in "Talk Duration"
+ And I fill in "Tags" with "theory, clojure"
+
+ And I should see "Max length: 2000 characters."
+
+ When I press "Send Talk Proposal"
+ Then I should see "Squashing NP Hard Problems with Clojure"
+ And I should see "Deep Dive"
+ And I should see "20 Minutes"
+ And I should see "Karp"
+ And I should see "projector"
+ And I should see "Clem Esterbill"
+ And I should see "clem_esterbill@fictionaldns.com"
+ And I should see a link with "@clemtweets" to "https://twitter.com/clemtweets"
+ And I should see a link with "Clemalamadingdong" to "http://clem.com"
+ And I should see "Background info here"
+ And I should see "555-555-5555"
+ And I should see "St. Louis"
+ And I should see "MO"
+ And I should see "United States"
+ And I should see "theory"
+ And I should see "clojure"
+ And an email should be sent
+
View
@@ -96,6 +96,7 @@
t.abstract 'A talk about samples'
t.talk_type 'Intro'
t.video_approval 'Yes'
+ t.duration '50 Minutes'
t.speakers { [Factory(:speaker)] }
end
@@ -53,7 +53,8 @@ def self.test_enum_fields(enum_field_hash)
end
test_enum_fields( {Talk.video_approvals => :video_approval,
- Talk.talk_types => :talk_type})
+ Talk.talk_types => :talk_type,
+ Talk.talk_durations => :duration})
it{ should_not allow_value("x" * 56).for(:title)}
it{ should allow_value("x" * 1201).for(:abstract)}
@@ -53,6 +53,9 @@
<%= talk_form.label :talk_type %>
<%= talk_form.select :talk_type, Talk.talk_types %>
+ <%= talk_form.label :talk_duration %>
+ <%= talk_form.select :duration, Talk.talk_durations, :include_blank => true %>
+
<%= talk_form.label :video_approval %>
<%= talk_form.select :video_approval, Talk.video_approvals %>
@@ -9,6 +9,7 @@
'abstract' => 'foo',
'talk_type' => 'Intro',
'video_approval' => 'Yes',
+ 'duration' => '50 Minutes',
'speakers_attributes' => {
'0' => {
'first_name' => 'Mario',
@@ -11,6 +11,8 @@
<div><%= talk.talk_type %></div>
<div>Video Approval</div>
<div><%= talk.video_approval %></div>
+ <div>Talk Duration</div>
+ <div><%= talk.duration %></div>
<div>Comments</div>
<div><%= talk.comments %></div>
<div>Prereqs</div>
@@ -14,6 +14,9 @@
:as => :select, :collection => Talk.talk_types %>
<%= talk_form.input :video_approval, :label => t('.video_approval'),
:as => :select, :collection => Talk.video_approvals, :hint => t('.video_approval_hint')%>
+ <%= talk_form.input :duration, :label => t('.duration'),
+ :as => :select, :collection => Talk.talk_durations,
+ :include_blank => false %>
<%= talk_form.input :comments, :label => t('.comments'),
:hint => t('.comments_hint') , :input_html => { :class => "freetext" }%>
<%= talk_form.input :prereqs, :label => t('.prereqs'),
@@ -73,6 +73,7 @@ en:
company: Company
company_url: Company Website
bio: Bio
+ bio_hint: ""
phone: Phone
phone_hint: "Optional, for emergency contact"
city: City
@@ -92,6 +93,7 @@ en:
talk_length: Talk Format
video_approval: Video Approval
video_approval_hint: "If talks are recorded, are you willing to have your talk recorded and released publicly? Even after the talk is recorded, you can change your mind and not release the video."
+ duration: Talk Duration
comments: Reviewer Comments
comments_hint: "These comments will not be released publicly but will be available to those reviewing your talk. It's a good place to indicate whether you have or have not done this talk before, your speaking experience, bribes, etc."
prereqs: Prerequisites
@@ -108,6 +110,7 @@ en:
company: Company
company_url: Company Website
bio: Bio
+ bio_hint: ""
phone: Phone
phone_hint: "Optional, for emergency contact"
city: City
@@ -143,6 +146,7 @@ en:
company: Company
company_url: Company Website
bio: Bio
+ bio_hint: ""
phone: Phone
phone_hint: "Optional, for emergency contact"
city: City
@@ -47,7 +47,7 @@ def valid_attributes(options = {})
it "requires valid attributes and a related Talk" do
p = Proposal.new(valid_attributes)
p.talk = Talk.new(:title => 'Writing a conf site', :abstract => 'Moar codez',
- :video_approval => 'Yes', :talk_type => 'Intro')
+ :video_approval => 'Yes', :talk_type => 'Intro', :duration => '50 Minutes')
p.should be_valid
end
end