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

185 lines
3.9 KiB
CoffeeScript
Raw Normal View History

2013-07-28 19:45:21 +02:00
angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable'], [
2013-07-25 23:33:04 +02:00
'$routeProvider', '$locationProvider', '$stateProvider', '$dialogProvider'
(route, location, state, $dialogProvider) ->
# Account
state.state 'account',
url: '/account'
templateUrl: '/templates/account/settings.html'
controller: 'account-settings'
2013-07-29 22:54:53 +02:00
navigation:
index: 9
2013-07-25 23:33:04 +02:00
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'
2013-07-29 22:54:53 +02:00
navigation:
index: 8
2013-07-25 23:33:04 +02:00
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-29 22:54:53 +02:00
navigation:
index: 8
subIndex: 1
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-29 22:54:53 +02:00
navigation:
index: 8
subIndex: 1
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'
2013-07-29 22:54:53 +02:00
navigation:
index: 8
subIndex: 2
2013-07-28 09:09:10 +02:00
state.state 'account-content.albums.create',
url: '/create'
templateUrl: '/templates/account/content/album.html'
controller: 'account-albums-edit'
2013-07-29 22:54:53 +02:00
navigation:
index: 8
subIndex: 2
2013-07-28 09:09:10 +02:00
state.state 'account-content.albums.edit',
url: '/edit/:album_id'
templateUrl: '/templates/account/content/album.html'
controller: 'account-albums-edit'
2013-07-29 22:54:53 +02:00
navigation:
index: 8
subIndex: 2
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-29 22:54:53 +02:00
navigation:
index: 6
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-29 22:54:53 +02:00
navigation:
index: 7
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-29 22:54:53 +02:00
navigation:
index: 7
subIndex: 1
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-29 22:54:53 +02:00
navigation:
index: 7
subIndex: 3
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-29 22:54:53 +02:00
navigation:
index: 7
subIndex: 2
2013-07-25 23:33:04 +02:00
# Tracks
state.state 'tracks',
url: '/tracks'
templateUrl: '/templates/tracks/index.html'
2013-07-28 23:51:35 +02:00
controller: 'tracks'
2013-07-29 22:54:53 +02:00
navigation:
index: 2
2013-07-25 23:33:04 +02:00
# Albums
state.state 'albums',
url: '/albums'
templateUrl: '/templates/albums/index.html'
2013-07-29 22:54:53 +02:00
navigation:
index: 3
2013-07-25 23:33:04 +02:00
# Playlists
state.state 'playlists',
url: '/playlists'
templateUrl: '/templates/playlists/index.html'
2013-07-29 22:54:53 +02:00
navigation:
index: 4
2013-07-25 23:33:04 +02:00
2013-07-28 19:45:21 +02:00
state.state 'playlist',
url: '/playlist/:id/:slug'
templateUrl: '/templates/playlists/show.html'
controller: 'playlist'
2013-07-29 22:54:53 +02:00
navigation:
index: 4
2013-07-28 19:45:21 +02:00
2013-07-25 23:33:04 +02:00
# Artists
state.state 'artists',
url: '/artists'
templateUrl: '/templates/artists/index.html'
2013-07-29 22:54:53 +02:00
navigation:
index: 5
2013-07-25 23:33:04 +02:00
# Pages
state.state 'faq',
url: '/faq'
templateUrl: '/templates/pages/faq.html'
2013-07-29 22:54:53 +02:00
navigation:
index: 11
2013-07-25 23:33:04 +02:00
state.state 'about',
url: '/about'
templateUrl: '/templates/pages/about.html'
2013-07-29 22:54:53 +02:00
navigation:
index: 10
2013-07-25 23:33:04 +02:00
# Auth
state.state 'login',
url: '/login'
templateUrl: '/templates/auth/login.html'
controller: 'login'
2013-07-29 22:54:53 +02:00
navigation:
index: 12
2013-07-25 23:33:04 +02:00
state.state 'register',
url: '/register'
templateUrl: '/templates/auth/register.html'
2013-07-29 22:54:53 +02:00
navigation:
index: 13
2013-07-25 23:33:04 +02:00
# Hompage
2013-07-28 23:51:35 +02:00
if window.pfm.auth.isLogged
state.state 'home',
url: '/'
templateUrl: '/templates/dashboard.html'
controller: 'dashboard'
2013-07-29 22:54:53 +02:00
navigation:
index: 0
2013-07-28 23:51:35 +02:00
else
state.state 'home',
url: '/'
templateUrl: '/templates/home/index.html'
2013-07-29 22:54:53 +02:00
navigation:
index: 0
2013-07-25 23:33:04 +02:00
route.otherwise '/'
location.html5Mode(true);
$dialogProvider.options
dialogFade: true
backdropClick: false
]