This commit is contained in:
Seth Call 2014-03-31 03:35:04 +01:00
commit ad2cfe41cd
19 changed files with 138 additions and 52 deletions

View File

@ -138,3 +138,4 @@ events_social_description.sql
fix_broken_cities.sql
notifications_with_text.sql
notification_seen_at.sql
order_event_session.sql

View File

@ -0,0 +1 @@
ALTER TABLE event_sessions ADD COLUMN ordinal INTEGER;

View File

@ -1,3 +1,3 @@
<% provide(:title, 'Jamkazam Password Changed') %>
You just changed your password at Jamkazam.
You just changed your password at JamKazam.

View File

@ -1,6 +1,6 @@
class JamRuby::EventSession < ActiveRecord::Base
attr_accessible :event_id, :user_id, :band_id, :starts_at, :ends_at, :pinned_state, :position, :img_url, :img_width, :img_height, as: :admin
attr_accessible :event_id, :user_id, :band_id, :starts_at, :ends_at, :pinned_state, :position, :img_url, :img_width, :img_height, :ordinal, as: :admin
belongs_to :user, class_name: 'JamRuby::User'
belongs_to :band, class_name: 'JamRuby::Band'
@ -13,6 +13,44 @@ class JamRuby::EventSession < ActiveRecord::Base
before_validation :sanitize_active_admin
def has_public_mixed_recordings?
public_mixed_recordings.length > 0
end
def public_mixed_recordings
recordings.select { |recording| recording if recording.has_mix? && recording.is_public? }
end
def recordings
recordings=[]
sessions.each do |session_history|
recordings = recordings + session_history.recordings
end
recordings
end
# ideally this is based on some proper association with the event, not such a slushy time grab
def sessions
if ready_display
query = MusicSessionHistory.where(fan_access: true).where(created_at: (self.starts_at - 12.hours)..(self.ends_at + 12.hours))
if self.user_id
query = query.where(user_id: self.user_id)
elsif self.band_id
query = query.where(band_id: self.band_id)
else
raise 'invalid state in event_session_button'
end
query
else
[]
end
end
def ready_display
self.starts_at && self.ends_at && (self.user_id || self.band_id)
end
def sanitize_active_admin
self.img_url = nil if self.img_url == ''
self.user_id = nil if self.user_id == ''

View File

@ -157,6 +157,10 @@ module JamRuby
music_session && music_session.mount
end
def recordings
Recording.where(music_session_id: self.id)
end
def end_history
self.update_attribute(:session_removed_at, Time.now)

View File

@ -132,7 +132,7 @@ module JamRuby
end
def has_access?(user)
return users.exists?(user)
users.exists?(user)
end
# Start recording a session.
@ -342,6 +342,9 @@ module JamRuby
save
end
def is_public?
claimed_recordings.where(is_public: true).length > 0
end
# meant to be used as a way to 'pluck' a claimed_recording appropriate for user.
def candidate_claimed_recording

View File

@ -116,8 +116,8 @@ describe Track do
tracks = Track.sync(connection.client_id, [{:id => track.id, :client_track_id => track.client_track_id, :sound => track.sound, :instrument_id => track.instrument_id}])
tracks.length.should == 1
found = tracks[0]
found.id.should == track.id
found.updated_at.should == track.updated_at
expect(found.id).to eq track.id
expect(found.updated_at.to_i).to eq track.updated_at.to_i
end
end
end

View File

@ -7,6 +7,7 @@
var claimedRecordingId = $parentElement.attr('data-claimed-recording-id');
var recordingId = $parentElement.attr('id');
var mode = $parentElement.attr('data-mode');
var $feedItem = $parentElement;
var $name = $('.name', $feedItem);

View File

