diff --git a/web/Gemfile b/web/Gemfile index 2b6d13c79..cd939fe53 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -98,9 +98,10 @@ source 'https://rails-assets.org' do gem 'rails-assets-classnames' end -group :development, :production do - gem 'rack-timeout' -end +#group :development, :production do +# gem 'rack-timeout' +#end + group :development, :test do gem 'rspec-rails', '2.14.2' gem "activerecord-import", "~> 0.4.1" diff --git a/web/app/assets/javascripts/accounts_jamtracks.js.coffee b/web/app/assets/javascripts/accounts_jamtracks.js.coffee index 74706efe1..362a2e4d6 100644 --- a/web/app/assets/javascripts/accounts_jamtracks.js.coffee +++ b/web/app/assets/javascripts/accounts_jamtracks.js.coffee @@ -88,8 +88,8 @@ context.JK.AccountJamTracks = class AccountJamTracks context.location = '/client#/session/' + newSessionId # Re-loading the session settings will cause the form to reset with the right stuff in it. # This is an extra xhr call, but it keeps things to a single codepath - loadSessionSettings() - context.JK.GA.trackSessionCount data.musician_access, data.fan_access, invitationCount + #loadSessionSettings() + context.JK.GA.trackSessionCount data.musician_access, data.fan_access, 0 context.JK.GA.trackSessionMusicians context.JK.GA.SessionCreationTypes.create ).fail (jqXHR) => handled = false diff --git a/web/app/assets/javascripts/react-components.js b/web/app/assets/javascripts/react-components.js index 14c31af19..a3f79c86e 100644 --- a/web/app/assets/javascripts/react-components.js +++ b/web/app/assets/javascripts/react-components.js @@ -4,6 +4,7 @@ //= require ./react-components/stores/RecordingStore //= require ./react-components/stores/SessionStore //= require ./react-components/stores/MixerStore +//= require ./react-components/stores/JamTrackStore //= require ./react-components/stores/SessionNotificationStore //= require ./react-components/stores/MediaPlaybackStore //= require ./react-components/stores/SessionMyTracksStore diff --git a/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee b/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee index 87d0bdc13..e9df33f2f 100644 --- a/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee @@ -77,7 +77,7 @@ mixins.push(Reflux.listenTo(MediaPlaybackStore, 'onMediaStateChanged')) ` windowUnloaded: () -> - SessionActions.closeMedia() unless window.DontAutoCloseMedia + SessionActions.closeMedia(false) unless window.DontAutoCloseMedia componentDidMount: () -> diff --git a/web/app/assets/javascripts/react-components/SessionMediaTracks.js.jsx.coffee b/web/app/assets/javascripts/react-components/SessionMediaTracks.js.jsx.coffee index 3de03c64f..78e455ca9 100644 --- a/web/app/assets/javascripts/react-components/SessionMediaTracks.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/SessionMediaTracks.js.jsx.coffee @@ -1,6 +1,7 @@ context = window rest = context.JK.Rest() SessionActions = @SessionActions +JamTrackActions = @JamTrackActions ReactCSSTransitionGroup = React.addons.CSSTransitionGroup MIX_MODES = context.JK.MIX_MODES EVENTS = context.JK.EVENTS @@ -8,7 +9,16 @@ ChannelGroupIds = context.JK.ChannelGroupIds @SessionMediaTracks = React.createClass({ - mixins: [@SessionMediaTracksMixin, Reflux.listenTo(@SessionMediaTracksStore,"onInputsChanged"), Reflux.listenTo(@AppStore,"onAppInit")] + mixins: [@SessionMediaTracksMixin, + Reflux.listenTo(@SessionMediaTracksStore,"onInputsChanged"), + Reflux.listenTo(@AppStore,"onAppInit"), + Reflux.listenTo(@JamTrackStore, "onJamTrackStateChanged")] + + onJamTrackStateChanged: (jamTrack) -> + if jamTrack? + @loadJamTrack(jamTrack) + else + SessionActions.closeMedia(true) inputsChangedProcessed: (state) -> @@ -27,11 +37,10 @@ ChannelGroupIds = context.JK.ChannelGroupIds @state.childWindow.DontAutoCloseMedia = true @state.childWindow.close() - closeAudio: (e) -> e.preventDefault() - SessionActions.closeMedia() + SessionActions.closeMedia(false) cancelDownloadJamTrack: (e) -> e.preventDefault() @@ -103,8 +112,7 @@ ChannelGroupIds = context.JK.ChannelGroupIds @app.layout.showDialog('open-jam-track-dialog').one(EVENTS.DIALOG_CLOSED, (e, data) => # once the dialog is closed, see if the user has a jamtrack selected if !data.canceled && data.result.jamTrack - @loadJamTrack(data.result.jamTrack) - + JamTrackActions.open(data.result.jamTrack) else logger.debug("OpenJamTrack dialog closed with no selection; ignoring", data) ) diff --git a/web/app/assets/javascripts/react-components/actions/JamTrackActions.js.coffee b/web/app/assets/javascripts/react-components/actions/JamTrackActions.js.coffee new file mode 100644 index 000000000..adcb9467a --- /dev/null +++ b/web/app/assets/javascripts/react-components/actions/JamTrackActions.js.coffee @@ -0,0 +1,7 @@ +context = window + +@JamTrackActions = Reflux.createActions({ + open: {} + close: {} +}) + diff --git a/web/app/assets/javascripts/react-components/stores/JamTrackStore.js.coffee b/web/app/assets/javascripts/react-components/stores/JamTrackStore.js.coffee new file mode 100644 index 000000000..b06d128f5 --- /dev/null +++ b/web/app/assets/javascripts/react-components/stores/JamTrackStore.js.coffee @@ -0,0 +1,34 @@ +$ = jQuery +context = window +logger = context.JK.logger +rest = context.JK.Rest() +EVENTS = context.JK.EVENTS + + +JamTrackActions = @JamTrackActions + +@JamTrackStore = Reflux.createStore( + { + listenables: JamTrackActions + jamTrack: null + + init: -> + # Register with the app store to get @app + this.listenTo(context.AppStore, this.onAppInit) + + onAppInit: (app) -> + @app = app + + onOpen: (jamTrack) -> + if @jamTrack? + @app.notify({text: 'Unable to open JamTrack because another one is already open.'}) + return + + @jamTrack = jamTrack + this.trigger(@jamTrack) + + onClose: () -> + @jamTrack = null + this.trigger(@jamTrack) + } +) \ No newline at end of file diff --git a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee index 01983b2ee..efb9303e4 100644 --- a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee @@ -5,7 +5,7 @@ rest = context.JK.Rest() EVENTS = context.JK.EVENTS MIX_MODES = context.JK.MIX_MODES - +JamTrackActions = @JamTrackActions SessionActions = @SessionActions RecordingActions = @RecordingActions NotificationActions = @NotificationActions @@ -203,8 +203,8 @@ NotificationActions = @NotificationActions @sessionPageEnterDeferred = null - - onCloseMedia: () -> + # codeInitiated means the user did not initiate this + onCloseMedia: (codeInitiated) -> logger.debug("SessionStore: onCloseMedia") if @helper.recordedTracks() @@ -216,7 +216,7 @@ NotificationActions = @NotificationActions else if @helper.isMetronomeOpen() @closeMetronomeTrack() else - logger.error("don't know how to close open media"); + logger.error("don't know how to close open media") unless codeInitiated closeJamTrack: () -> logger.debug("closing jam track"); @@ -244,6 +244,7 @@ NotificationActions = @NotificationActions ) context.jamClient.JamTrackStopPlay() + JamTrackActions.close() onOpenBackingTrack: (result) -> @@ -766,9 +767,10 @@ NotificationActions = @NotificationActions .done((response) => logger.debug("jamtrack opened") # now actually load the jamtrack - # TODO + context.SessionActions.updateSession.trigger(response); # context.JK.CurrentSessionModel.updateSession(response); # loadJamTrack(jamTrack); + JamTrackActions.open(jamTrack) ) .fail((jqXHR) => @app.notifyServerError(jqXHR, "Unable to Open JamTrack For Playback") @@ -1041,6 +1043,7 @@ NotificationActions = @NotificationActions @openBackingTrack = null @downloadingJamTrack = false + JamTrackActions.close() NotificationActions.sessionEnded() $(context.AppStore).triggerHandler('SessionEnded')