mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-28 13:50:07 -04:00
Added owner-based save enabling on Thang Types. NOTE server-sided doesn't work yet
This commit is contained in:
parent
05b4f536c1
commit
0aa8e7bb7d
7 changed files with 11 additions and 7 deletions
app
templates/editor/thang
views/editor
|
@ -12,9 +12,8 @@ block content
|
|||
|
||||
img#portrait.img-thumbnail
|
||||
|
||||
button.btn.btn-primary#save-button(data-toggle="coco-modal", data-target="modal/save_version")
|
||||
| Save
|
||||
button.btn.btn-primary#revert-button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="revert.revert") Revert
|
||||
button.btn.btn-primary#save-button(data-toggle="coco-modal", data-target="modal/save_version", disabled=authorized === true ? undefined : "true") Save
|
||||
button.btn.btn-primary#revert-button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="revert.revert", disabled=authorized === true ? undefined : "true") Revert
|
||||
|
||||
h3 Edit Thang Type: "#{thangType.attributes.name}"
|
||||
|
||||
|
@ -38,9 +37,9 @@ block content
|
|||
select#animations-select
|
||||
for animation in animations
|
||||
option #{animation}
|
||||
button.btn.btn-small.btn-primary#upload-button
|
||||
button(disabled=authorized === true ? undefined : "true").btn.btn-small.btn-primary#upload-button
|
||||
i.icon-upload
|
||||
button.btn.btn-small.btn-primary#clear-button
|
||||
button(disabled=authorized === true ? undefined : "true").btn.btn-small.btn-primary#clear-button
|
||||
i.icon-remove
|
||||
input#real-upload-button(type="file")
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ module.exports = class ArticleEditView extends View
|
|||
data: data
|
||||
filePath: "db/thang.type/#{@article.get('original')}"
|
||||
schema: Article.schema.attributes
|
||||
readOnly: true unless me.isAdmin() or @article.hasWriteAccess(me)
|
||||
callbacks:
|
||||
change: @pushChangesToPreview
|
||||
options.readOnly = true unless me.isAdmin()
|
||||
@treema = @$el.find('#article-treema').treema(options)
|
||||
|
||||
@treema.build()
|
||||
|
|
|
@ -59,7 +59,7 @@ module.exports = class ScriptsTabView extends View
|
|||
thangIDs: thangIDs
|
||||
dimensions: @dimensions
|
||||
supermodel: @supermodel
|
||||
readOnly: not me.isAdmin() and not @level.hasWriteAccess(me)
|
||||
readOnly: true unless me.isAdmin() or @level.hasWriteAccess(me)
|
||||
callbacks:
|
||||
change: @onScriptChanged
|
||||
nodeClasses:
|
||||
|
|
|
@ -29,6 +29,7 @@ module.exports = class SettingsTabView extends View
|
|||
supermodel: @supermodel
|
||||
schema: schema
|
||||
data: data
|
||||
readOnly: true unless me.isAdmin() or @level.hasWriteAccess(me)
|
||||
callbacks: {change: @onSettingsChanged}
|
||||
thangIDs: thangIDs
|
||||
nodeClasses:
|
||||
|
|
|
@ -69,6 +69,7 @@ module.exports = class SystemsTabView extends View
|
|||
supermodel: @supermodel
|
||||
schema: Level.schema.get('properties').systems
|
||||
data: systems
|
||||
readOnly: true unless me.isAdmin() or @level.hasWriteAccess(me)
|
||||
callbacks:
|
||||
change: @onSystemsChanged
|
||||
select: @onSystemSelected
|
||||
|
|
|
@ -115,6 +115,7 @@ module.exports = class ColorsTabView extends CocoView
|
|||
treemaOptions =
|
||||
data: data
|
||||
schema: schema
|
||||
readOnly: true unless me.isAdmin() or @thangType.hasWriteAccess(me)
|
||||
callbacks:
|
||||
change: @onColorGroupsChanged
|
||||
select: @onColorGroupSelected
|
||||
|
|
|
@ -57,6 +57,7 @@ module.exports = class ThangTypeEditView extends View
|
|||
context = super(context)
|
||||
context.thangType = @thangType
|
||||
context.animations = @getAnimationNames()
|
||||
context.authorized = me.isAdmin() or @thangType.hasWriteAccess(me)
|
||||
context
|
||||
|
||||
getAnimationNames: ->
|
||||
|
@ -328,6 +329,7 @@ module.exports = class ThangTypeEditView extends View
|
|||
schema: schema
|
||||
files: @files
|
||||
filePath: "db/thang.type/#{@thangType.get('original')}"
|
||||
readOnly: true unless me.isAdmin() or @thangType.hasWriteAccess(me)
|
||||
callbacks:
|
||||
change: @pushChangesToPreview
|
||||
select: @onSelectNode
|
||||
|
|
Loading…
Add table
Reference in a new issue