This commit is contained in:
Seth Call 2020-04-30 12:05:59 -05:00
parent 18e321dc55
commit 484454caae
6 changed files with 173 additions and 117 deletions

View File

@ -949,4 +949,4 @@ module JamRuby
music_session.lesson_session
end
end
end
end

View File

@ -4,6 +4,8 @@ context = window
mixins: [Reflux.listenTo(@AppStore, "onAppInit")]
LIMIT: 50
getInitialState: () ->
{sessions: [], currentPage: 0, next: null, searching: false, count: 0}
@ -49,16 +51,29 @@ context = window
<div className="content-body-scroller">
<div className="content-wrapper">
<div id="sessions-active" className="session-container">
<h2>sessions for me</h2>
<div className="header-zone">
<h2>sessions for me</h2>
<div className="refresh-btn">
<a href="/client#/findSession" style={{textDecoration:'none'}}
className="button-grey btn-refresh">REFRESH<span class="extra"></span></a>
</div>
<div className="search-box">
<input className="session-keyword-srch" type="text" name="search"
placeholder="Search by Keyword"/>
</div>
</div>
<br/>
<div className="findsession-container">
<table id="sessions-active" className="findsession-table" cellspacing="0"
cellpadding="0" border="0">
<tr>
<th align="left" width="30%">SESSION</th>
<th align="left" width="35%">MUSICIANS</th>
<th align="left" width="30%" style={{textAlign:'center'}}>ACTIONS</th>
<th align="left" width="40%">SESSION</th>
<th align="left" width="45%">MUSICIANS</th>
<th align="left" width="10%" style={{textAlign:'center'}}>ACTIONS</th>
</tr>
{results}
</table>

View File

