Test UI for notifications

This commit is contained in:
Josef Citrine 2016-05-27 20:38:59 +01:00
parent 0109244115
commit ef598a72ef
5 changed files with 15 additions and 2 deletions

View file

@ -35,4 +35,9 @@ class AccountController extends Controller
{ {
return Redirect::to(Config::get('poniverse.urls')['register']); return Redirect::to(Config::get('poniverse.urls')['register']);
} }
public function getNotifications()
{
return View::make('shared.null');
}
} }

View file

@ -65,6 +65,8 @@ Route::get('playlist/{id}-{slug}', 'PlaylistsController@getPlaylist');
Route::get('p{id}', 'PlaylistsController@getShortlink')->where('id', '\d+'); Route::get('p{id}', 'PlaylistsController@getShortlink')->where('id', '\d+');
Route::get('p{id}/dl.{extension}', 'PlaylistsController@getDownload' ); Route::get('p{id}/dl.{extension}', 'PlaylistsController@getDownload' );
Route::get('notifications', 'AccountController@getNotifications');
Route::group(['prefix' => 'api/v1', 'middleware' => 'json-exceptions'], function() { Route::group(['prefix' => 'api/v1', 'middleware' => 'json-exceptions'], function() {

View file

@ -0,0 +1,4 @@
<div ng-repeat="notification in notifications">
<a href="{{ notification.url }}"><img pfm-src-loader="::notification.thumbnail_url" pfm-src-size="thumbnail"></a>
<a href="{{ notification.url }}"><p>{{ notification.text }}</p></a>
</div>

View file

@ -17,6 +17,8 @@
module.exports = angular.module('ponyfm').controller "notifications", [ module.exports = angular.module('ponyfm').controller "notifications", [
'$scope', 'notifications' '$scope', 'notifications'
($scope, notifications) -> ($scope, notifications) ->
notifications.getNotifications().done (result) -> notifications.getNotifications().done (result) ->
$scope.notifications = result
console.log result console.log result
] ]

View file

@ -21,8 +21,8 @@ module.exports = angular.module('ponyfm').factory('notifications', [
getNotifications: () -> getNotifications: () ->
def = new $.Deferred() def = new $.Deferred()
$http.get('/api/web/account/notifications').success (response) -> $http.get('/api/web/notifications').success (response) ->
def.resolve response def.resolve response.notifications
def.promise() def.promise()