Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
make update my RSVP form work
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Croak committed Feb 4, 2011
1 parent b21b9ac commit 31c315f
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 1,336 deletions.
6 changes: 5 additions & 1 deletion app/controllers/users_controller.rb
@@ -1,5 +1,9 @@
class UsersController < ApplicationController
def update

if current_user.update_attributes(params[:user])
render :partial => 'parties/thanks'
else
render :partial => 'parties/form'
end
end
end
26 changes: 26 additions & 0 deletions app/views/parties/_form.html.erb
@@ -0,0 +1,26 @@
<section id="registration">
<header id="registration-banner">
<img src="/images/RSVP-banner.png" alt="registration-banner" width="422" height="145" />
</header>
<%= semantic_form_for current_user, :remote => true,
:html => { :id => "event-registration",
'data-type' => 'html' } do |form| %>
<ol class="form">
<%= form.input :description, :label => "Tell local students about yourself", :required => true %>
<li id="radio">
<label>Are you attending the after-party?<abbr title="required">*</abbr></label>
<p class="radio developer">
<%= form.radio_button :partying, "Partying", :checked => "checked" %>
<%= form.label :partying, "Partying", :for => "user_partying_partying" %>
</p>
<p class="radio designer">
<%= form.radio_button :partying, "Not Partying" %>
<%= form.label :partying, "Not Partying", :for => "user_partying_not_partying" %>
</p>
</li>
<li id="submit-button">
<%= form.submit "Change RSVP", :disable_with => "Please wait..." %>
</li>
</ol>
<% end %>
</section>
3 changes: 3 additions & 0 deletions app/views/parties/_thanks.html.erb
@@ -0,0 +1,3 @@
<div class="student">
<h2>Thanks for RSVPing!</h2>
</div>
27 changes: 1 addition & 26 deletions app/views/parties/show.html.erb
Expand Up @@ -4,32 +4,7 @@

<section id="main-continue" class="party-main">
<% if current_user %>
<section id="registration">
<header id="registration-banner">
<img src="/images/RSVP-banner.png" alt="registration-banner" width="422" height="145" />
</header>
<%= semantic_form_for current_user, :remote => true,
:html => { :id => "event-registration",
'data-type' => 'html' } do |form| %>
<ol class="form">
<%= form.input :description, :label => "Tell local students about yourself", :required => true %>
<li id="radio">
<label>Are you attending the after-party?<abbr title="required">*</abbr></label>
<p class="radio developer">
<%= form.radio_button :partying, "Partying" %>
<%= form.label :partying, "Partying", :for => "user_partying_partying" %>
</p>
<p class="radio designer">
<%= form.radio_button :partying, "Not Partying" %>
<%= form.label :partying, "Not Partying", :for => "user_partying_not_partying" %>
</p>
</li>
<li id="submit-button">
<%= form.submit "Change RSVP", :disable_with => "Please wait..." %>
</li>
</ol>
<% end %>
</section>
<%= render :partial => 'form' %>
<% else %>
<% link_to "/auth/twitter" do %>
<div class="register-button top clearfix">
Expand Down
2 changes: 1 addition & 1 deletion app/views/registrations/_thanks.html.erb
Expand Up @@ -9,7 +9,7 @@
<%= registration.role %>, <%= registration.school.name %>
</div>
</div>
<h2>Thanks for registering! We can't wait to see you!</>
<h2>Thanks for registering! We can't wait to see you!</h2>
<h3>Follow @<a href="http://twitter.com/thoughtbot">thoughtbot</a> and @<a href="http://twitter.com/greenhornboston">greenhornboston</a> for updates.</h3>
<h3>We also invite you to join our private <a href="http://groups.google.com/group/developers-developers-developers-developers">mailing list</a> for speakers and attending students.</h3>
</div>
12 changes: 2 additions & 10 deletions features/bostonian_parties.feature
Expand Up @@ -6,14 +6,6 @@ Feature: A Bostonian parties

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"
When I follow "RSVP via Twitter"
And I authenticate my Twitter account
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
9 changes: 4 additions & 5 deletions public/javascripts/application.js
@@ -1,8 +1,7 @@
$(document).ready(function() {
$("#event-registration")
.live("ajax:success", function(xhr, data, status) {
$("#registration").html(data);
});
$("#event-registration").live("ajax:success", function(xhr, data, status) {
$("#registration").html(data);
});

$('a[href^=#]').bind('click', function(e) {
e.preventDefault(); //prevent the "normal" behaviour which would be a "hard" jump
Expand All @@ -15,4 +14,4 @@ $(document).ready(function() {

return false;
});
});
});
8 changes: 7 additions & 1 deletion public/stylesheets/sass/screen.scss
Expand Up @@ -948,6 +948,12 @@ ul.ui-menu {

}
.party-main {
padding-top: 30px;
.student {
padding: 30px;
h2 {
font-size: 16px;
text-align: center;
}
}
}
}

0 comments on commit 31c315f

Please sign in to comment.