Merge pull request #3471 from delftswa2016/loggedIn-achievement-error

Error when accessing achievement without being logged in
This commit is contained in:
Scott Erickson 2016-03-30 09:41:01 -07:00
commit 43389ac9b6
2 changed files with 11 additions and 14 deletions

View file

@ -2,7 +2,6 @@ extends /templates/base
block content
- var authorized = me.isAdmin() || me.isArtisan();
if authorized
ol.breadcrumb
li
a(href="/editor", data-i18n="editor.main_title") CodeCombat Editors
@ -11,6 +10,7 @@ block content
li.active
| #{view.achievement.attributes.name}
if authorized
button.achievement-tool-button(data-i18n="", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#recalculate-all-button Recalculate All
button.achievement-tool-button(data-i18n="", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#recalculate-button Recalculate
button.achievement-tool-button(data-i18n="common.delete", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#delete-button Delete
@ -18,7 +18,7 @@ block content
h3(data-i18n="achievement.edit_achievement_title") Edit Achievement
span
|: "#{view.achievement.attributes.name}"
|: "#{view.achievement.get('name')}"
#achievement-treema
@ -28,7 +28,3 @@ block content
.patches-view
hr
else
.alert.alert-danger
span Admin only. Turn around.

View file

@ -54,6 +54,7 @@ module.exports = class AchievementEditView extends RootView
afterRender: ->
super()
return unless @supermodel.finished()
@showReadOnly() if me.get('anonymous')
@pushChangesToPreview()
@patchesView = @insertSubView(new PatchesView(@achievement), @$el.find('.patches-view'))
@patchesView.load()