mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Added cute error pages
This commit is contained in:
parent
ddd11ff79b
commit
0000c4297d
18 changed files with 115 additions and 14 deletions
|
@ -14,6 +14,7 @@
|
|||
use Entities\Image;
|
||||
use Entities\Track;
|
||||
use Entities\User;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
|
|
@ -40,6 +40,15 @@
|
|||
});
|
||||
}
|
||||
|
||||
App::error(function($exception) {
|
||||
return Response::view('errors.404', array(), 404);
|
||||
});
|
||||
|
||||
App::missing(function($exception) {
|
||||
return Response::view('errors.404', array(), 404);
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Filters
|
||||
|
|
|
@ -94,6 +94,6 @@
|
|||
$destination = $this->getDirectory();
|
||||
|
||||
if (!is_dir($destination))
|
||||
mkdir($destination, 755, true);
|
||||
mkdir($destination, 777, true);
|
||||
}
|
||||
}
|
|
@ -328,7 +328,7 @@
|
|||
$destination = $this->getDirectory();
|
||||
|
||||
if (!is_dir($destination))
|
||||
mkdir($destination, 755);
|
||||
mkdir($destination, 777);
|
||||
}
|
||||
|
||||
public function hasCover() {
|
||||
|
|
12
app/views/errors/400.blade.php
Normal file
12
app/views/errors/400.blade.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
@extends('shared._app_layout')
|
||||
|
||||
@section('app_content')
|
||||
<h1>400 - Invalid Request</h1>
|
||||
<p>Your request was invalid.</p>
|
||||
@endsection
|
||||
|
||||
@section('app_scripts')
|
||||
<script>
|
||||
window.pfm.error = 400;
|
||||
</script>
|
||||
@endsection
|
12
app/views/errors/403.blade.php
Normal file
12
app/views/errors/403.blade.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
@extends('shared._app_layout')
|
||||
|
||||
@section('app_content')
|
||||
<h1>403 - Not Authorized</h1>
|
||||
<p>You cannot do this.</p>
|
||||
@endsection
|
||||
|
||||
@section('app_scripts')
|
||||
<script>
|
||||
window.pfm.error = 403;
|
||||
</script>
|
||||
@endsection
|
12
app/views/errors/404.blade.php
Normal file
12
app/views/errors/404.blade.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
@extends('shared._app_layout')
|
||||
|
||||
@section('app_content')
|
||||
<h1>404 - Not Found</h1>
|
||||
<p>We could not find what you were looking for.</p>
|
||||
@endsection
|
||||
|
||||
@section('app_scripts')
|
||||
<script>
|
||||
window.pfm.error = 404;
|
||||
</script>
|
||||
@endsection
|
12
app/views/errors/500.blade.php
Normal file
12
app/views/errors/500.blade.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
@extends('shared._app_layout')
|
||||
|
||||
@section('app_content')
|
||||
<h1>400 - Server Error</h1>
|
||||
<p>There was an error in the server.</p>
|
||||
@endsection
|
||||
|
||||
@section('app_scripts')
|
||||
<script>
|
||||
window.pfm.error = 500;
|
||||
</script>
|
||||
@endsection
|
|
@ -92,7 +92,6 @@
|
|||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
|
||||
<script>
|
||||
window.pfm = {
|
||||
token: "{{Session::token()}}",
|
||||
|
@ -112,7 +111,6 @@
|
|||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-29463256-1']);
|
||||
_gaq.push(['_setDomainName', 'pony.fm']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
|
@ -123,4 +121,6 @@
|
|||
|
||||
{{ Assets::scriptIncludes() }}
|
||||
|
||||
@yield('app_scripts')
|
||||
|
||||
@endsection
|
|
@ -22,6 +22,23 @@ module.config [
|
|||
|
||||
analytics.setEventHandlers ['Google']
|
||||
|
||||
# Errors
|
||||
state.state 'errors-404',
|
||||
url: '/errors/not-found'
|
||||
templateUrl: '/templates/errors/404.html'
|
||||
|
||||
state.state 'errors-500',
|
||||
url: '/errors/server'
|
||||
templateUrl: '/templates/errors/500.html'
|
||||
|
||||
state.state 'errors-403',
|
||||
url: '/errors/not-authorized'
|
||||
templateUrl: '/templates/errors/403.html'
|
||||
|
||||
state.state 'errors-400',
|
||||
url: '/errors/invalid'
|
||||
templateUrl: '/templates/errors/400.html'
|
||||
|
||||
# Upload
|
||||
|
||||
state.state 'uploader',
|
||||
|
|
|
@ -8,6 +8,9 @@ angular.module('ponyfm').controller "application", [
|
|||
$loadingElement = null
|
||||
loadingStateName = null
|
||||
|
||||
if window.pfm.error
|
||||
$state.transitionTo 'errors-' + window.pfm.error
|
||||
|
||||
$rootScope.safeApply = (fn) ->
|
||||
phase = $rootScope.$$phase
|
||||
if (phase == '$apply' || phase == 'digest')
|
||||
|
@ -73,7 +76,10 @@ angular.module('ponyfm').controller "application", [
|
|||
|
||||
stateToInject = angular.copy newState
|
||||
stateToInject.params = newParams
|
||||
$injector.invoke(preloader, null, {$state: stateToInject}).then ->
|
||||
statesPreloaded[newState] = true
|
||||
try
|
||||
$injector.invoke(preloader, null, {$state: stateToInject}).then ->
|
||||
statesPreloaded[newState] = true
|
||||
$state.transitionTo newState, newParams
|
||||
catch error
|
||||
$state.transitionTo newState, newParams
|
||||
]
|
|
@ -7,6 +7,7 @@ window.pfm.preloaders['artist-content'] = [
|
|||
angular.module('ponyfm').controller "artist-content", [
|
||||
'$scope', 'artists', '$state'
|
||||
($scope, artists, $state) ->
|
||||
artists.fetchContent($state.params.slug).done (artistResponse) ->
|
||||
$scope.content = artistResponse
|
||||
artists.fetchContent($state.params.slug)
|
||||
.done (artistResponse) ->
|
||||
$scope.content = artistResponse
|
||||
]
|
|
@ -7,8 +7,9 @@ window.pfm.preloaders['artist'] = [
|
|||
angular.module('ponyfm').controller "artist", [
|
||||
'$scope', 'artists', '$state', 'follow'
|
||||
($scope, artists, $state, follow) ->
|
||||
artists.fetch($state.params.slug).done (artistResponse) ->
|
||||
$scope.artist = artistResponse.artist
|
||||
artists.fetch($state.params.slug)
|
||||
.done (artistResponse) ->
|
||||
$scope.artist = artistResponse.artist
|
||||
|
||||
$scope.toggleFollow = () ->
|
||||
follow.toggle('artist', $scope.artist.id).then (res) ->
|
||||
|
|
|
@ -25,8 +25,11 @@ angular.module('ponyfm').factory('artists', [
|
|||
slug = 1 if !slug
|
||||
return artists[slug] if !force && artists[slug]
|
||||
artistsDef = new $.Deferred()
|
||||
$http.get('/api/web/artists/' + slug).success (albums) ->
|
||||
artistsDef.resolve albums
|
||||
$http.get('/api/web/artists/' + slug)
|
||||
.success (albums) ->
|
||||
artistsDef.resolve albums
|
||||
.catch () ->
|
||||
artistsDef.reject()
|
||||
|
||||
artists[slug] = artistsDef.promise()
|
||||
|
||||
|
@ -35,8 +38,11 @@ angular.module('ponyfm').factory('artists', [
|
|||
slug = 1 if !slug
|
||||
return artistContent[slug] if !force && artistContent[slug]
|
||||
artistsDef = new $.Deferred()
|
||||
$http.get('/api/web/artists/' + slug + '/content').success (albums) ->
|
||||
artistsDef.resolve albums
|
||||
$http.get('/api/web/artists/' + slug + '/content')
|
||||
.success (albums) ->
|
||||
artistsDef.resolve albums
|
||||
.catch () ->
|
||||
artistsDef.reject()
|
||||
|
||||
artistContent[slug] = artistsDef.promise()
|
||||
|
||||
|
|
3
public/templates/errors/400.html
Normal file
3
public/templates/errors/400.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h1>Twilight Sparkle burns with the rage of 400 suns.</h1>
|
||||
<p>The request you sent was not properly formed. Unfortunately, this means it had to be rejected.</p>
|
||||
<p>There isn't much you can do here, but perhaps you would like to go to our <a href="/">home page</a>?</p>
|
3
public/templates/errors/403.html
Normal file
3
public/templates/errors/403.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h1>403 Royal Guards stand in your way.</h1>
|
||||
<p>Looks like you tried to do something you weren't allowed to!</p>
|
||||
<p>There isn't much you can do here, but perhaps you would like to go to our <a href="/">home page</a>?</p>
|
3
public/templates/errors/404.html
Normal file
3
public/templates/errors/404.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h1>404 parasprites invaded the town!</h1>
|
||||
<p>We couldn't track down the page you were looking for! Perhaps a parasprite has eaten it, or it may never have existed in the first place. It's also possible that Princess Celestia banished it to the moon for heresy.</p>
|
||||
<p>In any case, we're sorry this happened. Perhaps you would like to go to our <a href="/">home page</a>?</p>
|
3
public/templates/errors/500.html
Normal file
3
public/templates/errors/500.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h1>500 buckets of oats on the wall.</h1>
|
||||
<p>Something went wrong on our servers while we were processing your request. We're really sorry about this, and will work hard to get this resolved as soon as possible.</p>
|
||||
<p>In any case, we're sorry this happened. Perhaps you would like to go to our <a href="/">home page</a>?</p>
|
Loading…
Reference in a new issue