* removed is_downloadable for VRFS-1141, from database and UI

* what's next dialog has icheck-styled checkbox now VRFS-913
* facebook invitations hooked up for VRFS-1121
This commit is contained in:
Seth Call 2014-02-22 05:09:39 +00:00
parent 5ef992f881
commit dae0f40929
37 changed files with 362 additions and 353 deletions

View File

@ -6,7 +6,6 @@
= f.input :user_id, :as => :hidden, :input_html => { class: "jam_ruby_claimed_recording[user_id]" }
= f.input :genre, collection: Genre.all, :member_label => :description
= f.input :is_public
= f.input :is_downloadable
= link_to_remove_association "Delete Claimed Recording", f, class: 'button', style: 'margin-left:10px'
%div{style: 'display:none'}

View File

@ -115,4 +115,5 @@ music_sessions_plays.sql
plays_likes_counters.sql
add_upright_bass.sql
music_session_history_public.sql
track_claimed_recording.sql
track_claimed_recording.sql
remove_is_downloadable.sql

View File

@ -0,0 +1 @@
ALTER TABLE claimed_recordings DROP COLUMN is_downloadable;

View File

@ -1,7 +1,7 @@
module JamRuby
class ClaimedRecording < ActiveRecord::Base
attr_accessible :name, :description, :is_public, :is_downloadable, :genre_id, :recording_id, :user_id, as: :admin
attr_accessible :name, :description, :is_public, :genre_id, :recording_id, :user_id, as: :admin
belongs_to :recording, :class_name => "JamRuby::Recording", :inverse_of => :claimed_recordings, :foreign_key => 'recording_id'
belongs_to :user, :class_name => "JamRuby::User", :inverse_of => :claimed_recordings
@ -15,7 +15,6 @@ module JamRuby
validates :name, no_profanity: true, length: {minimum: 3, maximum: 64}, presence: true
validates :description, no_profanity: true, length: {maximum: 8000}
validates :is_public, :inclusion => {:in => [true, false]}
validates :is_downloadable, :inclusion => {:in => [true, false]}
validates :genre, presence: true
validates :user, presence: true
validates_uniqueness_of :user_id, :scope => :recording_id
@ -43,7 +42,6 @@ module JamRuby
self.description = params[:description] unless params[:description].nil?
self.genre = Genre.find(params[:genre]) unless params[:genre].nil?
self.is_public = params[:is_public] unless params[:is_public].nil?
self.is_downloadable = params[:is_downloadable] unless params[:is_downloadable].nil?
save
end

View File

@ -3,7 +3,7 @@ module JamRuby
self.primary_key = 'id'
attr_accessible :owner, :owner_id, :band, :band_id, :recorded_tracks_attributes, :mixes_attributes, :claimed_recordings_attributes, :name, :description, :genre, :is_public, :is_downloadable, :duration, as: :admin
attr_accessible :owner, :owner_id, :band, :band_id, :recorded_tracks_attributes, :mixes_attributes, :claimed_recordings_attributes, :name, :description, :genre, :is_public, :duration, as: :admin
has_many :claimed_recordings, :class_name => "JamRuby::ClaimedRecording", :inverse_of => :recording, :foreign_key => 'recording_id', :dependent => :destroy
has_many :users, :through => :recorded_tracks, :class_name => "JamRuby::User"
@ -140,7 +140,7 @@ module JamRuby
# Called when a user wants to "claim" a recording. To do this, the user must have been one of the tracks in the recording.
def claim(user, name, description, genre, is_public, is_downloadable)
def claim(user, name, description, genre, is_public)
unless self.users.exists?(user)
raise PermissionError, "user was not in this session"
@ -153,7 +153,6 @@ module JamRuby
claimed_recording.description = description
claimed_recording.genre = genre
claimed_recording.is_public = is_public
claimed_recording.is_downloadable = is_downloadable
self.claimed_recordings << claimed_recording
if claimed_recording.save

View File

@ -159,7 +159,6 @@ FactoryGirl.define do
sequence(:name) { |n| "name-#{n}" }
sequence(:description) { |n| "description-#{n}" }
is_public true
is_downloadable true
association :genre, factory: :genre
association :user, factory: :user

View File

