Workshop interest

This commit is contained in:
Godwin
2015-09-13 18:30:50 -07:00
parent a90c465160
commit a0fbbc9f4f
88 changed files with 2067 additions and 819 deletions
+18
View File
@@ -888,6 +888,24 @@ class ConferencesController < ApplicationController
redirect_to view_workshop_url(@this_conference.slug, workshop.id)
end
def toggle_workshop_interest
set_conference
set_conference_registration
workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id)
do_404 unless workshop
# save the current state
interested = workshop.interested? current_user
# remove all associated fields
WorkshopInterest.delete_all(:workshop_id => workshop.id, :user_id => current_user.id)
# creat the new interest row if we weren't interested before
WorkshopInterest.create(:workshop_id => workshop.id, :user_id => current_user.id) unless interested
# go back to the workshop
redirect_to view_workshop_url(@this_conference.slug, workshop.id)
end
# DELETE /conferences/1
#def destroy
# @conference.destroy