@ -61,17 +61,6 @@
});
$('.carousel').show()
$.each($('.feed-entry'), function (index, feedEntry) {
var $feedEntry = $(this);
if ($feedEntry.is('.recording-entry')) {
new context.JK.FeedItemRecording($feedEntry);
}
else {
new context.JK.FeedItemSession($feedEntry);
}
})
context.JK.TickDuration('.feed-entry.music-session-history-entry .inprogress .tick-duration');
if ($.QueryString['showVideo']) {

View File

@ -604,7 +604,7 @@ table.audiogeartable {
left:10px;
width:150px;
height:18px;
background-image:url(../images/content/bkg_slider_gain_horiz.png);
background-image:url(/assets/content/bkg_slider_gain_horiz.png);
background-repeat:repeat-x;
}

View File

@ -219,7 +219,7 @@
.share-message {
width: 100%;
padding:0;
padding:4px;
}
.error-msg {

View File

@ -109,13 +109,43 @@
}
}
.feed-entry {
position:relative;
display:block;
white-space:nowrap;
min-width:700px;
border-bottom:solid 1px #666;
max-height:74px;
overflow:hidden;
margin-top:20px;
&:nth-child(1) {
margin-top:0;
}
&[data-mode="minimal"] {
.avatar-small {
display:none;
}
.feed-type-title {
display:none;
}
.recording-controls-holder {
width: 65%;
float:left;
}
.name-and-description {
margin-left:0;
}
min-width:300px;
border-bottom-width:0;
}
.session-controls, .recording-controls {
display:inline-block;
&.ended {
background-color: #471f18;
}
&.inprogress {
@ -129,6 +159,16 @@
}
}
.recording-controls-holder {
float:right;
width:40%;
}
.name-and-description {
float:left;
width:30%;
margin-left:20px;
}
.recording-controls {
.recording-position {
width:70%;
@ -147,22 +187,6 @@
}
}
}
}
.feed-entry {
position:relative;
display:block;
white-space:nowrap;
min-width:700px;
border-bottom:solid 1px #666;
max-height:74px;
overflow:hidden;
margin-top:20px;
&:nth-child(1) {
margin-top:0;
}
/**
&.animate-down {
-webkit-transition: max-height height 2s;

View File

@ -242,7 +242,7 @@ Version: 1.1
.carousel .slides .spinner
{
background : #000 url(loading.gif) no-repeat center; /* video preloader */
background : #000 /*url(loading.gif)*/ no-repeat center; /* video preloader */
}
/* _____________________________ *

View File

@ -6,15 +6,19 @@
%span.event-title= event_session_title(event_session)
.landing-details.event
.left.f20.teal.time
%strong
= event_session_start_hour(event_session)
.right.session-button
= event_session_button(event_session)
- unless event_session.has_public_mixed_recordings?
.left.f20.teal.time
%strong
= event_session_start_hour(event_session)
.right.session-button
= event_session_button(event_session)
%br{ clear:'all' }
.left.bio
= event_session_description(event_session)
.left
- event_session.public_mixed_recordings.each do |recording|
= render :partial => "users/feed_recording", locals: { feed_item: recording, mode: 'minimal'}
%br
%br
%br{ clear:'all' }

View File

@ -23,7 +23,7 @@
%h2 ARTIST LINEUP
%br
= render :partial => "event_session", :collection => @event.event_sessions.order('starts_at')
= render :partial => "event_session", :collection => @event.event_sessions.order('ordinal, starts_at')
%br{clear:'all'}

View File

@ -68,4 +68,8 @@
%br{:clear => "all"}/
%br/
%br/
:javascript
$(function () {
new window.JK.FeedItemSession($('.feed-entry[data-music-session="#{feed_item.id}"]'));
})

View File

@ -1,21 +1,24 @@
.feed-entry.recording-entry{:id => feed_item.id, :'data-claimed-recording-id' => feed_item.candidate_claimed_recording.id}
/ default values for template
- mode ||= local_assigns[:mode] = local_assigns.fetch(:mode, 'full')
.feed-entry.recording-entry{:id => feed_item.id, :'data-claimed-recording-id' => feed_item.candidate_claimed_recording.id, :'data-mode' => mode}
/ avatar
.avatar-small.ib
= recording_avatar(feed_item)
/ type and artist
.left.ml20.w15
.left.ml20.w15.feed-type-title
.title{hoveraction: 'recording', :'recording-id' => feed_item.candidate_claimed_recording.id } RECORDING
.artist
= recording_artist_name(feed_item)
= timeago(feed_item.created_at, class: 'small created_at')
/ name and description
.left.ml20.w30
.name-and-description
.name.dotdotdot
= recording_name(feed_item)
.description.dotdotdot
= recording_description(feed_item)
/ timeline and controls
.right.w40
.recording-controls-holder
/ recording play controls
.recording-controls{ class: feed_item.candidate_claimed_recording.has_mix? ? 'has-mix' : 'no-mix'}
/ play button
@ -83,3 +86,7 @@
%br{:clear => "all"}/
%br/
:javascript
$(function () {
new window.JK.FeedItemRecording($('.feed-entry[data-claimed-recording-id="#{feed_item.candidate_claimed_recording.id}"]'));
})

View File

@ -9,7 +9,7 @@
- content_for :after_black_bar do
- unless @jamfest_2014
.jamfest{style: 'top:-70px;position:relative'}
%a{ href: '#', style: 'font-size:20px; margin-top:11px' }
%a{ href: event_path(@jamfest_2014.slug), style: 'font-size:20px;margin-top:11px' }
Listen to the terrific band performances from Virtual Jam Fest 2014!
%div{style: "padding-top:20px;"}
.right

View File

@ -115,15 +115,25 @@ describe "Events", :js => true, :type => :feature, :capybara_feature => true, :s
@event_session2.starts_at = 4.hours.ago
@event_session2.save!
visit "/events/so_latency"
expect(page).to have_css(".landing-band.event[data-event-session=\"#{@event_session2.id}\"]")
first(".landing-band.event[data-event-session='#{@event_session2.id}']:nth-child(1)")
# test that it sorts correctly by putting this later event second
@event_session2.starts_at = 4.hours.from_now
@event_session2.save!
visit "/events/so_latency"
expect(page).to have_css(".landing-band.event[data-event-session=\"#{@event_session.id}\"]")
first(".landing-band.event[data-event-session='#{@event_session.id}']:nth-child(1)")
# test that it sorts correctly by putting this later event first, because ordinal is specified
@event_session2.ordinal = 0
@event_session2.save!
visit "/events/so_latency"
first(".landing-band.event[data-event-session='#{@event_session2.id}']:nth-child(1)")
# associate a recording, and verify that the display changes to have no description, but has a recording widget
mix = FactoryGirl.create(:mix)
mix.recording.music_session_id = music_session_history.id
mix.recording.save!
visit "/events/so_latency"
find(".feed-entry.recording-entry[data-claimed-recording-id='#{mix.recording.claimed_recordings[0].id}']")
end
end