@ -5,11 +5,10 @@ def valid_claimed_recording
@description = "description"
@genre = Genre.first
@is_public = true
@is_downloadable = true
end
def make_claim
@claimed_recording = @recording.claim(@user, @name, @description, @genre, @is_public, @is_downloadable)
@claimed_recording = @recording.claim(@user, @name, @description, @genre, @is_public)
end
describe ClaimedRecording do
@ -81,17 +80,6 @@ describe ClaimedRecording do
end
end
describe "update is_downloadable" do
it "with nil" do
valid_claimed_recording
@is_downloadable = nil
make_claim
@claimed_recording.errors.any?.should be_true
@claimed_recording.errors[:is_downloadable].length.should == 1
@claimed_recording.errors[:is_downloadable].should == ["is not included in the list"]
end
end
describe "update genre" do
it "with nil" do
valid_claimed_recording
@ -107,7 +95,7 @@ describe ClaimedRecording do
it "not valid" do
valid_claimed_recording
make_claim
duplicate = @recording.claim(@user, "name", "description", @genre, true, true)
duplicate = @recording.claim(@user, "name", "description", @genre, true)
duplicate.valid?.should be_false
duplicate.errors[:user_id].should == ['has already been taken']
end

View File

@ -12,7 +12,7 @@ describe Mix do
@music_session.save
@recording = Recording.start(@music_session, @user)
@recording.stop
@recording.claim(@user, "name", "description", Genre.first, true, true)
@recording.claim(@user, "name", "description", Genre.first, true)
@recording.errors.any?.should be_false
@mix = Mix.schedule(@recording)
@mix.reload

View File

@ -389,7 +389,7 @@ describe MusicSession do
@recording.errors.any?.should be_false
@recording.stop
@recording.reload
@claimed_recording = @recording.claim(@user1, "name", "description", Genre.first, true, true)
@claimed_recording = @recording.claim(@user1, "name", "description", Genre.first, true)
@claimed_recording.errors.any?.should be_false
end
@ -422,7 +422,7 @@ describe MusicSession do
it "allow a claimed recording to be started when already started by self" do
@user2 = FactoryGirl.create(:user)
@claimed_recording2 = @recording.claim(@user1, "name", "description", Genre.first, true, true)
@claimed_recording2 = @recording.claim(@user1, "name", "description", Genre.first, true)
@music_session.claimed_recording_start(@user1, @claimed_recording)
@music_session.errors.any?.should be_false
@music_session.claimed_recording_start(@user1, @claimed_recording2)

View File

@ -119,7 +119,7 @@ describe 'Musician search' do
recording.stop
recording.reload
genre = FactoryGirl.create(:genre)
recording.claim(usr, "name", "description", genre, true, true)
recording.claim(usr, "name", "description", genre, true)
recording.reload
recording
end

View File

@ -60,7 +60,7 @@ describe RecordedTrack do
it "can be downloaded if there is a claimed recording" do
@recorded_track = RecordedTrack.create_from_track(@track, @recording)
@recording.claim(@user, "my recording", "my description", Genre.first, true, true).errors.any?.should be_false
@recording.claim(@user, "my recording", "my description", Genre.first, true).errors.any?.should be_false
@recorded_track.can_download?(@user).should be_true
end

View File

@ -114,7 +114,7 @@ describe Recording do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@recording.claim(@user, "name", "description", @genre, true, true)
@recording.claim(@user, "name", "description", @genre, true)
@recording.reload
@recording.users.length.should == 1
@recording.users.first.should == @user
@ -126,7 +126,6 @@ describe Recording do
@claimed_recording.description.should == "description"
@claimed_recording.genre.should == @genre
@claimed_recording.is_public.should == true
@claimed_recording.is_downloadable.should == true
end
it "should fail if a user who was not in the session claims a recording" do
@ -134,7 +133,7 @@ describe Recording do
@recording.stop
@recording.reload
user2 = FactoryGirl.create(:user)
expect { @recording.claim(user2, "name", "description", @genre, true, true) }.to raise_error
expect { @recording.claim(user2, "name", "description", @genre, true) }.to raise_error
end
it "should allow editing metadata for claimed recordings" do
@ -142,15 +141,14 @@ describe Recording do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true, true)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true)
@genre2 = FactoryGirl.create(:genre)
@claimed_recording.update_fields(@user, :name => "name2", :description => "description2", :genre => @genre2.id, :is_public => false, :is_downloadable => false)
@claimed_recording.update_fields(@user, :name => "name2", :description => "description2", :genre => @genre2.id, :is_public => false)
@claimed_recording.reload
@claimed_recording.name.should == "name2"
@claimed_recording.description.should == "description2"
@claimed_recording.genre.should == @genre2
@claimed_recording.is_public.should == false
@claimed_recording.is_downloadable.should == false
end
it "should only allow the owner to edit a claimed recording" do
@ -158,7 +156,7 @@ describe Recording do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true, true)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true)
@user2 = FactoryGirl.create(:user)
expect { @claimed_recording.update_fields(@user2, "name2") }.to raise_error
end
@ -184,9 +182,9 @@ describe Recording do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true, true)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true)
expect { @claimed_recordign.discard(@user2) }.to raise_error
@claimed_recording = @recording.claim(@user2, "name2", "description2", @genre, true, true)
@claimed_recording = @recording.claim(@user2, "name2", "description2", @genre, true)
@claimed_recording.discard(@user2)
@recording.reload
@recording.claimed_recordings.length.should == 1
@ -197,7 +195,7 @@ describe Recording do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true, true)
@claimed_recording = @recording.claim(@user, "name", "description", @genre, true)
@claimed_recording.discard(@user)
expect { Recording.find(@recording.id) }.to raise_error
expect { ClaimedRecording.find(@claimed_recording.id) }.to raise_error
@ -209,7 +207,7 @@ describe Recording do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@recording.claim(@user, "Recording", "Recording Description", @genre, true, true)
@recording.claim(@user, "Recording", "Recording Description", @genre, true)
uploads = Recording.list_uploads(@user)
uploads["uploads"].length.should == 1
Recording.list_uploads(@user, 10, uploads["next"])["uploads"].length.should == 0
@ -220,7 +218,7 @@ describe Recording do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@recording.claim(@user, "Recording", "Recording Description", @genre, true, true)
@recording.claim(@user, "Recording", "Recording Description", @genre, true)
downloads = Recording.list_downloads(@user)
downloads["downloads"].length.should == 0
@recorded_track = RecordedTrack.where(:recording_id => @recording.id)[0]
@ -232,7 +230,7 @@ describe Recording do
it "should mark first_recording_at" do
@recording = Recording.start(@music_session, @user)
@recording.stop
@recording.claim(@user, "Recording", "Recording Description", Genre.first, true, true)
@recording.claim(@user, "Recording", "Recording Description", Genre.first, true)
@user.first_recording_at.should be_nil
@user.reload
@user.first_recording_at.should_not be_nil

