48 lines
1.3 KiB
Ruby
48 lines
1.3 KiB
Ruby
class MusicSessionsController < ApplicationController
|
|
|
|
respond_to :html
|
|
|
|
def show
|
|
@music_session = MusicSession.find(params[:id])
|
|
render :layout => "web"
|
|
end
|
|
|
|
def session_info
|
|
@can_view = true
|
|
@can_comment = false
|
|
|
|
# check whether user is logged in
|
|
if current_user.nil?
|
|
@music_session = MusicSession.new
|
|
@can_view = false
|
|
render :layout => "web", :status => 404
|
|
|
|
else
|
|
|
|
@music_session = MusicSession.find(params[:id])
|
|
current_user_invitation = Invitation.where("music_session_id = ? AND receiver_id = ?", @music_session.id, current_user.id)
|
|
|
|
@approved_rsvps = @music_session.approved_rsvps
|
|
@open_slots = @music_session.open_slots
|
|
@pending_invitations = @music_session.pending_invitations
|
|
|
|
unless @music_session.scheduled_start.nil?
|
|
if @music_session.scheduled_start > Time.now.utc
|
|
if @music_session.musician_access && @music_session.approval_required && invitations.blank?
|
|
@can_view = false
|
|
end
|
|
# only allow comments for invitees before the session has started
|
|
unless current_user_invitation.blank?
|
|
@can_comment = true
|
|
end
|
|
else
|
|
|
|
end
|
|
end
|
|
|
|
render :layout => "web"
|
|
end
|
|
end
|
|
|
|
end
|