@ -8,13 +8,11 @@ logger = context.JK.logger
instruments = []
existingTracks = []
for j in [0 .. participant.tracks.length]
track = participant.tracks[j]
logger.debug("Find:Finding instruments. Participant tracks:", participant.tracks)
for track in participant.tracks
if existingTracks.indexOf(track.instrument_id) < 0
existingTracks.push(track.instrument_id)
logger.debug("Find:Finding instruments. Participant tracks:", participant.tracks)
inst = context.JK.getInstrumentIcon24(track.instrument_id)
instruments.push(`<img title={context.JK.getInstrumentId(track.instrument_id)} hoveraction="instrument" data-instrument-id={track.instrument_id} src={inst} width="24" height="24" />`)
@ -50,8 +48,24 @@ logger = context.JK.logger
createOpenSlot:(slot) ->
inst = context.JK.getInstrumentIcon24(slot.instrument_id);
` <tr>
proficiency_desc = slot.proficiency_desc
if !proficiency_desc
# this is to allow unstructured RSVPs to not specify proficiency_desc
proficiency_desc = "Any Skill Level"
moreLinkHtml = '';
if isLast
moreLinkHtml = `<span><a className="slots more">more</a><a className="details-arrow arrow-down-orange"></a></span>`
instrument_url = inst
instrument = slot.description
proficiency = proficiency_desc
more_link = moreLinkHtml
`<tr>
<td width="24">
<img src="{instrument_url}" />
</td>
@ -61,24 +75,24 @@ logger = context.JK.logger
<td>{more_link}&nbsp;</td>
</tr>`
createRsvpUser: (user, session, isLast) ->
instrumentLogoHtml = []
instruments = []
if user.instrument_list
for j in [0 .. user.instrument_list.length]
instrument = user.instrument_list[j];
for instrument in user.instrument_list
inst = context.JK.getInstrumentIcon24(instrument.id);
instrumentLogoHtml.push(`<img title={context.JK.getInstrumentId(instrument.id)} hoveraction="instrument" data-instrument-id={instrument.id} src={inst} width="24" height="24" />`)
instruments.push(`<img title={context.JK.getInstrumentId(instrument.id)} hoveraction="instrument" data-instrument-id={instrument.id} key={instrument.id} src={inst} width="24" height="24" />`)
moreLinkHtml = '';
if isLast
moreLinkHtml = `<span><a class="rsvps more">more</a><a className="details-arrow arrow-down-orange"></a></span>`
instruments = @createInstrument(user)
id = participant.user.id;
name = participant.user.name;
#instruments = @createInstrument(user)
id = user.id;
name = user.name;
userId = id
avatar_url = context.JK.resolveAvatarUrl(participant.user.photo_url)
avatar_url = context.JK.resolveAvatarUrl(user.photo_url)
profile_url = "/client#/profile/" + id
musician_name = name
more_link = ''
@ -104,18 +118,16 @@ logger = context.JK.logger
inSessionUsers = []
result = []
if session.active_music_session && "participants" in session.active_music_session && session.active_music_session.participants.length > 0
for i in [0 .. session.active_music_session.participants.length]
participant = session.active_music_session.participants[i]
console.log("render active", session)
if session.active_music_session && session.active_music_session.participants && session.active_music_session.participants.length > 0
for participant in session.active_music_session.participants
inSessionUsers.push(participant.user.id);
result.push(@createInSessionUser(participant))
return [result, inSessionUsers]
createRsvpUsers:( ) ->
session = @props.session
createRsvpUsers:(session) ->
firstResults = []
lastResults = []
@ -126,19 +138,16 @@ logger = context.JK.logger
first = session.approved_rsvps.slice(0, 3)
last = session.approved_rsvps.slice(3)
for i in [0..first]
user = first[i]
firstResults.push(@createRsvpUser(user, session, approvedRsvpCount > 3 && i == 2))
for i in [0..last]
user = last[i]
lastResults.push(@createRsvpUser(user, session, false))
for approved_rsvp in first
firstResults.push(@createRsvpUser(approved_rsvp, session, approvedRsvpCount > 3 && i == 2))
for approved_rsvp in last
lastResults.push(@createRsvpUser(approved_rsvp, session, false))
[firstResults, lastResults]
createOpenSlots: () ->
session = @prop.session
createOpenSlots: (session) ->
firstResults = []
remainingResults = []
@ -148,30 +157,45 @@ logger = context.JK.logger
if session.open_slots
openSlotCount = session.open_slots.length
for i in [0 .. openSlotCount]
openSlot = session.open_slots[i]
for openSlot in session.open_slots
if i < 3
firstResults.push(@createOpenSlot(session.open_slots[i], openSlotCount > 3 && i == 2))
firstResults.push(@createOpenSlot(openSlot, openSlotCount > 3 && i == 2))
else
remainingResults.push(@createOpenSlot(session.open_slots[i], false))
remainingResults.push(@createOpenSlot(openSlot, false))
return [firstResults, remainingResults]
showJoinLinks: (inSessionUsers) ->
session = @prop.session
showJoinLink: (session, inSessionUsers) ->
showJoinLink = session.musician_access
if session.approved_rsvps
approvedRsvpCount = session.approved_rsvps.length
for i in [0 .. approvedRsvpCount]
for approved_rsvps in session.approved_rsvps
# do not show the user in this section if he is already in the session
if $.inArray(session.approved_rsvps[i].id, inSessionUsers) == -1
if session.approved_rsvps[i].id == context.JK.currentUserId
if $.inArray(approved_rsvps.id, inSessionUsers) == -1
if approved_rsvps.id == context.JK.currentUserId
showJoinLink = true
else
showJoinLink = true
showJoinLink
rsvps: (session, rsvp_musicians_first_3, rsvp_musicians_remaining) ->
if session.create_type == 'quick-start' || !rsvp_musicians_first_3 || rsvp_musicians_first_3.length == 0
return null
` <tr>
<td>RSVPs:</td>
<td>
<table className="musicians" cellpadding="0" cellspacing="0" width="100%">
{rsvp_musicians_first_3}
</table>
<div style={{display:'none'}}>
<table className="musicians" cellpadding="0" cellspacing="0" width="100%">
{rsvp_musicians_remaining}
</table>
</div>
</td>
</tr>`
render: () ->
@ -180,11 +204,12 @@ logger = context.JK.logger
id = session.id
name = session.name
description = session.description || "(No description)"
genres = '(' + session.genres.join (', ') + ')'
[in_session_musicians, inSessionUsers] = @inSessionUsersHtml()
[rsvp_musicians_first_3, rsvp_musicians_remaining] = @createRsvpUsers()
[open_slots_first_3, open_slots_remaining] = @createOpenSlots()
showJoinLink = @showJoinLink(inSessionUsers)
genres = '(' + session.genres.join (', ')
genres += ')'
[in_session_musicians, inSessionUsers] = @inSessionUsersHtml(session)
[rsvp_musicians_first_3, rsvp_musicians_remaining] = @createRsvpUsers(session)
[open_slots_first_3, open_slots_remaining] = @createOpenSlots(session)
showJoinLink = @showJoinLink(session, inSessionUsers)
showListenLink = session.fan_access && session.active_music_session && session.active_music_session.mount
join_link_display_style = {display: "none"}
listen_link_display_style = {display: "none"}
@ -201,20 +226,22 @@ logger = context.JK.logger
else
listen_link_text = '';
rsvps = @rsvps(rsvp_musicians_first_3, rsvp_musicians_remaining)
`<tr data-session-id={id} className="found-session">
<td width="30%">
<td width="40%" className="session-cell">
<table className="musician-groups" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td className="bold"><a href={"/sessions/" + id} rel="external">{name}</a></td>
<td align="right" width="75">{genres}</td>
<td className="bold"><a className="session-name" href={"/sessions/" + id} rel="external">{name}</a></td>
<td align="right" width="75" className="session-genre">{genres}</td>
</tr>
<tr>
<td colspan="2">{description}</td>
<td colspan="2" className="session-description">{description}</td>
</tr>
</table>
<div className="spacer"></div>
</td>
<td width="35%">
<td width="45%" className="session-musicians">
<table className="musicians" cellpadding="0" cellspacing="0">
<tr>
<td>In Session:</td>
@ -224,48 +251,25 @@ logger = context.JK.logger
</table>
</td>
</tr>
<tr>
<td>RSVPs:</td>
<td>
<table className="musicians" cellpadding="0" cellspacing="0" width="100%">
{rsvp_musicians_first_3}
</table>
<div style="display:none;">
<table className="musicians" cellpadding="0" cellspacing="0" width="100%">
{rsvp_musicians_remaining}
</table>
</div>
</td>
</tr>
<tr>
<td>Still Needed:</td>
<td>
<table className="musicians" cellpadding="0" cellspacing="0">
{open_slots_first_3}
</table>
<div style="display:none">
<table className="musicians" cellpadding="0" cellspacing="0">
{open_slots_remaining}
</table>
</div>
</td>
</tr>
{rsvps}
</table>
<div className="spacer"></div>
</td>
<td width="30%" className="latency">
<td width="10%" className="actions">
<div className="center">
<a className="listen-link" style="display:{listen_link_display_style};">
<img className="listen-icon" />
<a className="listen-link" style={listen_link_display_style}>
<div className="listen-icon"></div>
</a>
<br/>
<span className="listen-link-details"><span className="listen-link-text">{listen_link_text}</span><a href="#" className="listen-detail-hover">?</a></span>
</div>
<div className="center">
<a className="join-link" style="display:{join_link_display_style};">
<img className="join-icon" />
<a className="join-link" style={join_link_display_style}>
<div className="join-icon"></div>
</a>
<span className="join-link-text">Join</span>
</div>
<div className="spacer"></div>
</td>
</tr>`

View File

@ -20,7 +20,6 @@ MIX_MODES = context.JK.MIX_MODES
generateTabClasses: (tab) ->
classes = {}
classes['button-orange'] = true
classes['find-tab'] = true
classes[tab] = true
@ -56,19 +55,8 @@ MIX_MODES = context.JK.MIX_MODES
</a>
<a className={scheduledTabClasses}>
Scheduled
Upcoming
</a>
<div className="search-box">
<input className="session-keyword-srch" type="text" name="search"
placeholder="Search by Keyword"/>
</div>
<div className="right mr10">
<a href="/client#/findSession" style={{textDecoration:'none'}}
className="button-grey btn-refresh">REFRESH<span class="extra"></span></a>
</div>
</div>
</div>
</div>

View File

@ -2,12 +2,6 @@
#findSession {
.btn-refresh {
position: absolute;
right: 2%;
top: 13px;
margin-right: 0;
}
.session-keyword-srch {
@ -16,16 +10,63 @@
.tabs {
padding-left: 25px;
}
.find-tab {
.header-zone {
h2 {
display:inline-block;
}
.search-box {
margin-right: 24px;
position: relative;
top: -3px;
float: right;
}
.refresh-btn {
float:right;
}
padding-right:2%;
}
.find-tab {
width: 19%;
text-align: center;
height: 27px;
display: block;
float: left;
margin: 0 10px;
margin-right: 5px;
vertical-align: bottom;
padding-top: 65px;
background-color: #535353;
color: #ccc;
font-size: 17px;
text-decoration: none;
&.active {
background-color: #ed3618;
color: #fff;
}
&:hover {
filter: brightness(125%);
}
}
.spacer {
background-color:#404040;
height:10px;
position:absolute;
bottom:0;
left:0;
right:0;
}
.actions, .session-musicians, .session-cell{
position:relative;
padding-bottom:20px;
}
.sessions-for-me {
clear:both;
display:none;
&.active {
display:block;
@ -33,17 +74,23 @@
}
.join-icon {
display: inline-block;
background: url('/assets/content/join-icon.jpg') no-repeat;
height: 37px;
width: 40px;
height: 40px;
width: 37px;
}
.listen-icon {
display: inline-block;
background: url('/assets/content/listen-icon.jpg') no-repeat;
height: 40px;
width: 40px;
}
#sessions-active {
font-size:14px;
}
.paginate-wait {
margin:auto;
@ -84,11 +131,11 @@
width:100%;
padding-top: 11px;
padding-bottom: 11px;
background-color:#4c4c4c;
min-height:20px;
#background-color:#4c4c4c;
overflow-x:visible;
vertical-align:middle;
position:relative;
min-height:100px;
}
.session-filter select {
@ -151,20 +198,22 @@
}
.join-link {
position:relative;
left:-3px;
#position:relative;
#left:-3px;
}
.join-link-text {
position:relative;
left:6px;
font-weight:bold;
#position:relative;
#left:6px;
}
.rsvp-link {
position:relative;
left:0px;
#position:relative;
#left:0px;
}
.rsvp-link-text {
position:relative;
left:6px;
font-weight:bold;
#position:relative;
#left:6px;
}
}

View File

@ -16,7 +16,7 @@ if !current_user
}
else
attributes :id, :music_session_id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat,
attributes :id, :music_session_id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :create_type,
:band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :play_count, :scheduled_duration,
:language, :recurring_mode, :language_description, :scheduled_start_date, :access_description, :timezone, :timezone_id, :timezone_description,
:musician_access_description, :fan_access_description, :session_removed_at, :legal_policy, :open_rsvps, :is_unstructured_rsvp?