Pony.fm/public/scripts/app/app.coffee

198 lines
4.9 KiB
CoffeeScript
Raw Normal View History

2013-07-30 06:53:57 +02:00
window.pfm.preloaders = {}
2013-08-23 02:48:40 +02:00
module = angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable', 'pasvaz.bindonce']
2013-07-30 06:53:57 +02:00
module.config [
'$locationProvider', '$stateProvider', '$dialogProvider'
(location, state, $dialogProvider) ->
2013-07-25 23:33:04 +02:00
# Account
state.state 'account',
url: '/account'
templateUrl: '/templates/account/settings.html'
controller: 'account-settings'
state.state 'account-content',
2013-07-28 09:09:10 +02:00
url: '/account'
2013-07-25 23:33:04 +02:00
abstract: true
templateUrl: '/templates/account/content/_layout.html'
state.state 'account-content.tracks',
url: '/tracks'
templateUrl: '/templates/account/content/tracks.html'
2013-07-28 09:09:10 +02:00
controller: 'account-tracks'
2013-07-25 23:33:04 +02:00
state.state 'account-content.tracks.edit',
2013-07-28 09:09:10 +02:00
url: '/edit/:track_id'
2013-07-30 06:53:57 +02:00
templateUrl: '/templates/account/content/track.html'
controller: 'account-tracks-edit'
2013-07-25 23:33:04 +02:00
state.state 'account-content.albums',
url: '/albums'
templateUrl: '/templates/account/content/albums.html'
2013-07-28 09:09:10 +02:00
controller: 'account-albums'
state.state 'account-content.albums.create',
url: '/create'
templateUrl: '/templates/account/content/album.html'
controller: 'account-albums-edit'
state.state 'account-content.albums.edit',
url: '/edit/:album_id'
templateUrl: '/templates/account/content/album.html'
controller: 'account-albums-edit'
2013-07-25 23:33:04 +02:00
2013-07-28 19:45:21 +02:00
state.state 'account-content-playlists',
url: '/account/playlists'
2013-07-25 23:33:04 +02:00
templateUrl: '/templates/account/content/playlists.html'
2013-07-28 19:45:21 +02:00
controller: 'account-playlists'
2013-07-25 23:33:04 +02:00
2013-07-27 02:15:07 +02:00
state.state 'account-favourites',
url: '/account/favourites'
2013-07-25 23:33:04 +02:00
abstract: true
2013-07-27 02:15:07 +02:00
templateUrl: '/templates/account/favourites/_layout.html'
2013-07-25 23:33:04 +02:00
2013-07-27 02:15:07 +02:00
state.state 'account-favourites.tracks',
2013-07-25 23:33:04 +02:00
url: ''
2013-07-27 02:15:07 +02:00
templateUrl: '/templates/account/favourites/tracks.html'
2013-07-25 23:33:04 +02:00
2013-07-27 02:15:07 +02:00
state.state 'account-favourites.playlists',
2013-07-25 23:33:04 +02:00
url: '/playlists'
2013-07-27 02:15:07 +02:00
templateUrl: '/templates/account/favourites/playlists.html'
2013-07-25 23:33:04 +02:00
2013-07-27 02:15:07 +02:00
state.state 'account-favourites.albums',
2013-07-25 23:33:04 +02:00
url: '/albums'
2013-07-27 02:15:07 +02:00
templateUrl: '/templates/account/favourites/albums.html'
2013-07-25 23:33:04 +02:00
# Tracks
state.state 'content',
2013-07-31 13:47:16 +02:00
abstract: true
templateUrl: '/templates/content/_layout.html'
2013-07-31 13:47:16 +02:00
state.state 'content.tracks',
2013-07-31 13:47:16 +02:00
templateUrl: '/templates/tracks/search.html'
controller: 'tracks'
url: '/tracks'
abstract: true
2013-07-31 13:47:16 +02:00
state.state 'content.tracks.list',
url: '^/tracks?filter&page'
2013-07-31 13:47:16 +02:00
templateUrl: '/templates/tracks/search-list.html'
controller: 'tracks-list'
state.state 'content.track',
url: '/tracks/{id:[^\-]+}-{slug}'
templateUrl: '/templates/tracks/show.html'
controller: 'track'
2013-07-25 23:33:04 +02:00
# Albums
state.state 'content.albums',
2013-07-25 23:33:04 +02:00
url: '/albums'
templateUrl: '/templates/albums/index.html'
2013-08-01 04:01:41 +02:00
controller: 'albums'
abstract: true
state.state 'content.albums.list',
2013-08-01 04:01:41 +02:00
url: '?page'
templateUrl: '/templates/albums/list.html'
controller: 'albums-list'
state.state 'content.album',
2013-08-01 04:01:41 +02:00
url: '/albums/{id:[^\-]+}-{slug}'
templateUrl: '/templates/albums/show.html'
controller: 'album'
2013-07-25 23:33:04 +02:00
# Playlists
state.state 'content.playlists',
2013-07-25 23:33:04 +02:00
url: '/playlists'
templateUrl: '/templates/playlists/index.html'
2013-08-27 08:53:37 +02:00
controller: 'playlists'
abstract: true
state.state 'content.playlists.list',
url: '?page'
controller: 'playlists-list'
templateUrl: '/templates/playlists/list.html'
2013-07-25 23:33:04 +02:00
state.state 'content.playlist',
url: '/playlist/{id:[^\-]+}-{slug}'
2013-07-28 19:45:21 +02:00
templateUrl: '/templates/playlists/show.html'
controller: 'playlist'
2013-07-25 23:33:04 +02:00
# Artists
state.state 'content.artists',
2013-07-25 23:33:04 +02:00
url: '/artists'
templateUrl: '/templates/artists/index.html'
2013-08-01 04:01:41 +02:00
controller: 'artists'
abstract: true
state.state 'content.artists.list',
2013-08-01 04:01:41 +02:00
url: '?page'
templateUrl: '/templates/artists/list.html'
controller: 'artists-list'
2013-07-25 23:33:04 +02:00
# Pages
state.state 'faq',
url: '/faq'
templateUrl: '/templates/pages/faq.html'
state.state 'about',
url: '/about'
templateUrl: '/templates/pages/about.html'
# Auth
state.state 'login',
url: '/login'
templateUrl: '/templates/auth/login.html'
controller: 'login'
state.state 'register',
url: '/register'
templateUrl: '/templates/auth/register.html'
# Hompage
2013-07-28 23:51:35 +02:00
if window.pfm.auth.isLogged
state.state 'home',
url: '/'
2013-07-31 13:47:16 +02:00
templateUrl: '/templates/dashboard/index.html'
2013-07-28 23:51:35 +02:00
controller: 'dashboard'
else
state.state 'home',
url: '/'
templateUrl: '/templates/home/index.html'
2013-07-25 23:33:04 +02:00
2013-08-01 04:01:41 +02:00
# Final catch-all for aritsts
state.state 'content.artist',
url: '^/{slug}'
2013-08-01 04:47:21 +02:00
templateUrl: '/templates/artists/_show_layout.html'
abstract: true
2013-08-01 04:01:41 +02:00
controller: 'artist'
state.state 'content.artist.profile',
2013-08-01 04:47:21 +02:00
url: ''
templateUrl: '/templates/artists/profile.html'
controller: 'artist-profile'
state.state 'content.artist.content',
2013-08-01 04:47:21 +02:00
url: '/content'
templateUrl: '/templates/artists/content.html'
controller: 'artist-content'
state.state 'content.artist.favourites',
2013-08-01 04:47:21 +02:00
url: '/favourites'
templateUrl: '/templates/artists/favourites.html'
controller: 'artist-favourites'
2013-07-25 23:33:04 +02:00
location.html5Mode(true);
$dialogProvider.options
dialogFade: true
backdropClick: false
]