errors.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. (function (Misago) {
  2. 'use strict';
  3. var errorPage = function(error) {
  4. var error_message = [
  5. m('p.lead', error.message)
  6. ];
  7. if (error.help) {
  8. error_message.push(m('p.help', error.help));
  9. }
  10. return m('.page.error-page.error-' + error.code + '-page',
  11. m('.container',
  12. m('.error-panel', [
  13. m('.error-icon',
  14. m('span.material-icon', error.icon)
  15. ),
  16. m('.error-message', error_message)
  17. ])
  18. )
  19. );
  20. };
  21. Misago.Error403Route = Misago.route({
  22. controller: function() {
  23. this.container.setTitle(gettext('Page not available'));
  24. },
  25. error: null,
  26. view: function() {
  27. return m('.page.error-page.error-403-page',
  28. m('.container', [
  29. m('h1', 'Error 403!'),
  30. m('p.lead', this.error || 'No perm to see this page')
  31. ])
  32. );
  33. }
  34. });
  35. Misago.Error404Route = Misago.route({
  36. controller: function() {
  37. this.container.setTitle(gettext('Page not found'));
  38. },
  39. view: function() {
  40. return errorPage({
  41. code: 404,
  42. icon: 'gesture',
  43. message: gettext("Requested page could not be found."),
  44. help: gettext("The link you clicked was incorrect or the page has been moved or deleted.")
  45. });
  46. }
  47. });
  48. Misago.Error500Route = Misago.route({
  49. controller: function() {
  50. this.container.setTitle(gettext('Application error occured'));
  51. },
  52. view: function() {
  53. return errorPage({
  54. code: 500,
  55. icon: 'error_outline',
  56. message: gettext("Requested page could not be displayed due to an error.")
  57. });
  58. }
  59. });
  60. Misago.Error0Route = Misago.route({
  61. controller: function() {
  62. this.container.setTitle(gettext('Lost connection to application'));
  63. },
  64. view: function() {
  65. return errorPage({
  66. code: 500,
  67. icon: 'sync_problem',
  68. message: gettext("Could not connect to application."),
  69. help: gettext("This may be caused by problems with your connection or application server. Please check your inter connection and refresh page if problem persists.")
  70. });
  71. }
  72. });
  73. }(Misago.prototype));