View File

@ -159,7 +159,7 @@ describe AudioMixer do
@music_session.save
@recording = Recording.start(@music_session, @user)
@recording.stop
@recording.claim(@user, "name", "description", Genre.first, true, true)
@recording.claim(@user, "name", "description", Genre.first, true)
@recording.errors.any?.should be_false
end

View File

@ -136,12 +136,10 @@
function renderStartNewFtueLatencyTesting() {
setSaveButtonState($('#btn-ftue-2-save'), false);
// spinner hangs
//$('#ftue-2-spinner').show().css('display', 'inline-block');
}
function renderStopNewFtueLatencyTesting() {
$('#ftue-2-spinner').hide();
}
function settingsInit() {

View File

@ -1,241 +1,245 @@
(function(context,$) {
(function (context, $) {
"use strict";
context.JK = context.JK || {};
context.JK.RecordingFinishedDialog = function(app) {
var logger = context.JK.logger;
var rest = context.JK.Rest();
var playbackControls = null;
var recording = null; // deferred object
"use strict";
context.JK = context.JK || {};
context.JK.RecordingFinishedDialog = function (app) {
var logger = context.JK.logger;
var rest = context.JK.Rest();
var playbackControls = null;
var recording = null; // deferred object
function resetForm() {
function resetForm() {
// remove all display errors
$('#recording-finished-dialog form .error-text').remove()
$('#recording-finished-dialog form .error').removeClass("error")
}
function beforeShow() {
if(recording == null) {
alert("recording data should not be null");
app.layout.closeDialog('recordingFinished');
return false;
}
resetForm();
var parentSelector = '#recording-finished-dialog div.genre-selector';
context.JK.GenreSelectorHelper.render(parentSelector);
// preset genre from 1st genre in current session
var currentOrLastSession = JK.CurrentSessionModel.getCurrentOrLastSession();
if(currentOrLastSession && currentOrLastSession.genres.length > 0) {
var genreDescription = currentOrLastSession.genres[0];
context.JK.GenreSelectorHelper.setSelectedGenres(parentSelector, [genreDescription]);
}
var localResults = context.jamClient.GetLocalRecordingState({recordings: [recording]});
if(localResults['error']) {
app.notify({
title : "Unable to Open Recording for Playback",
text : localResults['error'],
icon_url: "/assets/content/icon_alert_big.png"
});
}
else {
var localResult = localResults.recordings[0];
if(localResult.aggregate_state == 'MISSING') {
app.notify({
title : "Unable to Open Recording for Playback",
text : "All tracks associated with the recording are missing",
icon_url: "/assets/content/icon_alert_big.png"
});
}
else if(localResult.aggregate_state == 'PARTIALLY_MISSING') {
app.notify({
title : "Unable to Open Recording for Playback",
text: "Some tracks associated with the recording are missing",
icon_url: "/assets/content/icon_alert_big.png"
})
}
else {
// load recording
var openRecordingResult = context.jamClient.OpenRecording(recording);
logger.debug("OpenRecording response: %o", openRecordingResult);
if(openRecordingResult.error) {
app.notify({
"title": "Can't Open Recording",
"text": openRecordingResult.error,
"icon_url": "/assets/content/icon_alert_big.png"
});
}
playbackControls.startMonitor();
}
}
}
function afterHide() {
recording = null;
playbackControls.stopMonitor();
context.jamClient.CloseRecording();
}
function discardRecording(e) {
resetForm();
registerDiscardRecordingHandlers(false);
rest.discardRecording({
id: recording.id
})
.done(function() {
console.error("recording discarded by user. recordingId=%o", recording.id);
})
.fail(function(jqXHR){
console.error("recording discard by user failed. recordingId=%o. reason: %o", recording.id, jqXHR.responseText);
})
.always(function() {
app.layout.closeDialog('recordingFinished')
registerDiscardRecordingHandlers(true);
})
return false;
}
function claimRecording(e){
resetForm();
registerClaimRecordingHandlers(false);
var name = $('#recording-finished-dialog form input[name=name]').val();
var description = $('#recording-finished-dialog form textarea[name=description]').val();
var genre = $('#recording-finished-dialog form select[name=genre]').val();
var is_public = $('#recording-finished-dialog form input[name=is_public]').is(':checked')
var is_downloadable = $('#recording-finished-dialog form input[name=is_downloadable]').is(':checked');
rest.claimRecording({
id : recording.id,
name: name,
description: description,
genre: genre,
is_public: is_public,
is_downloadable: is_downloadable
})
.done(function() {
app.layout.closeDialog('recordingFinished');
context.JK.GA.trackMakeRecording();
})
.fail(function(jqXHR) {
if(jqXHR.status == 422) {
var errors = JSON.parse(jqXHR.responseText);
var $name_errors = context.JK.format_errors('name', errors);
if($name_errors) $('#recording-finished-dialog form input[name=name]').closest('div.field').addClass('error').end().after($name_errors);
var $description_errors = context.JK.format_errors('description', errors);
if($description_errors) $('#recording-finished-dialog form input[name=description]').closest('div.field').addClass('error').end().after($description_errors);
var $genre_errors = context.JK.format_errors('genre', errors);
if($genre_errors) $('#recording-finished-dialog form select[name=genre]').closest('div.field').addClass('error').end().after($genre_errors);
var $is_public_errors = context.JK.format_errors('is_public', errors);
if($is_public_errors) $('#recording-finished-dialog form input[name=is_public]').closest('div.field').addClass('error').end().after($is_public_errors);
var $is_downloadable_errors = context.JK.format_errors('is_downloadable', errors);
if($is_downloadable_errors) $('#recording-finished-dialog form input[name=is_downloadable]').closest('div.field').addClass('error').end().after($is_downloadable_errors);
var recording_error = context.JK.get_first_error('recording_id', errors);
if (recording_error) context.JK.showErrorDialog(app, "Unable to claim recording.", recording_error);
}
else {
logger.error("unable to claim recording %o", arguments);
context.JK.showErrorDialog(app, "Unable to claim recording.", jqXHR.responseText);
}
})
.always(function() {
registerClaimRecordingHandlers(true);
});
return false;
}
function registerClaimRecordingHandlers(onOff) {
if(onOff) {
$('#keep-session-recording').on('click', claimRecording);
$('#recording-finished-dialog form').on('submit', claimRecording);
}
else {
$('#keep-session-recording').off('click', claimRecording)
$('#recording-finished-dialog form').off('submit', claimRecording);
}
}
function registerDiscardRecordingHandlers(onOff) {
if(onOff) {
$('#discard-session-recording').on('click', discardRecording);
}
else {
$('#discard-session-recording').off('click', discardRecording);
}
}
function onPause() {
logger.debug("calling jamClient.SessionStopPlay");
context.jamClient.SessionStopPlay();
}
function onPlay(e, data) {
logger.debug("calling jamClient.SessionStartPlay");
context.jamClient.SessionStartPlay(data.playbackMode);
}
function onChangePlayPosition(e, data) {
logger.debug("calling jamClient.SessionTrackSeekMs(" + data.positionMs + ")");
context.jamClient.SessionTrackSeekMs(data.positionMs);
}
function registerStaticEvents() {
registerClaimRecordingHandlers(true);
registerDiscardRecordingHandlers(true);
$(playbackControls)
.on('pause', onPause)
.on('play', onPlay)
.on('change-position', onChangePlayPosition);
}
function setRecording(recordingData) {
if(recording != null) {
//XXX - prevent start/stop recording mashing; protect this dialog
logger.error("unable to set recording data over existing recording data. this coudld be due to start/stop recording mashing");
return;
}
recording = recordingData;
}
function initialize(){
var dialogBindings = {
'beforeShow' : beforeShow,
'afterHide': afterHide
};
app.bindDialog('recordingFinished', dialogBindings);
playbackControls = new context.JK.PlaybackControls($('#recording-finished-dialog .recording-controls'));
registerStaticEvents();
};
this.initialize = initialize;
this.setRecording = setRecording;
// remove all display errors
$('#recording-finished-dialog form .error-text').remove()
$('#recording-finished-dialog form .error').removeClass("error")
}
function beforeShow() {
if (recording == null) {
alert("recording data should not be null");
app.layout.closeDialog('recordingFinished');
return false;
}
resetForm();
var parentSelector = '#recording-finished-dialog div.genre-selector';
context.JK.GenreSelectorHelper.render(parentSelector);
// preset genre from 1st genre in current session
var currentOrLastSession = JK.CurrentSessionModel.getCurrentOrLastSession();
if (currentOrLastSession && currentOrLastSession.genres.length > 0) {
var genreDescription = currentOrLastSession.genres[0];
context.JK.GenreSelectorHelper.setSelectedGenres(parentSelector, [genreDescription]);
}
var localResults = context.jamClient.GetLocalRecordingState({recordings: [recording]});
if (localResults['error']) {
app.notify({
title: "Unable to Open Recording for Playback",
text: localResults['error'],
icon_url: "/assets/content/icon_alert_big.png"
});
}
else {
var localResult = localResults.recordings[0];
if (localResult.aggregate_state == 'MISSING') {
app.notify({
title: "Unable to Open Recording for Playback",
text: "All tracks associated with the recording are missing",
icon_url: "/assets/content/icon_alert_big.png"
});
}
else if (localResult.aggregate_state == 'PARTIALLY_MISSING') {
app.notify({
title: "Unable to Open Recording for Playback",
text: "Some tracks associated with the recording are missing",
icon_url: "/assets/content/icon_alert_big.png"
})
}
else {
// load recording
var openRecordingResult = context.jamClient.OpenRecording(recording);
logger.debug("OpenRecording response: %o", openRecordingResult);
if (openRecordingResult.error) {
app.notify({
"title": "Can't Open Recording",
"text": openRecordingResult.error,
"icon_url": "/assets/content/icon_alert_big.png"
});
}
playbackControls.startMonitor();
}
}
}
function afterHide() {
recording = null;
playbackControls.stopMonitor();
context.jamClient.CloseRecording();
}
function discardRecording(e) {
resetForm();
registerDiscardRecordingHandlers(false);
rest.discardRecording({
id: recording.id
})
.done(function () {
console.error("recording discarded by user. recordingId=%o", recording.id);
})
.fail(function (jqXHR) {
console.error("recording discard by user failed. recordingId=%o. reason: %o", recording.id, jqXHR.responseText);
})
.always(function () {
app.layout.closeDialog('recordingFinished')
registerDiscardRecordingHandlers(true);
})
return false;
}
function claimRecording(e) {
resetForm();
registerClaimRecordingHandlers(false);
var name = $('#recording-finished-dialog form input[name=name]').val();
var description = $('#recording-finished-dialog form textarea[name=description]').val();
var genre = $('#recording-finished-dialog form select[name=genre]').val();
var is_public = $('#recording-finished-dialog form input[name=is_public]').is(':checked')
rest.claimRecording({
id: recording.id,
name: name,
description: description,
genre: genre,
is_public: is_public
})
.done(function () {
app.layout.closeDialog('recordingFinished');
context.JK.GA.trackMakeRecording();
})
.fail(function (jqXHR) {
if (jqXHR.status == 422) {
var errors = JSON.parse(jqXHR.responseText);
var $name_errors = context.JK.format_errors('name', errors);
if ($name_errors) $('#recording-finished-dialog form input[name=name]').closest('div.field').addClass('error').end().after($name_errors);
var $description_errors = context.JK.format_errors('description', errors);
if ($description_errors) $('#recording-finished-dialog form input[name=description]').closest('div.field').addClass('error').end().after($description_errors);
var $genre_errors = context.JK.format_errors('genre', errors);
if ($genre_errors) $('#recording-finished-dialog form select[name=genre]').closest('div.field').addClass('error').end().after($genre_errors);
var $is_public_errors = context.JK.format_errors('is_public', errors);
if ($is_public_errors) $('#recording-finished-dialog form input[name=is_public]').closest('div.field').addClass('error').end().after($is_public_errors);
var recording_error = context.JK.get_first_error('recording_id', errors);
if (recording_error) context.JK.showErrorDialog(app, "Unable to claim recording.", recording_error);
}
else {
logger.error("unable to claim recording %o", arguments);
context.JK.showErrorDialog(app, "Unable to claim recording.", jqXHR.responseText);
}
})
.always(function () {
registerClaimRecordingHandlers(true);
});
return false;
}
function registerClaimRecordingHandlers(onOff) {
if (onOff) {
$('#keep-session-recording').on('click', claimRecording);
$('#recording-finished-dialog form').on('submit', claimRecording);
}
else {
$('#keep-session-recording').off('click', claimRecording)
$('#recording-finished-dialog form').off('submit', claimRecording);
}
}
function registerDiscardRecordingHandlers(onOff) {
if (onOff) {
$('#discard-session-recording').on('click', discardRecording);
}
else {
$('#discard-session-recording').off('click', discardRecording);
}
}
function onPause() {
logger.debug("calling jamClient.SessionStopPlay");
context.jamClient.SessionStopPlay();
}
function onPlay(e, data) {
logger.debug("calling jamClient.SessionStartPlay");
context.jamClient.SessionStartPlay(data.playbackMode);
}
function onChangePlayPosition(e, data) {
logger.debug("calling jamClient.SessionTrackSeekMs(" + data.positionMs + ")");
context.jamClient.SessionTrackSeekMs(data.positionMs);
}
function registerStaticEvents() {
registerClaimRecordingHandlers(true);
registerDiscardRecordingHandlers(true);
$(playbackControls)
.on('pause', onPause)
.on('play', onPlay)
.on('change-position', onChangePlayPosition);
}
function setRecording(recordingData) {
if (recording != null) {
//XXX - prevent start/stop recording mashing; protect this dialog
logger.error("unable to set recording data over existing recording data. this coudld be due to start/stop recording mashing");
return;
}
recording = recordingData;
}
function initializeButtons() {
var isPublic = $('#recording-finished-dialog input[name="is_public"]');
context.JK.checkbox(isPublic);
}
function initialize() {
var dialogBindings = {
'beforeShow': beforeShow,
'afterHide': afterHide
};
app.bindDialog('recordingFinished', dialogBindings);
playbackControls = new context.JK.PlaybackControls($('#recording-finished-dialog .recording-controls'));
registerStaticEvents();
initializeButtons();
};
this.initialize = initialize;
this.setRecording = setRecording;
}
return this;
})(window,jQuery);
})(window, jQuery);

View File

@ -549,6 +549,14 @@
});
}
context.JK.checkbox = function($checkbox) {
$checkbox.iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal',
inheritClass: true
});
}
context.JK.dropdown = function($select) {
$select.each(function(index) {

View File

@ -1,55 +1,64 @@
(function(context,$) {
(function (context, $) {
"use strict";
context.JK = context.JK || {};
context.JK.WhatsNextDialog = function(app) {
var logger = context.JK.logger;
var rest = context.JK.Rest();
var invitationDialog = null;
"use strict";
context.JK = context.JK || {};
context.JK.WhatsNextDialog = function (app) {
var logger = context.JK.logger;
var rest = context.JK.Rest();
var invitationDialog = null;
function registerEvents() {
function registerEvents() {
$('#whatsnext-dialog a.facebook-invite').on('click', function(e) {
alert("This feature not yet implemented");
});
$('#whatsnext-dialog a.facebook-invite').on('click', function (e) {
invitationDialog.showFacebookDialog(e);
});
$('#whatsnext-dialog a.google-invite').on('click', function(e) {
invitationDialog.showGoogleDialog();
});
$('#whatsnext-dialog a.google-invite').on('click', function (e) {
invitationDialog.showGoogleDialog();
});
$('#whatsnext-dialog a.email-invite').on('click', function(e) {
invitationDialog.showEmailDialog();
});
}
function beforeShow() {
}
function beforeHide() {
var $dontShowWhatsNext = $('#show_whats_next');
if($dontShowWhatsNext.is(':checked')) {
rest.updateUser( {show_whats_next:false})
}
}
function initialize(invitationDialogInstance) {
var dialogBindings = {
'beforeShow' : beforeShow,
'beforeHide': beforeHide
};
app.bindDialog('whatsNext', dialogBindings);
registerEvents();
invitationDialog = invitationDialogInstance;
};
this.initialize = initialize;
$('#whatsnext-dialog a.email-invite').on('click', function (e) {
invitationDialog.showEmailDialog();
});
}
return this;
})(window,jQuery);
function beforeShow() {
}
function beforeHide() {
var $dontShowWhatsNext = $('#show_whats_next');
if ($dontShowWhatsNext.is(':checked')) {
rest.updateUser({show_whats_next: false})
}
}
function initializeButtons() {
var dontShow = $('#show_whats_next');
context.JK.checkbox(dontShow);
}
function initialize(invitationDialogInstance) {
var dialogBindings = {
'beforeShow': beforeShow,
'beforeHide': beforeHide
};
app.bindDialog('whatsNext', dialogBindings);
registerEvents();
invitationDialog = invitationDialogInstance;
initializeButtons();
};
this.initialize = initialize;
}
return this;
})(window, jQuery);

View File

@ -33,6 +33,7 @@
*= require ./account
*= require ./search
*= require ./ftue
*= require ./whatsNextDialog
*= require ./invitationDialog
*= require ./shareDialog
*= require ./hoverBubble

View File

@ -1,11 +1,11 @@
#recording-finished-dialog {
width:1000px;
height:auto;
div[purpose=description], div[purpose=is_public], div[purpose=is_downloadable] {
div[purpose=description], div[purpose=is_public] {
margin-top:20px;
}
label[for=is_downloadable], label[for=is_public], label[for=playback-mode-preview-all], label[for=playback-mode-preview-me] {
label[for=is_public], label[for=playback-mode-preview-all], label[for=playback-mode-preview-me] {
display:inline;
}
@ -16,5 +16,12 @@
.icheckbuttons {
margin-top:20px;
}
div[purpose=is_public] .icheckbox_minimal {
display:inline-block;
position:relative;
top:3px;
margin-right:3px;
}
}

View File

@ -0,0 +1,8 @@
#whatsnext-dialog {
.icheckbox_minimal {
display:inline-block;
position:relative;
top:3px;
margin-right:3px;
}
}

View File

@ -70,7 +70,7 @@ class ApiRecordingsController < ApiController
# claim will create a claimed recording for the creator
def claim
claim = @recording.claim(current_user, params[:name], params[:description], Genre.find_by_id(params[:genre]), params[:is_public], params[:is_downloadable])
claim = @recording.claim(current_user, params[:name], params[:description], Genre.find_by_id(params[:genre]), params[:is_public])
if claim.errors.any?
response.status = :unprocessable_entity

View File

@ -4,7 +4,7 @@
object @claimed_recording
attributes :id, :name, :description, :is_public, :is_downloadable, :genre_id
attributes :id, :name, :description, :is_public, :genre_id
node :share_url do |claimed_recording|
unless claimed_recording.share_token.nil?

View File

@ -50,7 +50,7 @@ end
node(:claimed_recording, :if => lambda { |music_session| music_session.users.exists?(current_user) } ) do |music_session|
child(:claimed_recording => :claimed_recording) {
attributes :id, :name, :description, :is_public, :is_downloadable
attributes :id, :name, :description, :is_public
child(:recording => :recording) {
attributes :id, :created_at, :duration

View File

@ -28,7 +28,7 @@ child(:comments => :comments) {
child(:claimed_recordings => :claimed_recordings) {
attributes :id, :name, :description, :is_public, :is_downloadable, :genre_id
attributes :id, :name, :description, :is_public, :genre_id
node :share_url do |claimed_recording|
unless claimed_recording.share_token.nil?

View File

@ -119,7 +119,6 @@
</div>
<div class="right mr30 buttonbar">
<span class="spinner-small" id="ftue-2-spinner"></span>
<a class="button-grey" layout-action="close">CANCEL</a>
<a class="button-grey">HELP</a>&nbsp;
<a class="button-orange disabled" id="btn-ftue-2-save">SAVE SETTINGS</a>

View File

@ -1,5 +1,5 @@
<!-- Invitation Dialog -->
<div class="dialog recordingFinished-overlay ftue-overlay tall" layout="dialog" layout-id="recordingFinished" id="recording-finished-dialog">
<div class="dialog recordingFinished-overlay ftue-overlay tall" layout="dialog" layout-id="recordingFinished" id="recording-finished-dialog">
<div class="content-head">
<%= image_tag "content/recordbutton-off.png", {:height => 20, :width => 20, :class => 'content-icon'} %>
@ -33,10 +33,6 @@
<div class="field left" purpose="is_public">
<input type="checkbox" checked="checked" name="is_public"/><label for="is_public">Public Recording</label> <!--<a href="#"><<img src="images/shared/icon_help.png" width="12" height="12" /></a>-->
</div>
<div class="field right" purpose="is_downloadable">
<input type="checkbox" checked="checked" name="is_downloadable"/><label for="is_downloadable"> Downloadable</label> <!--<a href="#"><img src="images/shared/icon_help.png" width="12" height="12" /></a>-->
</div>
</form>
<div class="left w50 ml30">

View File

@ -58,7 +58,7 @@ if [ -z $SKIP_TESTS ]; then
bundle exec rspec
if [ "$?" = "0" ]; then
echo "success: ran rspec tests"
elif [ "$?" = "20" ]; then
elif [ "$?" = "20" ]; then
echo "retrying once more"
bundle exec rspec
@ -68,7 +68,7 @@ if [ -z $SKIP_TESTS ]; then
echo "running rspec tests for the second time failed."
exit 1
fi
else
else
echo "running rspec tests failed."
exit 1
fi

View File

@ -18,7 +18,7 @@ namespace :db do
@recording.stop
@recording.reload
@genre = Genre.find('ambient')
@recording.claim(@user, "name", "description", @genre, true, true)
@recording.claim(@user, "name", "description", @genre, true)
@recording.reload
@claimed_recording = @recording.claimed_recordings.first
end
@ -222,7 +222,6 @@ def make_claimed_recording(recording, user, name, description)
claimed_recording.name = name
claimed_recording.description = description
claimed_recording.is_public = true
claimed_recording.is_downloadable = true
claimed_recording.genre = Genre.first
recording.claimed_recordings << claimed_recording
end

View File

@ -15,7 +15,7 @@ describe ApiClaimedRecordingsController do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@recording.claim(@user, "name", "description", @genre, true, true)
@recording.claim(@user, "name", "description", @genre, true)
@recording.reload
@claimed_recording = @recording.claimed_recordings.first
end

View File

@ -34,7 +34,7 @@ describe ApiRecordingsController do
recording = Recording.start(@music_session, @user)
recording.stop
recording.reload
claimed_recording = recording.claim(@user, "name", "description", Genre.first, true, true)
claimed_recording = recording.claim(@user, "name", "description", Genre.first, true)
@music_session.claimed_recording_start(@user, claimed_recording)
@music_session.errors.any?.should be_false
post :start, { :format => 'json', :music_session_id => @music_session.id }

View File

@ -157,7 +157,6 @@ FactoryGirl.define do
sequence(:name) { |n| "name-#{n}" }
sequence(:description) { |n| "description-#{n}" }
is_public true
is_downloadable true
association :genre, factory: :genre
association :user, factory: :user

View File

@ -159,7 +159,6 @@ describe "Session Recordings", :js => true, :type => :feature, :capybara_feature
expect(claimed_recording.name).to eq(name)
expect(claimed_recording.description).to eq(desc)
expect(claimed_recording.is_public).to be_true
expect(claimed_recording.is_downloadable).to be_true
expect(claimed_recording.genre).to eq(music_session.genres[0])
end
end
@ -189,7 +188,6 @@ describe "Session Recordings", :js => true, :type => :feature, :capybara_feature
expect(claimed_recording.name).to eq("my recording")
expect(claimed_recording.description).to eq('')
expect(claimed_recording.is_public).to be_true
expect(claimed_recording.is_downloadable).to be_true
expect(claimed_recording.genre).to eq(music_session.genres[0])
end
end

View File

@ -91,7 +91,7 @@ describe "social metadata" do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@recording.claim(@user, "name", "description", @genre, true, true)
@recording.claim(@user, "name", "description", @genre, true)
@recording.reload
@claimed_recording = @recording.claimed_recordings.first
end

View File

@ -57,7 +57,7 @@ describe "Home Screen", :js => true, :type => :feature, :capybara_feature => tru
describe "user can make prompt go away forever" do
it {
find('#show_whats_next').trigger(:click)
find('#whatsnext-dialog ins.iCheck-helper').trigger(:click)
find('#whatsnext-dialog a[layout-action="close"]').trigger(:click)
# needed because we poke the server with an updateUser call, but their is no indication in the UI that it's done

View File

@ -14,7 +14,7 @@ describe MusicSessionHelper do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@recording.claim(@user, "name", "description", @genre, true, true)
@recording.claim(@user, "name", "description", @genre, true)
@recording.reload
@claimed_recording = @recording.claimed_recordings.first
end

View File

@ -703,7 +703,7 @@ describe "Music Session API ", :type => :api do
recording = Recording.start(music_session, user)
recording.stop
recording.reload
claimed_recording = recording.claim(user, "name", "description", Genre.first, true, true)
claimed_recording = recording.claim(user, "name", "description", Genre.first, true)
recording.reload
login(user)

View File

@ -1010,7 +1010,7 @@ describe "User API", :type => :api do
@recording.stop
@recording.reload
@genre = FactoryGirl.create(:genre)
@recording.claim(user, "name", "description", @genre, true, true)
@recording.claim(user, "name", "description", @genre, true)
@recording.reload
@claimed_recording = @recording.claimed_recordings.first
end