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

161 lines
3.9 KiB
CoffeeScript
Raw Normal View History

2013-07-30 06:53:57 +02:00
window.pfm.preloaders = {}
2013-07-28 19:45:21 +02:00
angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable'], [
2013-07-30 06:53:57 +02:00
'$routeProvider', '$locationProvider', '$stateProvider', '$dialogProvider', '$injector'
(route, location, state, $dialogProvider, $injector) ->
service = (name) -> angular.element(document.body).injector().get name
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 'track',
url: '/tracks/{id:[^\-]+}-{slug}'
templateUrl: '/templates/tracks/show.html'
controller: 'track'
2013-07-25 23:33:04 +02:00
state.state 'tracks',
url: '/tracks'
2013-07-31 13:47:16 +02:00
templateUrl: '/templates/tracks/_layout.html'
abstract: true
state.state 'tracks.search',
templateUrl: '/templates/tracks/search.html'
controller: 'tracks'
state.state 'tracks.search.list',
url: '?filter&page'
templateUrl: '/templates/tracks/search-list.html'
controller: 'tracks-list'
state.state 'tracks.popular',
url: '/popular'
templateUrl: '/templates/tracks/search.html'
controller: 'tracks'
state.state 'tracks.random',
url: '/random'
templateUrl: '/templates/tracks/search.html'
2013-07-28 23:51:35 +02:00
controller: 'tracks'
2013-07-25 23:33:04 +02:00
# Albums
state.state 'albums',
url: '/albums'
templateUrl: '/templates/albums/index.html'
# Playlists
state.state 'playlists',
url: '/playlists'
templateUrl: '/templates/playlists/index.html'
2013-07-28 19:45:21 +02:00
state.state '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 'artists',
url: '/artists'
templateUrl: '/templates/artists/index.html'
# 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
route.otherwise '/'
location.html5Mode(true);
$dialogProvider.options
dialogFade: true
backdropClick: false
]