Merge branch 'feature/sched_sessions_rsvps' into feature/scheduled_sessions

This commit is contained in:
Brian Smith 2014-05-25 18:26:54 -04:00
commit 2cef0872d9
10 changed files with 159 additions and 6 deletions

View File

@ -20,6 +20,7 @@ module JamRuby
has_many :music_session_user_histories, :class_name => "JamRuby::MusicSessionUserHistory", :foreign_key => "music_session_id", :dependent => :delete_all
has_many :comments, :class_name => "JamRuby::MusicSessionComment", :foreign_key => "music_session_id"
has_many :session_info_comments, :class_name => "JamRuby::SessionInfoComment", :foreign_key => "music_session_id"
has_many :likes, :class_name => "JamRuby::MusicSessionLiker", :foreign_key => "session_id"
has_many :plays, :class_name => "JamRuby::PlayablePlay", :as => :playable, :dependent => :destroy
has_one :share_token, :class_name => "JamRuby::ShareToken", :inverse_of => :shareable, :foreign_key => 'shareable_id'
@ -274,6 +275,21 @@ module JamRuby
self.creator == user && self.started_at.nil?
end
def legal_policy_url
# TODO: move to DB or config file
case legal_policy
when "standard"
return "http://www.jamkazam.com/session-legal-policies/standard"
when "creative"
return "http://www.jamkazam.com/session-legal-policies/creativecommons"
when "offline"
return "http://www.jamkazam.com/session-legal-policies/offline"
when "jamtracks"
return "http://www.jamkazam.com/session-legal-policies/jamtracks"
else
return ""
end
def recordings
Recording.where(music_session_id: self.id)
end

View File

@ -0,0 +1,17 @@
(function(context, $) {
"use strict";
context.JK = context.JK || {};
context.JK.ShowSessionInfo = function(app) {
var logger = context.JK.logger;
var rest = JK.Rest();
function initialize(musicSessionId) {
}
this.initialize = initialize;
}
})(window, jQuery);

View File

@ -53,6 +53,7 @@
//= require web/downloads
//= require web/congratulations
//= require web/sessions
//= require web/scheduled_session
//= require web/recordings
//= require web/welcome
//= require banner

View File

@ -307,6 +307,10 @@
width:110px;
}
a.gold {
color: #cc9900 !important;
}
a.arrow-up {
float:right;
margin-right:5px;
@ -465,6 +469,10 @@ ul.shortcuts {
}
}
.clearall {
clear: both;
}
.tagline {
font-size:30px;
margin-top:35px;
@ -495,6 +503,10 @@ a.arrow-down-orange {
white-space:normal;
}
.ib {
display: inline-block;
}
.w0 {width:0% !important}
.w5 {width:5% !important}
.w10 {width:10% !important}

View File

@ -8,8 +8,37 @@ class MusicSessionsController < ApplicationController
end
def session_info
@music_session = MusicSession.find(params[:id])
render :layout => "web"
@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)
# get all invitations for users that do not have an RSVP request
@pending_invitations =
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
render :layout => "web"
end
end
end

View File

@ -13,7 +13,7 @@ if !current_user
}
else
attributes :id, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :band_id, :user_id, :claimed_recording_initiator_id, :track_changes_counter, :max_score
attributes :id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :band_id, :user_id, :claimed_recording_initiator_id, :track_changes_counter, :max_score
node :genres do |item|
[item.genre.description] # XXX: need to return single genre; not array

View File

@ -16,8 +16,8 @@ if !current_user
}
else
attributes :id, :music_session_id, :description, :musician_access, :approval_required, :fan_access, :fan_chat,
:band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :scheduled_start, :scheduled_duration
attributes :id, :music_session_id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat,
:band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :scheduled_start, :scheduled_duration, :language
node :share_url do |history|
unless history.share_token.nil?

View File

@ -0,0 +1,78 @@
- unless @music_session.nil?
- provide(:title, @music_session.name)
.sessions-page
- if @can_view
.landing-band
.landing-avatar
- unless @music_session.creator.photo_url.blank?
= image_tag "#{@music_session.creator.photo_url}", alt: ""
- else
= image_tag "shared/avatar_generic.png", alt: ""
- end
= @music_session.creator.name
%br/
%span.f12 Session Creator
%br/
%br/
.f12 Tell the session creator you'd like to play in this session
%br/
%br/
%a.button-orange{:id => "btn-rsvp"}
RSVP NOW!
.landing-details
.left.f20.teal
%strong SESSION
%br/
%strong Date/Time:
.right.w75.ib.mb10
= @music_session.scheduled_start
.clearall.left.w20.ib.mb10
%strong Genre:
.right.w75.ib.mb10
= @music_session.scheduled_start
.clearall.left.w20.ib.mb10
%strong Name:
.right.w75.ib.mb10
= @music_session.name
.clearall.left.w20.ib.mb10
%strong Description:
.right.w75.ib.mb10
= @music_session.description
.clearall.left.w20.ib.mb10
%strong Notation Files:
.right.w75.ib.mb10
- @music_session.music_notations.each do |n|
%a.gold{:href => n.file_url}&nbsp;
.clearall.left.w20.ib.mb10
%strong Language:
.right.w75.ib.mb10
= @music_session.language
.clearall.left.w20.ib.mb10
%strong Access:
.right.w75.ib.mb10
= @music_session.access
.clearall.left.w20.ib.mb10
%strong Legal:
.right.w75.ib.mb10
= @music_session.legal_policy.capitalize agreement(
%a.{:href => @music_session.legal_policy_url, :target => "_blank"} View full legal details)
%br{clear:'all'}
.landing-sidebar
%br/
%h2 SESSION MUSICIANS
%br/
.left.w65.ib
%strong RSVPs
.right.w30.ib.f11.center Your latency
- else
.left.f20.teal
%strong SESSION NOT FOUND
%br/
.clearall.left.w20.ib.mb10

View File

@ -88,7 +88,7 @@
%td
.nowrap
- track.instrument_ids.uniq.each do |instrument_id|
%img.instrument-icon{'instrument-id' =>instrument_id, height:24, width:24}
%img.instrument-icon{'instrument-id' => instrument_id, height:24, width:24}
%br{:clear => "all"}/
%br/