2013-07-31 13:47:16 +02:00
|
|
|
window.pfm.preloaders['dashboard'] = [
|
|
|
|
'dashboard'
|
|
|
|
(dashboard) -> dashboard.refresh(true)
|
|
|
|
]
|
|
|
|
|
2013-07-28 23:51:35 +02:00
|
|
|
angular.module('ponyfm').controller "dashboard", [
|
2013-09-02 04:11:29 +02:00
|
|
|
'$scope', 'dashboard', 'auth', '$http'
|
|
|
|
($scope, dashboard, auth, $http) ->
|
2013-07-28 23:51:35 +02:00
|
|
|
$scope.recentTracks = null
|
|
|
|
$scope.popularTracks = null
|
2013-09-02 02:11:33 +02:00
|
|
|
$scope.news = null
|
2013-07-28 23:51:35 +02:00
|
|
|
|
2013-07-31 13:47:16 +02:00
|
|
|
dashboard.refresh().done (res) ->
|
|
|
|
$scope.recentTracks = res.recent_tracks
|
|
|
|
$scope.popularTracks = res.popular_tracks
|
2013-09-02 02:11:33 +02:00
|
|
|
$scope.news = res.news
|
2013-09-02 04:11:29 +02:00
|
|
|
|
|
|
|
$scope.markAsRead = (post) ->
|
|
|
|
if auth.data.isLogged
|
|
|
|
$http.post('/api/web/dashboard/read-news', {url: post.url, _token: window.pfm.token}).success ->
|
|
|
|
post.read = true
|
2013-07-28 23:51:35 +02:00
|
|
|
]
|