mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 08:23:57 -04:00
Merge pull request #3380 from Zerrien/editorChanges
Style fixes and fixes level submission emails
This commit is contained in:
commit
7db678e63f
4 changed files with 40 additions and 64 deletions
app
templates/editor/level
views/editor/level
|
@ -6,7 +6,7 @@ block modal-header-content
|
||||||
block modal-body-content
|
block modal-body-content
|
||||||
p
|
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
|
| 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
|
|, 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:
|
|! If you have any feedback on the Level Editor, please contact us at:
|
||||||
a(href='mailto:artisans@codecombat.com') artisans@codecombat.com
|
a(href='mailto:artisans@codecombat.com') artisans@codecombat.com
|
||||||
|
@ -16,8 +16,8 @@ block modal-body-content
|
||||||
div
|
div
|
||||||
a(href='https://github.com/codecombat/codecombat/wiki/Artisan-How-To-Index', target='_blank') Basic How-tos
|
a(href='https://github.com/codecombat/codecombat/wiki/Artisan-How-To-Index', target='_blank') Basic How-tos
|
||||||
div
|
div
|
||||||
a(href='http://direct.codecombat.com/community', target='_blank') Artisan Rankings
|
a(href='http://www.codecombat.com/community', target='_blank') Artisan Rankings
|
||||||
if view.creator === view.meID
|
if view.hasOwnership()
|
||||||
h4 Level Submission
|
h4 Level Submission
|
||||||
p
|
p
|
||||||
| Do you want your level to be added to the campaign? Please take a moment to fill out the questions below! Don’t worry, this isn’t 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 doesn’t quite yet meet our standards for release we will give you feedback to help polish it further!
|
| Do you want your level to be added to the campaign? Please take a moment to fill out the questions below! Don’t worry, this isn’t 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 doesn’t 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
|
block modal-footer-content
|
||||||
div
|
div
|
||||||
a(href='#', data-dismiss="modal", aria-hidden="true").btn Close
|
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
|
button.btn.btn-primary#level-submit Submit
|
||||||
|
|
|
@ -2,7 +2,6 @@ mixin task-row(cid)
|
||||||
- var task = view.getTaskByCID(cid)
|
- var task = view.getTaskByCID(cid)
|
||||||
- var taskName = task.get('name');
|
- var taskName = task.get('name');
|
||||||
- var isComplete = task.get('complete')
|
- var isComplete = task.get('complete')
|
||||||
- var taskLink = view.defaultTaskLinks[taskName]
|
|
||||||
tr.task-row(data-task-cid=cid)
|
tr.task-row(data-task-cid=cid)
|
||||||
td.task-check
|
td.task-check
|
||||||
div.checkbox
|
div.checkbox
|
||||||
|
@ -15,11 +14,10 @@ mixin task-row(cid)
|
||||||
td.edit-cell
|
td.edit-cell
|
||||||
span.glyphicon.glyphicon-edit.start-edit
|
span.glyphicon.glyphicon-edit.start-edit
|
||||||
td.task-name
|
td.task-name
|
||||||
if taskLink
|
- var result = view.getTaskURL(taskName)
|
||||||
if taskLink === './'
|
if result !== null
|
||||||
a.no-article(href='https://github.com/codecombat/codecombat/wiki/Artisan-Home', target='blank')= taskName
|
// https://github.com/codecombat/codecombat/wiki/Tasks-Tab#<slug goes here>
|
||||||
else
|
a(href='https://github.com/codecombat/codecombat/wiki/Tasks-Tab#' + result, target='blank')= taskName
|
||||||
a(href=taskLink, target='_blank')= taskName
|
|
||||||
else
|
else
|
||||||
span= taskName
|
span= taskName
|
||||||
|
|
||||||
|
|
|
@ -25,16 +25,21 @@ module.exports = class ArtisanGuideModal extends ModalView
|
||||||
|
|
||||||
initialize: (options) ->
|
initialize: (options) ->
|
||||||
@level = options.level
|
@level = options.level
|
||||||
@options = level: @level.get 'name'
|
@options =
|
||||||
@creator = @level.get 'creator'
|
level:@level.get('name')
|
||||||
@meID = me.id
|
levelSlug:@level.get('slug')
|
||||||
|
|
||||||
levelSubmit: ->
|
levelSubmit: ->
|
||||||
@playSound 'menu-button-click'
|
@playSound 'menu-button-click'
|
||||||
forms.clearFormAlerts @$el
|
forms.clearFormAlerts @$el
|
||||||
contactMessage = forms.formToObject @$el
|
results = forms.formToObject @$el
|
||||||
res = tv4.validateMultiple contactMessage, contactSchema
|
res = tv4.validateMultiple results, contactSchema
|
||||||
return forms.applyErrorsToForm @$el, res.errors unless res.valid
|
return forms.applyErrorsToForm @$el, res.errors unless res.valid
|
||||||
|
contactMessage = {message:"""User Name: #{results.creditName}
|
||||||
|
Level: <a href="http://codecombat.com/editor/level/#{@options.levelSlug}">#{@options.level}</a>
|
||||||
|
Purpose: #{results.levelPurpose}
|
||||||
|
Inspiration: #{results.levelInspiration}
|
||||||
|
Location: #{results.levelLocation}"""}
|
||||||
@populateBrowserData contactMessage
|
@populateBrowserData contactMessage
|
||||||
contactMessage = _.merge contactMessage, @options
|
contactMessage = _.merge contactMessage, @options
|
||||||
contactMessage.country = me.get('country')
|
contactMessage.country = me.get('country')
|
||||||
|
@ -46,3 +51,8 @@ module.exports = class ArtisanGuideModal extends ModalView
|
||||||
context.browser = "#{$.browser.platform} #{$.browser.name} #{$.browser.versionNumber}"
|
context.browser = "#{$.browser.platform} #{$.browser.name} #{$.browser.versionNumber}"
|
||||||
context.screenSize = "#{screen?.width ? $(window).width()} x #{screen?.height ? $(window).height()}"
|
context.screenSize = "#{screen?.width ? $(window).width()} x #{screen?.height ? $(window).height()}"
|
||||||
context.screenshotURL = @screenshotURL
|
context.screenshotURL = @screenshotURL
|
||||||
|
|
||||||
|
hasOwnership: ->
|
||||||
|
if @level.getOwner() is me.id
|
||||||
|
return true
|
||||||
|
return false
|
|
@ -18,44 +18,6 @@ module.exports = class TasksTabView extends CocoView
|
||||||
subscriptions:
|
subscriptions:
|
||||||
'editor:level-loaded': 'onLevelLoaded'
|
'editor:level-loaded': 'onLevelLoaded'
|
||||||
|
|
||||||
defaultTaskLinks:
|
|
||||||
# Order doesn't matter.
|
|
||||||
'Name the level.':'./'
|
|
||||||
'Create a Referee stub, if needed.':'./'
|
|
||||||
'Build the level.':'./'
|
|
||||||
'Set up goals.':'./'
|
|
||||||
'Choose the Existence System lifespan and frame rate.':'./'
|
|
||||||
'Choose the UI System paths and coordinate hover if needed.':'./'
|
|
||||||
'Choose the AI System pathfinding and Vision System line of sight.':'./'
|
|
||||||
'Write the sample code.':'./'
|
|
||||||
'Do basic set decoration.':'./'
|
|
||||||
'Adjust script camera bounds.':'./'
|
|
||||||
'Choose music file in Introduction script.':'./'
|
|
||||||
'Choose autoplay in Introduction script.':'./'
|
|
||||||
'Add to a campaign.':'./'
|
|
||||||
'Publish.':'./'
|
|
||||||
'Choose level options like required/restricted gear.':'./'
|
|
||||||
'Create achievements, including unlocking next level.':'./'
|
|
||||||
'Choose leaderboard score types.':'./'
|
|
||||||
'Playtest with a slow/tough hero.':'./'
|
|
||||||
'Playtest with a fast/weak hero.':'./'
|
|
||||||
'Playtest with a couple random seeds.':'./'
|
|
||||||
'Make sure the level ends promptly on success and failure.':'./'
|
|
||||||
'Remove/simplify unnecessary doodad collision.':'./'
|
|
||||||
'Release to adventurers via MailChimp.':'./'
|
|
||||||
'Write the description.':'./'
|
|
||||||
'Add i18n field for the sample code comments.':'./'
|
|
||||||
'Add Clojure/Lua/CoffeeScript.':'./'
|
|
||||||
'Write the guide.':'./'
|
|
||||||
'Write a loading tip, if needed.':'./'
|
|
||||||
'Click the Populate i18n button.':'./'
|
|
||||||
'Add programming concepts covered.':'./'
|
|
||||||
'Mark whether it requires a subscription.':'./'
|
|
||||||
'Release to everyone via MailChimp.':'./'
|
|
||||||
'Check completion/engagement/problem analytics.':'./'
|
|
||||||
'Do thorough set decoration.':'./'
|
|
||||||
'Add a walkthrough video.':'./'
|
|
||||||
|
|
||||||
missingDefaults: ->
|
missingDefaults: ->
|
||||||
missingTasks = []
|
missingTasks = []
|
||||||
if @level
|
if @level
|
||||||
|
@ -98,7 +60,7 @@ module.exports = class TasksTabView extends CocoView
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
focusEditInput: ->
|
focusEditInput: ->
|
||||||
editInput = @$el.find('#cur-edit')[0]
|
editInput = @$('#cur-edit')[0]
|
||||||
if editInput
|
if editInput
|
||||||
editInput.focus()
|
editInput.focus()
|
||||||
len = editInput.value.length * 2
|
len = editInput.value.length * 2
|
||||||
|
@ -115,6 +77,7 @@ module.exports = class TasksTabView extends CocoView
|
||||||
|
|
||||||
onLevelLoaded: (e) ->
|
onLevelLoaded: (e) ->
|
||||||
@level = e.level
|
@level = e.level
|
||||||
|
@defaultTasks = @level.schema().properties.tasks.default
|
||||||
Task = Backbone.Model.extend({
|
Task = Backbone.Model.extend({
|
||||||
initialize: ->
|
initialize: ->
|
||||||
# We want to keep track of the revertAttributes easily without digging back into the level every time.
|
# We want to keep track of the revertAttributes easily without digging back into the level every time.
|
||||||
|
@ -138,9 +101,9 @@ module.exports = class TasksTabView extends CocoView
|
||||||
@level.set 'tasks', @taskMap()
|
@level.set 'tasks', @taskMap()
|
||||||
|
|
||||||
onClickTaskRow: (e) ->
|
onClickTaskRow: (e) ->
|
||||||
if not @$el.find(e.target).is('input') and not @$el.find(e.target).is('a') and not @$el.find(e.target).hasClass('start-edit') and @$el.find('#cur-edit').length is 0
|
if not $(e.target).is('input') and not $(e.target).is('a') and not $(e.target).hasClass('start-edit') and @$('#cur-edit').length is 0
|
||||||
task = @tasks.get @$el.find(e.target).closest('tr').data('task-cid')
|
task = @tasks.get $(e.target).closest('tr').data('task-cid')
|
||||||
checkbox = @$el.find(e.currentTarget).find('.task-input')[0]
|
checkbox = $(e.currentTarget).find('.task-input')[0]
|
||||||
if task.get 'complete'
|
if task.get 'complete'
|
||||||
task.set 'complete', false
|
task.set 'complete', false
|
||||||
else
|
else
|
||||||
|
@ -149,29 +112,29 @@ module.exports = class TasksTabView extends CocoView
|
||||||
@pushTasks()
|
@pushTasks()
|
||||||
|
|
||||||
onClickTaskInput: (e) ->
|
onClickTaskInput: (e) ->
|
||||||
task = @tasks.get @$el.find(e.target).closest('tr').data('task-cid')
|
task = @tasks.get $(e.target).closest('tr').data('task-cid')
|
||||||
task.set 'complete', e.currentTarget.checked
|
task.set 'complete', e.currentTarget.checked
|
||||||
@pushTasks()
|
@pushTasks()
|
||||||
|
|
||||||
onClickStartEdit: (e) ->
|
onClickStartEdit: (e) ->
|
||||||
if @$el.find('#cur-edit').length is 0
|
if @$('#cur-edit').length is 0
|
||||||
task = @tasks.get @$el.find(e.target).closest('tr').data('task-cid')
|
task = @tasks.get $(e.target).closest('tr').data('task-cid')
|
||||||
task.set 'curEdit', true
|
task.set 'curEdit', true
|
||||||
@render()
|
@render()
|
||||||
@focusEditInput()
|
@focusEditInput()
|
||||||
|
|
||||||
onKeyDownCurEdit: (e) ->
|
onKeyDownCurEdit: (e) ->
|
||||||
if e.keyCode is 13
|
if e.keyCode is 13
|
||||||
editInput = @$el.find('#cur-edit')[0]
|
editInput = @$('#cur-edit')[0]
|
||||||
editInput.blur()
|
editInput.blur()
|
||||||
|
|
||||||
onBlurCurEdit: (e) ->
|
onBlurCurEdit: (e) ->
|
||||||
editInput = @$el.find('#cur-edit')[0]
|
editInput = @$('#cur-edit')[0]
|
||||||
task = @tasks.get @$el.find(e.target).closest('tr').data('task-cid')
|
task = @tasks.get $(e.target).closest('tr').data('task-cid')
|
||||||
@applyTaskName(task, editInput)
|
@applyTaskName(task, editInput)
|
||||||
|
|
||||||
onClickCreateTask: (e) ->
|
onClickCreateTask: (e) ->
|
||||||
if @$el.find('#cur-edit').length is 0
|
if @$('#cur-edit').length is 0
|
||||||
@tasks.add
|
@tasks.add
|
||||||
name: ''
|
name: ''
|
||||||
complete: false
|
complete: false
|
||||||
|
@ -181,3 +144,8 @@ module.exports = class TasksTabView extends CocoView
|
||||||
complete: false
|
complete: false
|
||||||
@render()
|
@render()
|
||||||
@focusEditInput()
|
@focusEditInput()
|
||||||
|
|
||||||
|
getTaskURL: (_n) ->
|
||||||
|
if _.find(@defaultTasks, {name:_n})?
|
||||||
|
return _.string.slugify(_n)
|
||||||
|
return null
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue