#2: Rearranged various routes for account management + other cleanup.

The "Favourites" area within account management was removed as it duplicates
the functionality of the favourites area on public profiles.
This commit is contained in:
Peter Deltchev 2016-03-18 19:47:45 -07:00
parent 61e762dc13
commit d8933374ab
16 changed files with 42 additions and 196 deletions

View file

@ -1,41 +0,0 @@
<?php
/**
* Pony.fm - A community for pony fan music.
* Copyright (C) 2015 Peter Deltchev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm\Http\Controllers;
use View;
class FavouritesController extends Controller
{
public function getTracks()
{
return View::make('shared.null');
}
public function getAlbums()
{
return View::make('shared.null');
}
public function getPlaylists()
{
return View::make('shared.null');
}
}

View file

@ -158,22 +158,6 @@ Route::group(['prefix' => 'api/web'], function() {
Route::post('/auth/logout', 'Api\Web\AuthController@postLogout'); Route::post('/auth/logout', 'Api\Web\AuthController@postLogout');
}); });
Route::group(['prefix' => 'account', 'middleware' => 'auth'], function() {
Route::get('/favourites/tracks', 'FavouritesController@getTracks');
Route::get('/favourites/albums', 'FavouritesController@getAlbums');
Route::get('/favourites/playlists', 'FavouritesController@getPlaylists');
Route::get('/tracks', 'ContentController@getTracks');
Route::get('/tracks/edit/{id}', 'ContentController@getTracks');
Route::get('/albums', 'ContentController@getAlbums');
Route::get('/albums/edit/{id}', 'ContentController@getAlbums');
Route::get('/albums/create', 'ContentController@getAlbums');
Route::get('/playlists', 'ContentController@getPlaylists');
Route::get('/uploader', 'UploaderController@getIndex');
Route::get('/', 'AccountController@getIndex');
});
Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'can:access-admin-area']], function() { Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'can:access-admin-area']], function() {
Route::get('/genres', 'AdminController@getGenres'); Route::get('/genres', 'AdminController@getGenres');
@ -182,9 +166,27 @@ Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'can:access-admin-ar
Route::get('u{id}', 'ArtistsController@getShortlink')->where('id', '\d+'); Route::get('u{id}', 'ArtistsController@getShortlink')->where('id', '\d+');
Route::get('users/{id}-{slug}', 'ArtistsController@getShortlink')->where('id', '\d+'); Route::get('users/{id}-{slug}', 'ArtistsController@getShortlink')->where('id', '\d+');
Route::get('{slug}', 'ArtistsController@getProfile');
Route::get('{slug}/content', 'ArtistsController@getContent');
Route::get('{slug}/favourites', 'ArtistsController@getFavourites'); Route::group(['prefix' => '{slug}'], function() {
Route::get('/', 'ArtistsController@getProfile');
Route::get('/content', 'ArtistsController@getContent');
Route::get('/favourites', 'ArtistsController@getFavourites');
Route::group(['prefix' => 'account', 'middleware' => 'auth'], function() {
Route::get('/tracks', 'ContentController@getTracks');
Route::get('/tracks/edit/{id}', 'ContentController@getTracks');
Route::get('/albums', 'ContentController@getAlbums');
Route::get('/albums/edit/{id}', 'ContentController@getAlbums');
Route::get('/albums/create', 'ContentController@getAlbums');
Route::get('/playlists', 'ContentController@getPlaylists');
Route::get('/uploader', 'UploaderController@getIndex');
Route::get('/', 'AccountController@getIndex');
});
});
Route::get('/', 'HomeController@getIndex'); Route::get('/', 'HomeController@getIndex');

View file

@ -1,4 +1,7 @@
<ul class="tabs"> <ul class="tabs">
<li ui-sref-active="active">
<a ui-sref=".uploader">Upload music!</a>
</li>
<li ui-sref-active="active"> <li ui-sref-active="active">
<a ui-sref=".tracks">Tracks</a> <a ui-sref=".tracks">Tracks</a>
</li> </li>

View file

@ -1,7 +1,7 @@
<div> <div>
<ul class="dropdowns"> <ul class="dropdowns">
<li class="dropdown"> <li class="dropdown">
<a class="btn" href="/account/albums/create" ng-class="{'btn-primary': data.isEditorOpen && data.selectedAlbum == null}"> <a class="btn" ui-sref=".create" ng-class="{'btn-primary': data.isEditorOpen && data.selectedAlbum == null}">
<i class="icon-plus"></i> Create Album <i class="icon-plus"></i> Create Album
</a> </a>
</li> </li>
@ -11,7 +11,7 @@
<div class="list"> <div class="list">
<ul class="account-albums-listing stretch-to-bottom"> <ul class="account-albums-listing stretch-to-bottom">
<li ng-repeat="album in albums track by album.id" ng-class="{selected: album.id == data.selectedAlbum.id}"> <li ng-repeat="album in albums track by album.id" ng-class="{selected: album.id == data.selectedAlbum.id}">
<a href="/account/albums/edit/{{album.id}}"> <a ui-sref=".edit({album_id: {{::album.id}}})">
<img pfm-src-loader="album.covers.normal" pfm-src-size="normal" class="image" /> <img pfm-src-loader="album.covers.normal" pfm-src-size="normal" class="image" />
<span class="title">{{album.title}}</span> <span class="title">{{album.title}}</span>
<span class="published">{{album.created_at | date:'MM/dd/yyyy'}}</span> <span class="published">{{album.created_at | date:'MM/dd/yyyy'}}</span>

View file

@ -15,7 +15,7 @@
<li ng-if="::!artist.is_archived" ui-sref-active="active"> <li ng-if="::!artist.is_archived" ui-sref-active="active">
<a ui-sref=".favourites">Favourites</a> <a ui-sref=".favourites">Favourites</a>
</li> </li>
<li ng-if="::artist.permissions.edit" ui-sref-active="active" ui-sref=".account"><a ui-sref=".account.settings">Manage Account</a></li> <li ng-if="::artist.permissions.edit" ui-sref-active="{active: '.account'}"><a ui-sref=".account.settings">Manage Account</a></li>
</ul> </ul>
</header> </header>
<div class="stretch-to-bottom"> <div class="stretch-to-bottom">

View file

@ -1,9 +0,0 @@
<div>
<ul class="tabs">
<li ng-class="{active: stateIncludes('favourites.tracks')}"><a href="/account/favourites/tracks">Tracks</a></li>
<li ng-class="{active: stateIncludes('favourites.albums')}"><a href="/account/favourites/albums">Albums</a></li>
<li ng-class="{active: stateIncludes('favourites.playlists')}"><a href="/account/favourites/playlists">Playlists</a></li>
</ul>
<ui-view></ui-view>
</div>

View file

@ -1,3 +0,0 @@
<div class="stretch-to-bottom">
<pfm-albums-list albums="albums" />
</div>

View file

@ -1,3 +0,0 @@
<div class="stretch-to-bottom">
<pfm-playlists-list playlists="playlists"></pfm-playlists-list>
</div>

View file

@ -1,3 +0,0 @@
<div class="stretch-to-bottom">
<pfm-tracks-list tracks="tracks" class="three-columns"></pfm-tracks-list>
</div>

View file

@ -141,33 +141,6 @@ ponyfm.config [
url: '/errors/invalid' url: '/errors/invalid'
templateUrl: '/templates/errors/400.html' templateUrl: '/templates/errors/400.html'
# Upload
state.state 'uploader',
url: '/account/uploader'
templateUrl: '/templates/uploader/index.html'
controller: 'uploader'
state.state 'favourites',
url: '/account/favourites'
abstract: true
templateUrl: '/templates/favourites/_layout.html'
state.state 'favourites.tracks',
url: '/tracks'
templateUrl: '/templates/favourites/tracks.html'
controller: 'favourites-tracks'
state.state 'favourites.playlists',
url: '/playlists'
templateUrl: '/templates/favourites/playlists.html'
controller: 'favourites-playlists'
state.state 'favourites.albums',
url: '/albums'
templateUrl: '/templates/favourites/albums.html'
controller: 'favourites-albums'
# Tracks # Tracks
state.state 'content', state.state 'content',
@ -334,6 +307,13 @@ ponyfm.config [
abstract: true abstract: true
templateUrl: '/templates/account/_layout.html' templateUrl: '/templates/account/_layout.html'
# Upload
state.state 'content.artist.account.uploader',
url: '/uploader'
templateUrl: '/templates/uploader/index.html'
controller: 'uploader'
state.state 'content.artist.account.settings', state.state 'content.artist.account.settings',
url: '' url: ''
templateUrl: '/templates/account/settings.html' templateUrl: '/templates/account/settings.html'

View file

@ -89,7 +89,7 @@ module.exports = angular.module('ponyfm').controller "account-albums-edit", [
if $scope.isNew if $scope.isNew
$scope.isDirty = false $scope.isDirty = false
$scope.$emit 'album-created' $scope.$emit 'album-created'
$state.transitionTo 'account.albums.edit', {album_id: response.id} $state.go '^.edit', {album_id: response.id}
else else
$scope.isDirty = false $scope.isDirty = false
$scope.data.selectedAlbum.title = $scope.album.title $scope.data.selectedAlbum.title = $scope.album.title
@ -120,7 +120,7 @@ module.exports = angular.module('ponyfm').controller "account-albums-edit", [
$.post('/api/web/albums/delete/' + $scope.album.id) $.post('/api/web/albums/delete/' + $scope.album.id)
.then -> $scope.$apply -> .then -> $scope.$apply ->
$scope.$emit 'album-deleted' $scope.$emit 'album-deleted'
$state.transitionTo 'account.albums' $state.go '^'
$scope.setCover = (image, type) -> $scope.setCover = (image, type) ->
delete $scope.album.cover_id delete $scope.album.cover_id

View file

@ -55,4 +55,8 @@ module.exports = angular.module('ponyfm').controller "account-tracks", [
$state.transitionTo 'account.tracks' $state.transitionTo 'account.tracks'
tracks.clearCache() tracks.clearCache()
tracks.refresh(null, true).done setTracks tracks.refresh(null, true).done setTracks
$scope.$on 'track-updated', () ->
tracks.clearCache()
tracks.refresh(null, true).done setTracks
] ]

View file

@ -1,28 +0,0 @@
# Pony.fm - A community for pony fan music.
# Copyright (C) 2015 Peter Deltchev
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
window.pfm.preloaders['favourites-albums'] = [
'favourites'
(favourites) ->
favourites.fetchAlbums(true)
]
module.exports = angular.module('ponyfm').controller "favourites-albums", [
'$scope', 'favourites'
($scope, favourites) ->
favourites.fetchAlbums().done (res) ->
$scope.albums = res.albums
]

View file

@ -1,28 +0,0 @@
# Pony.fm - A community for pony fan music.
# Copyright (C) 2015 Peter Deltchev
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
window.pfm.preloaders['favourites-playlists'] = [
'favourites'
(favourites) ->
favourites.fetchPlaylists(true)
]
module.exports = angular.module('ponyfm').controller "favourites-playlists", [
'$scope', 'favourites'
($scope, favourites) ->
favourites.fetchPlaylists().done (res) ->
$scope.playlists = res.playlists
]

View file

@ -1,28 +0,0 @@
# Pony.fm - A community for pony fan music.
# Copyright (C) 2015 Peter Deltchev
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
window.pfm.preloaders['favourites-tracks'] = [
'favourites'
(favourites) ->
favourites.fetchTracks(true)
]
module.exports = angular.module('ponyfm').controller "favourites-tracks", [
'$scope', 'favourites'
($scope, favourites) ->
favourites.fetchTracks().done (res) ->
$scope.tracks = res.tracks
]

View file

@ -77,8 +77,8 @@
<li><a href="https://mlpforums.com/forum/62-ponyfm/" title="Pony.fm Forum" target="_blank">Forum</a></li> <li><a href="https://mlpforums.com/forum/62-ponyfm/" title="Pony.fm Forum" target="_blank">Forum</a></li>
@if (Auth::check()) @if (Auth::check())
<li class="uploader" ng-class="{selected: stateIncludes('uploader')}"> <li class="uploader" ui-sref-active="selected">
<a href="/account/uploader">Upload Music</a> <a ui-sref="content.artist.account.uploader({slug: auth.user.slug})">Upload Music</a>
</li> </li>
@can('access-admin-area') @can('access-admin-area')