* VRFS-3660 - fix issue with jamtrack tile page not refreshing when user buys free jamtrack
This commit is contained in:
parent
801504be2b
commit
9a8aeced51
|
|
@ -24,7 +24,7 @@ module JamRuby
|
|||
def name
|
||||
user.name
|
||||
end
|
||||
|
||||
|
||||
def music_session
|
||||
@msh ||= JamRuby::MusicSession.find_by_music_session_id(self.music_session_id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -540,6 +540,11 @@
|
|||
processData: false
|
||||
});
|
||||
}
|
||||
if(detail) {
|
||||
detail.done(function(user) {
|
||||
window.UserActions.loaded(user)
|
||||
})
|
||||
}
|
||||
return detail;
|
||||
}
|
||||
|
||||
|
|
@ -1167,11 +1172,12 @@
|
|||
}
|
||||
|
||||
function updateUser(options) {
|
||||
options = options || {};
|
||||
var id = getId(options);
|
||||
|
||||
delete options['id'];
|
||||
|
||||
return $.ajax({
|
||||
var deferred = $.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
|
|
@ -1179,6 +1185,13 @@
|
|||
data: JSON.stringify(options),
|
||||
processData: false
|
||||
});
|
||||
|
||||
deferred.done(function(user) {
|
||||
window.UserActions.loaded(user)
|
||||
})
|
||||
|
||||
return deferred;
|
||||
|
||||
}
|
||||
|
||||
function startRecording(options) {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ rest = context.JK.Rest()
|
|||
|
||||
@JamTrackLandingScreen = React.createClass({
|
||||
|
||||
mixins: [Reflux.listenTo(@AppStore,"onAppInit")]
|
||||
mixins: [Reflux.listenTo(@AppStore,"onAppInit"), Reflux.listenTo(@UserStore, "onUserChanged")]
|
||||
|
||||
getInitialState: () ->
|
||||
{user: null, purchasedJamTracks: []}
|
||||
|
||||
onUserChanged: (userState) ->
|
||||
@onUser(userState.user) if userState.user
|
||||
|
||||
render: () ->
|
||||
|
||||
howTo = null
|
||||
|
|
@ -27,6 +30,7 @@ rest = context.JK.Rest()
|
|||
</span>
|
||||
</div>`
|
||||
|
||||
if @state.purchasedJamTracks.length > 0
|
||||
playJamTracks = []
|
||||
|
||||
for jamTrack in @state.purchasedJamTracks
|
||||
|
|
@ -146,9 +150,7 @@ rest = context.JK.Rest()
|
|||
|
||||
@processUrl()
|
||||
|
||||
if context.JK.currentUserId
|
||||
@app.user().done(@onUser)
|
||||
else
|
||||
if !context.JK.currentUserId
|
||||
@onUser({free_jamtrack: context.JK.currentUserFreeJamTrack})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
context = window
|
||||
|
||||
@UserActions = Reflux.createActions({
|
||||
loaded: {}
|
||||
})
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
$ = jQuery
|
||||
context = window
|
||||
logger = context.JK.logger
|
||||
|
||||
@UserStore = Reflux.createStore(
|
||||
{
|
||||
user: null
|
||||
|
||||
listenables: @UserActions
|
||||
|
||||
onLoaded:(user) ->
|
||||
@user = user
|
||||
@changed()
|
||||
|
||||
changed:() ->
|
||||
@trigger({user: @user})
|
||||
}
|
||||
)
|
||||
|
|
@ -68,6 +68,7 @@
|
|||
rest.placeOrder()
|
||||
.done(function(purchaseResponse) {
|
||||
context.JK.currentUserFreeJamTrack = false // make sure the user sees no more free notices without having to do a full page refresh
|
||||
rest.updateUser()
|
||||
|
||||
checkoutUtils.setLastPurchase(purchaseResponse)
|
||||
jamTrackUtils.checkShoppingCart()
|
||||
|
|
|
|||
|
|
@ -356,6 +356,7 @@ body.web.individual_jamtrack {
|
|||
.icheckbox_minimal {
|
||||
float: left;
|
||||
top: 6px;
|
||||
margin-left:64px;
|
||||
}
|
||||
.cta-button {
|
||||
font-size: 24px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue