Fixes level ownership check

This commit is contained in:
Josh Callebaut 2016-01-27 14:47:27 -08:00
parent bd825d3108
commit 4a2d5c2e59
2 changed files with 9 additions and 5 deletions
app
templates/editor/level/modal
views/editor/level/modals

View file

@ -6,7 +6,7 @@ block modal-header-content
block modal-body-content
p
| Welcome to the Artisan Compendium. Below you will find a series of helpful guides and tutorials for getting your levels to Master Artisan quality
if view.creator === view.meID
if view.hasOwnership()
|, as well as a way to submit your level for official Artisan review
|! If you have any feedback on the Level Editor, please contact us at:
a(href='mailto:artisans@codecombat.com') artisans@codecombat.com
@ -17,7 +17,7 @@ block modal-body-content
a(href='https://github.com/codecombat/codecombat/wiki/Artisan-How-To-Index', target='_blank') Basic How-tos
div
a(href='http://direct.codecombat.com/community', target='_blank') Artisan Rankings
if view.creator === view.meID
if view.hasOwnership()
h4 Level Submission
p
| Do you want your level to be added to the campaign? Please take a moment to fill out the questions below! Dont worry, this isnt a timed quiz. It is just a way for the artisans at CodeCombat HQ to get a feel for the purpose of this level. If it doesnt quite yet meet our standards for release we will give you feedback to help polish it further!
@ -38,5 +38,5 @@ block modal-body-content
block modal-footer-content
div
a(href='#', data-dismiss="modal", aria-hidden="true").btn Close
if view.creator === view.meID
if view.hasOwnership()
button.btn.btn-primary#level-submit Submit

View file

@ -28,8 +28,6 @@ module.exports = class ArtisanGuideModal extends ModalView
@options =
level:@level.get('name')
levelSlug:@level.get('slug')
@creator = @level.get 'creator'
@meID = me.id
levelSubmit: ->
@playSound 'menu-button-click'
@ -53,3 +51,9 @@ module.exports = class ArtisanGuideModal extends ModalView
context.browser = "#{$.browser.platform} #{$.browser.name} #{$.browser.versionNumber}"
context.screenSize = "#{screen?.width ? $(window).width()} x #{screen?.height ? $(window).height()}"
context.screenshotURL = @screenshotURL
hasOwnership: ->
for permObj in @level.get('permissions')
if permObj.target is me.id and permObj.access is 'owner'
return true
return false