Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop

This commit is contained in:
Seth Call 2014-02-20 08:03:02 +00:00
commit db15c37a53
9 changed files with 53 additions and 28 deletions

View File

@ -37,7 +37,6 @@ gem 'bootstrap-will_paginate', '0.0.6'
gem 'carrierwave', '0.9.0'
gem 'carrierwave_direct'
gem 'uuidtools', '2.1.2'
gem 'bcrypt-ruby', '3.0.1'
gem 'jquery-rails' # , '2.3.0' # pinned because jquery-ui-rails was split from jquery-rails, but activeadmin doesn't support this gem yet
gem 'jquery-ui-rails'
gem 'rails3-jquery-autocomplete'

View File

@ -67,8 +67,7 @@ module JamRuby
end
def recent_history
recordings = ClaimedRecording.joins(:recording)
.where(:recordings => {:band_id => "#{self.id}"})
recordings = Recording.where(:band_id => self.id)
.order('created_at DESC')
.limit(10)

View File

@ -20,7 +20,7 @@ module JamRuby
sort ||= 'date'
raise "not valid sort #{sort}" unless SORT_TYPES.include?(sort)
start = params[:start]
start = params[:start].presence
if sort == 'date'
start ||= FIXNUM_MAX
else

View File

@ -39,10 +39,6 @@ module JamRuby
feed.music_session_history = self
end
def like_count
self.likes.size
end
def comment_count
self.comments.size
end

View File

@ -40,14 +40,6 @@ module JamRuby
self.band_id = nil if self.band_id == ''
end
def like_count
self.likes.size
end
def play_count
self.plays.size
end
def comment_count
self.comments.size
end

View File

@ -275,8 +275,7 @@ module JamRuby
end
def recent_history
recordings = ClaimedRecording.joins(:recording)
.where(:recordings => {:owner_id => "#{self.id}"})
recordings = Recording.where(:owner_id => self.id)
.order('created_at DESC')
.limit(10)

View File

@ -45,7 +45,6 @@
.recording-slider {
position:absolute;
left:25%;
top:0px;
}

View File

@ -18,7 +18,7 @@
<% end %>
<div class="landing-band">
<% unless @claimed_recording.recording.band.nil? %>
<% unless @claimed_recording.recording.band.blank? %>
<div class="landing-avatar">
<% unless @claimed_recording.recording.band.photo_url.blank? %>
<%= image_tag "#{@claimed_recording.recording.band.photo_url}", {:alt => ""} %>
@ -51,17 +51,20 @@
<br clear="all" /><%= @claimed_recording.description %><br /><br />
<div class="w100">
<div class="recording-controls">
<a id="btnPlay" class="left"><%= image_tag "content/icon_playbutton.png", {:width => 20, :height => 20, :alt => ""} %></a>
<a id="btnPlayPause" class="left"><%= image_tag "content/icon_playbutton.png", {:id => "imgPlayPause", :width => 20, :height => 20, :alt => ""} %></a>
<div class="recording-position">
<div class="recording-time">0:00</div>
<div class="recording-playback">
<div class="recording-slider"><%= image_tag "content/slider_playcontrols.png", {:width => 5, :height => 16, :alt => ""} %></div>
</div>
<div class="recording-time">4:59</div>
<div id="recordingDuration" class="recording-time"></div>
</div>
<div class="recording-current">1:23</div>
<div class="recording-current">0:00</div>
<audio controls preload="none" style="display:none;">
<source src="<%= @claimed_recording.mix.mp3_url %>">
<source src="<%= @claimed_recording.mix.ogg_url %>">
</audio>
</div>
<div class="left white"><%= @claimed_recording.genre_id.capitalize %></div>
<div class="right white">
<span id="spnPlayCount"><%= @claimed_recording.recording.play_count %></span>
@ -99,9 +102,46 @@
<% content_for :extra_js do %>
<script type="text/javascript">
$(function () {
var htmlAudio = $(".recording-controls").find('audio').get(0);
var durationInitialized = false;
function formatTime(time) {
var minutes = Math.floor(time / 60);
var seconds = Math.floor(time % 60);
return minutes.toString() + ":" + (seconds > 9 ? seconds.toString() : '0' + seconds.toString());
}
var showRecording = new JK.ShowRecording(JK.app);
showRecording.initialize("<%= @claimed_recording.id %>", "<%= @claimed_recording.recording_id %>");
})
// this calculates the original
$(htmlAudio).on('timeupdate', function() {
if (!durationInitialized) {
$("#recordingDuration").html(formatTime(htmlAudio.duration));
durationInitialized = true;
}
var percentComplete = (htmlAudio.currentTime / htmlAudio.duration) * 100;
$(".recording-slider").css({'left': percentComplete + '%'});
$(".recording-current").html(formatTime(htmlAudio.currentTime));
// reset icon to play and slider to far left when done
if (percentComplete === 100) {
$("#imgPlayPause").attr('src', '/assets/content/icon_playbutton.png');
$(".recording-slider").css({'left': 0 + '%'});
}
});
$("#btnPlayPause").click(function() {
if (htmlAudio.paused) {
htmlAudio.play();
$("#imgPlayPause").attr('src', '/assets/content/icon_pausebutton.png');
}
else {
htmlAudio.pause();
$("#imgPlayPause").attr('src', '/assets/content/icon_playbutton.png');
}
});
});
</script>
<% end %>

View File

@ -4,14 +4,15 @@
<% recent_history.each do |history_record| %>
<% if history_record.instance_of? ClaimedRecording %>
<% if history_record.instance_of? Recording %>
<div class="grey f16">
<em><%= history_record.created_at.strftime("%b #{history_record.created_at.day.ordinalize}") %>:</em>
</div>
<div class="f16">
<span class="orange"><strong>RECORDING:</strong></span>
<a recording-id="<%= history_record.id %>" hoveraction="recording" href="/recordings/<%= history_record.id %>" class="white">Test</a>
<a recording-id="<%= history_record.claimed_recordings.first.id %>" hoveraction="recording" href="/recordings/<%= history_record.claimed_recordings.first.id %>" class="white"><%= history_record.claimed_recordings.first.name %></a>
</div>
<div class="f13 lightgrey"><%= history_record.claimed_recordings.first.description %></div>
<% elsif history_record.instance_of? MusicSessionHistory %>
<div class="grey f16">
@ -31,9 +32,9 @@
<span class="grey">Session Ended. Unavailable.</span>
<% end %>
</div>
<div class="f13 lightgrey"><%= history_record.description %></div>
<% end %>
<div class="f13 lightgrey"><%= history_record.description %></div>
<% if history_record != recent_history.last %>
<br /><br />
<% end %>