mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-29 16:17:59 +01:00
Fixed the track editor sometimes not working after uploading a track.
This commit is contained in:
parent
bd9a525393
commit
b345601faf
2 changed files with 8 additions and 14 deletions
|
@ -27,7 +27,6 @@ angular.module('ponyfm').controller "account-tracks", [
|
||||||
selectedTrack: null
|
selectedTrack: null
|
||||||
|
|
||||||
$scope.tracks = []
|
$scope.tracks = []
|
||||||
|
|
||||||
tracksDb = {}
|
tracksDb = {}
|
||||||
|
|
||||||
setTracks = (tracks) ->
|
setTracks = (tracks) ->
|
||||||
|
@ -40,26 +39,20 @@ angular.module('ponyfm').controller "account-tracks", [
|
||||||
if $state.params.track_id
|
if $state.params.track_id
|
||||||
$scope.data.selectedTrack = tracksDb[$state.params.track_id]
|
$scope.data.selectedTrack = tracksDb[$state.params.track_id]
|
||||||
|
|
||||||
tracks.refresh().done setTracks
|
|
||||||
|
|
||||||
$scope.refreshList = () ->
|
|
||||||
tracks.refresh().done setTracks
|
|
||||||
|
|
||||||
$scope.selectTrack = (track) ->
|
$scope.selectTrack = (track) ->
|
||||||
$scope.data.selectedTrack = track
|
$scope.data.selectedTrack = track
|
||||||
|
|
||||||
|
|
||||||
|
tracks.refresh().done setTracks
|
||||||
|
|
||||||
$scope.$on '$stateChangeSuccess', () ->
|
$scope.$on '$stateChangeSuccess', () ->
|
||||||
if $state.params.track_id
|
if $state.params.track_id
|
||||||
$scope.selectTrack tracksDb[$state.params.track_id]
|
$scope.selectTrack tracksDb[$state.params.track_id]
|
||||||
else
|
else
|
||||||
$scope.selectTrack null
|
$scope.selectTrack null
|
||||||
|
|
||||||
$scope.$on 'track-updated', (track) ->
|
|
||||||
tracks.clearCache()
|
|
||||||
$scope.refreshList()
|
|
||||||
|
|
||||||
$scope.$on 'track-deleted', () ->
|
$scope.$on 'track-deleted', () ->
|
||||||
$state.transitionTo 'account.tracks'
|
$state.transitionTo 'account.tracks'
|
||||||
tracks.clearCache()
|
tracks.clearCache()
|
||||||
$scope.refreshList()
|
tracks.refresh(null, true).done setTracks
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
angular.module('ponyfm').factory('upload', [
|
angular.module('ponyfm').factory('upload', [
|
||||||
'$rootScope', '$http', '$timeout'
|
'$rootScope', '$http', '$timeout', 'account-tracks'
|
||||||
($rootScope, $http, $timeout) ->
|
($rootScope, $http, $timeout, accountTracks) ->
|
||||||
self =
|
self =
|
||||||
queue: []
|
queue: []
|
||||||
|
|
||||||
|
@ -94,7 +94,8 @@ angular.module('ponyfm').factory('upload', [
|
||||||
upload.error = error
|
upload.error = error
|
||||||
$rootScope.$broadcast 'upload-error', [upload, error]
|
$rootScope.$broadcast 'upload-error', [upload, error]
|
||||||
|
|
||||||
$rootScope.$broadcast 'upload-finished', upload
|
accountTracks.refresh(null, true)
|
||||||
|
.done($rootScope.$broadcast('upload-finished', upload))
|
||||||
|
|
||||||
# send the track to the server
|
# send the track to the server
|
||||||
formData = new FormData();
|
formData = new FormData();
|
||||||
|
|
Loading…
Reference in a new issue