mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 19:06:59 -05:00
Show error message when editor fails to initiate.
This commit is contained in:
parent
a811086918
commit
6012a3ce9e
7 changed files with 53 additions and 5 deletions
|
@ -18,10 +18,12 @@ block content
|
||||||
h3(data-i18n="article.edit_article_title") Edit Article
|
h3(data-i18n="article.edit_article_title") Edit Article
|
||||||
span
|
span
|
||||||
|: "#{article.attributes.name}"
|
|: "#{article.attributes.name}"
|
||||||
|
|
||||||
#article-treema
|
#article-treema
|
||||||
|
|
||||||
#article-view
|
#article-view
|
||||||
|
|
||||||
hr
|
hr
|
||||||
|
|
||||||
|
div#error-view
|
||||||
|
|
||||||
|
|
|
@ -75,4 +75,6 @@ block outer_content
|
||||||
|
|
||||||
div.tab-pane#editor-level-systems-tab-view
|
div.tab-pane#editor-level-systems-tab-view
|
||||||
|
|
||||||
|
div#error-view
|
||||||
|
|
||||||
block footer
|
block footer
|
|
@ -84,4 +84,6 @@ block content
|
||||||
|
|
||||||
div#spritesheets
|
div#spritesheets
|
||||||
|
|
||||||
|
div#error-view
|
||||||
|
|
||||||
.clearfix
|
.clearfix
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
View = require 'views/kinds/RootView'
|
View = require 'views/kinds/RootView'
|
||||||
VersionHistoryView = require './versions_view'
|
VersionHistoryView = require './versions_view'
|
||||||
|
ErrorView = require '../../error_view'
|
||||||
template = require 'templates/editor/article/edit'
|
template = require 'templates/editor/article/edit'
|
||||||
Article = require 'models/Article'
|
Article = require 'models/Article'
|
||||||
|
|
||||||
|
@ -19,6 +20,18 @@ module.exports = class ArticleEditView extends View
|
||||||
super options
|
super options
|
||||||
@article = new Article(_id: @articleID)
|
@article = new Article(_id: @articleID)
|
||||||
@article.saveBackups = true
|
@article.saveBackups = true
|
||||||
|
|
||||||
|
@listenToOnce(@article, 'error',
|
||||||
|
() =>
|
||||||
|
@hideLoading()
|
||||||
|
|
||||||
|
# Hack: editor components appear after calling insertSubView.
|
||||||
|
# So we need to hide them first.
|
||||||
|
$(@$el).find('.main-content-area').children('*').not('#error-view').remove()
|
||||||
|
|
||||||
|
@insertSubView(new ErrorView())
|
||||||
|
)
|
||||||
|
|
||||||
@article.fetch()
|
@article.fetch()
|
||||||
@listenToOnce(@article, 'sync', @onArticleSync)
|
@listenToOnce(@article, 'sync', @onArticleSync)
|
||||||
@listenTo(@article, 'schema-loaded', @buildTreema)
|
@listenTo(@article, 'schema-loaded', @buildTreema)
|
||||||
|
|
|
@ -13,6 +13,7 @@ SystemsTabView = require './systems_tab_view'
|
||||||
LevelSaveView = require './save_view'
|
LevelSaveView = require './save_view'
|
||||||
LevelForkView = require './fork_view'
|
LevelForkView = require './fork_view'
|
||||||
VersionHistoryView = require './versions_view'
|
VersionHistoryView = require './versions_view'
|
||||||
|
ErrorView = require '../../error_view'
|
||||||
|
|
||||||
module.exports = class EditorLevelView extends View
|
module.exports = class EditorLevelView extends View
|
||||||
id: "editor-level-view"
|
id: "editor-level-view"
|
||||||
|
@ -43,6 +44,12 @@ module.exports = class EditorLevelView extends View
|
||||||
|
|
||||||
@level = new Level _id: @levelID
|
@level = new Level _id: @levelID
|
||||||
@listenToOnce(@level, 'sync', @onLevelLoaded)
|
@listenToOnce(@level, 'sync', @onLevelLoaded)
|
||||||
|
|
||||||
|
@listenToOnce(@supermodel, 'error',
|
||||||
|
() =>
|
||||||
|
@hideLoading()
|
||||||
|
@insertSubView(new ErrorView())
|
||||||
|
)
|
||||||
@supermodel.populateModel @level
|
@supermodel.populateModel @level
|
||||||
|
|
||||||
showLoading: ($el) ->
|
showLoading: ($el) ->
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
View = require 'views/kinds/RootView'
|
|
||||||
template = require 'templates/editor/thang/edit'
|
|
||||||
ThangType = require 'models/ThangType'
|
ThangType = require 'models/ThangType'
|
||||||
SpriteParser = require 'lib/sprites/SpriteParser'
|
SpriteParser = require 'lib/sprites/SpriteParser'
|
||||||
SpriteBuilder = require 'lib/sprites/SpriteBuilder'
|
SpriteBuilder = require 'lib/sprites/SpriteBuilder'
|
||||||
CocoSprite = require 'lib/surface/CocoSprite'
|
CocoSprite = require 'lib/surface/CocoSprite'
|
||||||
Camera = require 'lib/surface/Camera'
|
Camera = require 'lib/surface/Camera'
|
||||||
ThangComponentEditView = require 'views/editor/components/main'
|
|
||||||
VersionHistoryView = require './versions_view'
|
|
||||||
DocumentFiles = require 'collections/DocumentFiles'
|
DocumentFiles = require 'collections/DocumentFiles'
|
||||||
|
|
||||||
|
View = require 'views/kinds/RootView'
|
||||||
|
ThangComponentEditView = require 'views/editor/components/main'
|
||||||
|
VersionHistoryView = require './versions_view'
|
||||||
ColorsTabView = require './colors_tab_view'
|
ColorsTabView = require './colors_tab_view'
|
||||||
|
ErrorView = require '../../error_view'
|
||||||
|
template = require 'templates/editor/thang/edit'
|
||||||
|
|
||||||
CENTER = {x:200, y:300}
|
CENTER = {x:200, y:300}
|
||||||
|
|
||||||
|
@ -43,6 +44,18 @@ module.exports = class ThangTypeEditView extends View
|
||||||
@mockThang = $.extend(true, {}, @mockThang)
|
@mockThang = $.extend(true, {}, @mockThang)
|
||||||
@thangType = new ThangType(_id: @thangTypeID)
|
@thangType = new ThangType(_id: @thangTypeID)
|
||||||
@thangType.saveBackups = true
|
@thangType.saveBackups = true
|
||||||
|
|
||||||
|
@listenToOnce(@thangType, 'error',
|
||||||
|
() =>
|
||||||
|
@hideLoading()
|
||||||
|
|
||||||
|
# Hack: editor components appear after calling insertSubView.
|
||||||
|
# So we need to hide them first.
|
||||||
|
$(@$el).find('.main-content-area').children('*').not('#error-view').remove()
|
||||||
|
|
||||||
|
@insertSubView(new ErrorView())
|
||||||
|
)
|
||||||
|
|
||||||
@thangType.fetch()
|
@thangType.fetch()
|
||||||
@thangType.loadSchema()
|
@thangType.loadSchema()
|
||||||
@thangType.schema().once 'sync', @onThangTypeSync, @
|
@thangType.schema().once 'sync', @onThangTypeSync, @
|
||||||
|
|
9
app/views/error_view.coffee
Normal file
9
app/views/error_view.coffee
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
View = require 'views/kinds/RootView'
|
||||||
|
|
||||||
|
module.exports = class ErrorView extends View
|
||||||
|
id: "error-view"
|
||||||
|
el: "<div class='alert alert-warning'></div>"
|
||||||
|
|
||||||
|
render: ()->
|
||||||
|
super()
|
||||||
|
@$el.append("<h2><span>Error: Failed to process request.</span></h2>")
|
Loading…
Reference in a new issue