VRFS-1823 allow anonymous users to view session info page

This commit is contained in:
Brian Smith 2014-07-06 23:07:58 -04:00
parent 627a403009
commit 71c22417d4
4 changed files with 79 additions and 78 deletions

View File

@ -830,7 +830,7 @@
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-view-profile",
id: "btn-manage-rsvp",
text: "Manage RSVP",
"layout-action": "close",
href: "/client#/account/sessionDetail/" + payload.session_id,

View File

@ -8,17 +8,11 @@ class MusicSessionsController < ApplicationController
end
def session_info
@can_view = true
@music_session = MusicSession.find(params[:id])
# 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])
unless current_user.nil?
invitations = Invitation.where("music_session_id = ? AND receiver_id = ?", @music_session.id, current_user.id)
has_invitation = !invitations.blank?
@ -53,6 +47,9 @@ class MusicSessionsController < ApplicationController
end
render :layout => "web"
else
render :layout => "web"
end
end

View File

@ -15,10 +15,11 @@
%span.f12 Session Creator
%br/
%br/
- if current_user.id != @music_session.creator.id || (@open_slots.blank? && !@approved_rsvps.include?(current_user))
.f12.call-to-action
%br/
%a.button-orange{:id => "btn-action"}
- if !current_user.nil?
- if (current_user.id != @music_session.creator.id) || (@open_slots.blank? && !@approved_rsvps.include?(current_user))
.f12.call-to-action
%br/
%a.button-orange{:id => "btn-action"}
.landing-details
.left.f20.teal
%strong SESSION
@ -40,11 +41,12 @@
%strong Description:
.right.w75.ib.mb10.description
= @music_session.description
.clearall.left.w20.ib.mb10
%strong Notation Files:
.right.w75.ib.mb10.notations
- @music_session.music_notations.each do |n|
%a.gold{:href => n.file_url, :target => "_blank"}= n.file_name
- if !current_user.nil?
.clearall.left.w20.ib.mb10
%strong Notation Files:
.right.w75.ib.mb10.notations
- @music_session.music_notations.each do |n|
%a.gold{:href => n.file_url, :target => "_blank"}= n.file_name
.clearall.left.w20.ib.mb10
%strong Language:
.right.w75.ib.mb10.language
@ -67,70 +69,71 @@
%br{clear:'all'}/
.landing-sidebar
%br/
%h2 SESSION MUSICIANS
%br/
.left.w65.ib
%strong RSVPs
.right.w30.ib.f11 Your latency
- if @approved_rsvps.blank?
None
- @approved_rsvps.each_with_index do |rsvp, index|
.clearall.left.w100.h20.ib.mb10.rsvp-details
.avatar-tiny{'hoveraction' => "musician", 'user-id' => rsvp.id}
- if rsvp.photo_url.nil?
= image_tag 'shared/avatar_generic.png', :alt => ""
- else
%img{:src => "#{rsvp.photo_url}"}
.left.f11.ml10.rsvp-name
= rsvp.name
.left.ml10
- rsvp.instrument_list.each do |i|
%img.instrument-icon{'instrument-id' => i[:id], height:24, width:24}
.right.w30.ib.f11.center.latency-tags
- unless current_user.nil?
.landing-sidebar
%br/
%h2 SESSION MUSICIANS
%br/
.left.w65.ib
%strong RSVPs
.right.w30.ib.f11 Your latency
- if @approved_rsvps.blank?
None
- @approved_rsvps.each_with_index do |rsvp, index|
.clearall.left.w100.h20.ib.mb10.rsvp-details
.avatar-tiny{'hoveraction' => "musician", 'user-id' => rsvp.id}
- if rsvp.photo_url.nil?
= image_tag 'shared/avatar_generic.png', :alt => ""
- else
%img{:src => "#{rsvp.photo_url}"}
.left.f11.ml10.rsvp-name
= rsvp.name
.left.ml10
- rsvp.instrument_list.each do |i|
%img.instrument-icon{'instrument-id' => i[:id], height:24, width:24}
.right.w30.ib.f11.center.latency-tags
%br{:clear => "all"}/
%br/
.left.w65.ib.still-needed
%strong Still Needed
- if @open_slots.blank?
.clearall.left.w100.h20.ib.mb10
All slots are taken
- else
- @open_slots.each do |slot|
%br{:clear => "all"}/
%br/
.left.w65.ib.still-needed
%strong Still Needed
- if @open_slots.blank?
.clearall.left.w100.h20.ib.mb10
.ib.h20
%img.instrument-icon{'instrument-id' => slot.instrument_id, height:24, width:24}
.f11.ml10.ib.h20
= slot.instrument_id.capitalize
= "(#{slot.proficiency_desc})"
All slots are taken
- else
- @open_slots.each do |slot|
.clearall.left.w100.h20.ib.mb10
.ib.h20
%img.instrument-icon{'instrument-id' => slot.instrument_id, height:24, width:24}
.f11.ml10.ib.h20
= slot.instrument_id.capitalize
= "(#{slot.proficiency_desc})"
%br{:clear => "all"}/
%br/
.w65.ib.invited
%strong Invited
%br/
- if @pending_invitations.blank?
None
- @pending_invitations.each_with_index do |invite, index|
- if index == 0
.avatar-tiny.needed{'hoveraction' => "musician", 'user-id' => invite.id}
- unless invite.photo_url.blank?
= image_tag "#{invite.photo_url}", alt: ""
- else
= image_tag "shared/avatar_generic.png", alt: ""
- else
.ml10.avatar-tiny.needed
- unless invite.photo_url.blank?
= image_tag "#{invite.photo_url}", alt: ""
- else
= image_tag "shared/avatar_generic.png", alt: ""
%br{:clear => "all"}/
%br/
.w65.ib.invited
%strong Invited
%br/
- if @pending_invitations.blank?
None
- @pending_invitations.each_with_index do |invite, index|
- if index == 0
.avatar-tiny.needed{'hoveraction' => "musician", 'user-id' => invite.id}
- unless invite.photo_url.blank?
= image_tag "#{invite.photo_url}", alt: ""
- else
= image_tag "shared/avatar_generic.png", alt: ""
- else
.ml10.avatar-tiny.needed
- unless invite.photo_url.blank?
= image_tag "#{invite.photo_url}", alt: ""
- else
= image_tag "shared/avatar_generic.png", alt: ""
- else
.left.f20.teal
%strong.not-found SESSION NOT FOUND
%strong.not-found PRIVATE SESSION
%br/
.clearall.left.w20.ib.mb10
@ -138,7 +141,8 @@
%br/
- content_for :after_black_bar do
%br/
= render :partial => "shared/comments", :locals => {:comments => @music_session.session_info_comments, :id => "txtSessionInfoComment", :info_page => true}
- unless current_user.nil?
= render :partial => "shared/comments", :locals => {:comments => @music_session.session_info_comments, :id => "txtSessionInfoComment", :info_page => true}
- content_for :extra_js do
:javascript

View File

@ -111,7 +111,7 @@ describe "Session Info", :js => true, :type => :feature, :capybara_feature => tr
end
def ensure_failure
find('strong.not-found', text: "SESSION NOT FOUND")
find('strong.not-found', text: "PRIVATE SESSION")
end
describe "view" do