forked from railsbridge/bridge_troll
-
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.
Remove volunteer/register buttons when rsvps are closed. Display text…
… "RSVPs are closed!" on upcoming and event show page. Allow organizers to reopen RSVPs for an event from organizer console.
- Loading branch information
Bita Djaghouri
committed
Aug 2, 2015
1 parent
81edc1c
commit d8648d3
Showing
10 changed files
with
202 additions
and
70 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
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
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
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
<% if event.allow_student_rsvp? %> | ||
<% if event.open? %> | ||
<% if event.allow_student_rsvp? %> | ||
<a href="#sign_in_dialog" | ||
class="btn sign-in-button" | ||
data-sign-up-return-to="<%= event_path(event) %>" | ||
data-return-to="<%= if stay_on_event then event_path(event) else learn_new_event_rsvp_path(event) end %>"> | ||
<%= student_attend_button_text(event) %> | ||
</a> | ||
<% end %> | ||
<a href="#sign_in_dialog" | ||
class="btn sign-in-button" | ||
data-sign-up-return-to="<%= event_path(event) %>" | ||
data-return-to="<%= if stay_on_event then event_path(event) else learn_new_event_rsvp_path(event) end %>"> | ||
<%= student_attend_button_text(event) %> | ||
data-return-to="<%= if stay_on_event then event_path(event) else volunteer_new_event_rsvp_path(event) end %>"> | ||
<%= volunteer_attend_button_text(event) %> | ||
</a> | ||
<% else %> | ||
<div class='rsvp-text'>RSVPs are closed!</div> | ||
<% end %> | ||
<a href="#sign_in_dialog" | ||
class="btn sign-in-button" | ||
data-sign-up-return-to="<%= event_path(event) %>" | ||
data-return-to="<%= if stay_on_event then event_path(event) else volunteer_new_event_rsvp_path(event) end %>"> | ||
<%= volunteer_attend_button_text(event) %> | ||
</a> |
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 |
---|---|---|
|
@@ -51,6 +51,7 @@ | |
get "diets" | ||
get "rsvp_preview" | ||
get "close_rsvps" | ||
get "reopen_rsvps" | ||
end | ||
|
||
collection do | ||
|
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 |
---|---|---|
@@ -1,42 +1,94 @@ | ||
require 'rails_helper' | ||
|
||
describe "organizer closes RSVPs" do | ||
describe "Opening and closing an event for RSVP" do | ||
|
||
context "when RSVPs are open" do | ||
before do | ||
@event = create(:event) | ||
@event.open = true | ||
@event.save | ||
end | ||
|
||
it "allows volunteers to RSVP" do | ||
create(:event) | ||
|
||
visit root_path | ||
context "when potential attendees view closed event" do | ||
before do | ||
visit root_path | ||
end | ||
|
||
within(".upcoming-events") do | ||
expect(page).to have_link('Volunteer') | ||
it "allows volunteers to RSVP" do | ||
within(".upcoming-events") do | ||
expect(page).to have_link('Volunteer') | ||
end | ||
end | ||
end | ||
|
||
it "allows students to RSVP" | ||
it "allows students to RSVP" do | ||
within(".upcoming-events") do | ||
expect(page).to have_link("Attend as a student") | ||
end | ||
end | ||
end | ||
|
||
it "allows the organizers to close RSVPs" do | ||
event = create(:event) | ||
organizer = create(:user) | ||
event.organizers << organizer | ||
sign_in_as(organizer) | ||
context "when organizer manages the event" do | ||
it "allows the organizers to close RSVPs" do | ||
organizer = create(:user) | ||
@event.organizers << organizer | ||
sign_in_as(organizer) | ||
|
||
visit event_organizer_tools_path(event) | ||
click_link("Close RSVPs") | ||
visit event_organizer_tools_path(@event) | ||
click_link("Close RSVPs") | ||
|
||
within(".alert-success") do | ||
expect(page).to have_content("RSVPs closed successfully.") | ||
within(".alert-success") do | ||
expect(page).to have_content("RSVPs closed successfully.") | ||
end | ||
expect(@event.reload).to be_closed | ||
end | ||
expect(event.reload).to be_closed | ||
end | ||
|
||
end | ||
|
||
context "when RSVPs are closed" do | ||
it "prevents volunteers from RSVPing" | ||
it "pevents students from RSVPing" | ||
it "allows organizers to reopen RSVPs" | ||
end | ||
before do | ||
@event = create(:event) | ||
@event.open = false | ||
@event.save | ||
end | ||
|
||
context "when potential attendees view closed event" do | ||
before do | ||
visit root_path | ||
end | ||
|
||
it "prevents volunteers from RSVPing" do | ||
within(".upcoming-events") do | ||
expect(page).to_not have_link('Volunteer') | ||
end | ||
end | ||
|
||
it "prevents students from RSVPing" do | ||
within(".upcoming-events") do | ||
expect(page).to_not have_link("Attend as a student") | ||
end | ||
end | ||
|
||
it "presents message that RSVPs are closed" do | ||
within(".upcoming-events") do | ||
expect(page).to have_content("RSVPs are closed!") | ||
end | ||
end | ||
end | ||
|
||
context "when organizer manages the event" do | ||
it "allows organizers to reopen RSVPs" do | ||
organizer = create(:user) | ||
@event.organizers << organizer | ||
sign_in_as(organizer) | ||
|
||
visit event_organizer_tools_path(@event) | ||
click_link("Open RSVPs") | ||
|
||
within(".alert-success") do | ||
expect(page).to have_content("RSVPs reopened successfully.") | ||
end | ||
expect(@event.reload).to be_open | ||
end | ||
end | ||
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