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

217 lines
5.2 KiB
CoffeeScript
Raw Normal View History

2013-07-30 06:53:57 +02:00
window.pfm.preloaders = {}
module = angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable', 'pasvaz.bindonce', 'angularytics']
module.run [
'Angularytics',
(analyitcs) ->
analyitcs.init()
]
2013-07-30 06:53:57 +02:00
module.config [
'$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider'
(location, state, $dialogProvider, analytics) ->
analytics.setEventHandlers ['Google']
2013-07-25 23:33:04 +02:00
# Upload
state.state 'uploader',
url: '/account/uploader'
templateUrl: '/templates/uploader/index.html'
controller: 'uploader'
2013-07-25 23:33:04 +02:00
# Account
state.state 'account',
url: '/account'
abstract: true
templateUrl: '/templates/account/_layout.html'
state.state 'account.settings',
url: ''
2013-07-25 23:33:04 +02:00
templateUrl: '/templates/account/settings.html'
controller: 'account-settings'
state.state 'account.tracks',
2013-07-25 23:33:04 +02:00
url: '/tracks'
templateUrl: '/templates/account/tracks.html'
2013-07-28 09:09:10 +02:00
controller: 'account-tracks'
2013-07-25 23:33:04 +02:00
state.state 'account.tracks.edit',
2013-07-28 09:09:10 +02:00
url: '/edit/:track_id'
templateUrl: '/templates/account/track.html'
controller: 'account-track'
2013-07-25 23:33:04 +02:00
state.state 'account.albums',
2013-07-25 23:33:04 +02:00
url: '/albums'
templateUrl: '/templates/account/albums.html'
2013-07-28 09:09:10 +02:00
controller: 'account-albums'
state.state 'account.albums.create',
2013-07-28 09:09:10 +02:00
url: '/create'
templateUrl: '/templates/account/album.html'
2013-07-28 09:09:10 +02:00
controller: 'account-albums-edit'
state.state 'account.albums.edit',
2013-07-28 09:09:10 +02:00
url: '/edit/:album_id'
templateUrl: '/templates/account/album.html'
2013-07-28 09:09:10 +02:00
controller: 'account-albums-edit'
2013-07-25 23:33:04 +02:00
state.state 'account.playlists',
url: '/playlists'
templateUrl: '/templates/account/playlists.html'
2013-07-28 19:45:21 +02:00
controller: 'account-playlists'
2013-07-25 23:33:04 +02:00
state.state 'favourites',
2013-07-27 02:15:07 +02:00
url: '/account/favourites'
2013-07-25 23:33:04 +02:00
abstract: true
templateUrl: '/templates/favourites/_layout.html'
2013-07-25 23:33:04 +02:00
state.state 'favourites.tracks',
url: '/tracks'
templateUrl: '/templates/favourites/tracks.html'
controller: 'favourites-tracks'
2013-07-25 23:33:04 +02:00
state.state 'favourites.playlists',
2013-07-25 23:33:04 +02:00
url: '/playlists'
templateUrl: '/templates/favourites/playlists.html'
controller: 'favourites-playlists'
2013-07-25 23:33:04 +02:00
state.state 'favourites.albums',
2013-07-25 23:33:04 +02:00
url: '/albums'
templateUrl: '/templates/favourites/albums.html'
controller: 'favourites-albums'
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',
templateUrl: '/templates/tracks/index.html'
2013-07-31 13:47:16 +02:00
controller: 'tracks'
url: '/tracks'
abstract: true
2013-07-31 13:47:16 +02:00
state.state 'content.tracks.list',
url: '^/tracks?filter&page'
templateUrl: '/templates/tracks/list.html'
2013-07-31 13:47:16 +02:00
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'
controller: 'home'
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
]