mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-18 03:23:42 -05:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
31e3e7f98e
6 changed files with 14 additions and 72 deletions
|
@ -85,7 +85,7 @@ block header
|
||||||
span.spl(data-i18n="common.unwatch") Unwatch
|
span.spl(data-i18n="common.unwatch") Unwatch
|
||||||
|
|
||||||
li(class=anonymous ? "disabled": "")
|
li(class=anonymous ? "disabled": "")
|
||||||
a(data-i18n="common.fork")#fork-level-start-button Fork
|
a(data-i18n="common.fork")#fork-start-button Fork
|
||||||
li(class=anonymous ? "disabled": "")
|
li(class=anonymous ? "disabled": "")
|
||||||
a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert")#revert-button Revert
|
a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert")#revert-button Revert
|
||||||
li(class=anonymous ? "disabled": "")
|
li(class=anonymous ? "disabled": "")
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
extends /templates/modal/modal_base
|
|
||||||
|
|
||||||
block modal-header-content
|
|
||||||
h3(data-i18n="editor.fork_title") Fork New Version
|
|
||||||
|
|
||||||
block modal-body-content
|
|
||||||
form#save-level-form.form
|
|
||||||
.form-group
|
|
||||||
label(for="level-name", data-i18n="general.name") Name
|
|
||||||
input#level-name(name="name", type="text").form-control
|
|
||||||
|
|
||||||
block modal-footer-content
|
|
||||||
button.btn(data-dismiss="modal", data-i18n="common.cancel") Cancel
|
|
||||||
button.btn.btn-primary#fork-level-confirm-button(data-i18n="common.save") Save
|
|
||||||
|
|
||||||
block modal-body-wait-content
|
|
||||||
h3(data-i18n="editor.fork_creating") Creating Fork...
|
|
|
@ -52,6 +52,8 @@ block header
|
||||||
span.glyphicon-chevron-down.glyphicon
|
span.glyphicon-chevron-down.glyphicon
|
||||||
ul.dropdown-menu
|
ul.dropdown-menu
|
||||||
li.dropdown-header Actions
|
li.dropdown-header Actions
|
||||||
|
li(class=anonymous ? "disabled": "")
|
||||||
|
a(data-i18n="common.fork")#fork-start-button Fork
|
||||||
li(class=anonymous ? "disabled": "")
|
li(class=anonymous ? "disabled": "")
|
||||||
a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert")#revert-button Revert
|
a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert")#revert-button Revert
|
||||||
li.divider
|
li.divider
|
||||||
|
|
|
@ -12,7 +12,7 @@ ScriptsTabView = require './scripts/ScriptsTabView'
|
||||||
ComponentsTabView = require './components/ComponentsTabView'
|
ComponentsTabView = require './components/ComponentsTabView'
|
||||||
SystemsTabView = require './systems/SystemsTabView'
|
SystemsTabView = require './systems/SystemsTabView'
|
||||||
SaveLevelModal = require './modals/SaveLevelModal'
|
SaveLevelModal = require './modals/SaveLevelModal'
|
||||||
LevelForkView = require './modals/ForkLevelModal'
|
ForkModal = require 'views/editor/ForkModal'
|
||||||
SaveVersionModal = require 'views/modal/SaveVersionModal'
|
SaveVersionModal = require 'views/modal/SaveVersionModal'
|
||||||
PatchesView = require 'views/editor/PatchesView'
|
PatchesView = require 'views/editor/PatchesView'
|
||||||
RelatedAchievementsView = require 'views/editor/level/RelatedAchievementsView'
|
RelatedAchievementsView = require 'views/editor/level/RelatedAchievementsView'
|
||||||
|
@ -30,7 +30,7 @@ module.exports = class LevelEditView extends RootView
|
||||||
'click .play-with-team-button': 'onPlayLevel'
|
'click .play-with-team-button': 'onPlayLevel'
|
||||||
'click .play-with-team-parent': 'onPlayLevelTeamSelect'
|
'click .play-with-team-parent': 'onPlayLevelTeamSelect'
|
||||||
'click #commit-level-start-button': 'startCommittingLevel'
|
'click #commit-level-start-button': 'startCommittingLevel'
|
||||||
'click #fork-level-start-button': 'startForkingLevel'
|
'click #fork-start-button': 'startForking'
|
||||||
'click #level-history-button': 'showVersionHistory'
|
'click #level-history-button': 'showVersionHistory'
|
||||||
'click #undo-button': 'onUndo'
|
'click #undo-button': 'onUndo'
|
||||||
'click #redo-button': 'onRedo'
|
'click #redo-button': 'onRedo'
|
||||||
|
@ -130,9 +130,8 @@ module.exports = class LevelEditView extends RootView
|
||||||
@openModalView new SaveLevelModal level: @level, supermodel: @supermodel
|
@openModalView new SaveLevelModal level: @level, supermodel: @supermodel
|
||||||
Backbone.Mediator.publish 'level:view-switched', e
|
Backbone.Mediator.publish 'level:view-switched', e
|
||||||
|
|
||||||
startForkingLevel: (e) ->
|
startForking: (e) ->
|
||||||
levelForkView = new LevelForkView level: @level
|
@openModalView new ForkModal model: @level, editorPath: 'level'
|
||||||
@openModalView levelForkView
|
|
||||||
Backbone.Mediator.publish 'level:view-switched', e
|
Backbone.Mediator.publish 'level:view-switched', e
|
||||||
|
|
||||||
showVersionHistory: (e) ->
|
showVersionHistory: (e) ->
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
ModalView = require 'views/kinds/ModalView'
|
|
||||||
template = require 'templates/editor/level/fork'
|
|
||||||
forms = require 'lib/forms'
|
|
||||||
Level = require 'models/Level'
|
|
||||||
|
|
||||||
module.exports = class ForkLevelModal extends ModalView
|
|
||||||
id: 'editor-level-fork-modal'
|
|
||||||
template: template
|
|
||||||
instant: false
|
|
||||||
modalWidthPercent: 60
|
|
||||||
|
|
||||||
events:
|
|
||||||
'click #fork-level-confirm-button': 'forkLevel'
|
|
||||||
'submit form': 'forkLevel'
|
|
||||||
|
|
||||||
constructor: (options) ->
|
|
||||||
super options
|
|
||||||
@level = options.level
|
|
||||||
|
|
||||||
getRenderData: (context={}) ->
|
|
||||||
context = super(context)
|
|
||||||
context.level = @level
|
|
||||||
context
|
|
||||||
|
|
||||||
forkLevel: ->
|
|
||||||
@showLoading()
|
|
||||||
forms.clearFormAlerts(@$el)
|
|
||||||
newLevel = new Level($.extend(true, {}, @level.attributes))
|
|
||||||
newLevel.unset '_id'
|
|
||||||
newLevel.unset 'version'
|
|
||||||
newLevel.unset 'creator'
|
|
||||||
newLevel.unset 'created'
|
|
||||||
newLevel.unset 'original'
|
|
||||||
newLevel.unset 'parent'
|
|
||||||
newLevel.set 'commitMessage', "Forked from #{@level.get('name')}"
|
|
||||||
newLevel.set 'name', @$el.find('#level-name').val()
|
|
||||||
newLevel.set 'permissions', [access: 'owner', target: me.id]
|
|
||||||
res = newLevel.save()
|
|
||||||
return unless res
|
|
||||||
res.error =>
|
|
||||||
@hideLoading()
|
|
||||||
forms.applyErrorsToForm(@$el.find('form'), JSON.parse(res.responseText))
|
|
||||||
res.success =>
|
|
||||||
@hide()
|
|
||||||
application.router.navigate('editor/level/' + newLevel.get('slug'), {trigger: true})
|
|
|
@ -10,6 +10,7 @@ ThangComponentsEditView = require 'views/editor/component/ThangComponentsEditVie
|
||||||
ThangTypeVersionsModal = require './ThangTypeVersionsModal'
|
ThangTypeVersionsModal = require './ThangTypeVersionsModal'
|
||||||
ThangTypeColorsTabView = require './ThangTypeColorsTabView'
|
ThangTypeColorsTabView = require './ThangTypeColorsTabView'
|
||||||
PatchesView = require 'views/editor/PatchesView'
|
PatchesView = require 'views/editor/PatchesView'
|
||||||
|
ForkModal = require 'views/editor/ForkModal'
|
||||||
SaveVersionModal = require 'views/modal/SaveVersionModal'
|
SaveVersionModal = require 'views/modal/SaveVersionModal'
|
||||||
template = require 'templates/editor/thang/thang-type-edit-view'
|
template = require 'templates/editor/thang/thang-type-edit-view'
|
||||||
storage = require 'lib/storage'
|
storage = require 'lib/storage'
|
||||||
|
@ -36,6 +37,7 @@ module.exports = class ThangTypeEditView extends RootView
|
||||||
'click #marker-button': 'toggleDots'
|
'click #marker-button': 'toggleDots'
|
||||||
'click #end-button': 'endAnimation'
|
'click #end-button': 'endAnimation'
|
||||||
'click #history-button': 'showVersionHistory'
|
'click #history-button': 'showVersionHistory'
|
||||||
|
'click #fork-start-button': 'startForking'
|
||||||
'click #save-button': 'openSaveModal'
|
'click #save-button': 'openSaveModal'
|
||||||
'click #patches-tab': -> @patchesView.load()
|
'click #patches-tab': -> @patchesView.load()
|
||||||
'click .play-with-level-button': 'onPlayLevel'
|
'click .play-with-level-button': 'onPlayLevel'
|
||||||
|
@ -406,12 +408,13 @@ module.exports = class ThangTypeEditView extends RootView
|
||||||
@showingSelectedNode = false
|
@showingSelectedNode = false
|
||||||
|
|
||||||
showVersionHistory: (e) ->
|
showVersionHistory: (e) ->
|
||||||
versionHistoryModal = new ThangTypeVersionsModal thangType: @thangType, @thangTypeID
|
@openModalView new ThangTypeVersionsModal thangType: @thangType, @thangTypeID
|
||||||
@openModalView versionHistoryModal
|
|
||||||
Backbone.Mediator.publish 'level:view-switched', e
|
|
||||||
|
|
||||||
openSaveModal: ->
|
openSaveModal: ->
|
||||||
@openModalView(new SaveVersionModal({model: @thangType}))
|
@openModalView new SaveVersionModal model: @thangType
|
||||||
|
|
||||||
|
startForking: (e) ->
|
||||||
|
@openModalView new ForkModal model: @thangType, editorPath: 'thang'
|
||||||
|
|
||||||
onPlayLevelSelect: (e) ->
|
onPlayLevelSelect: (e) ->
|
||||||
if @childWindow and not @childWindow.closed
|
if @childWindow and not @childWindow.closed
|
||||||
|
|
Loading…
Reference in a new issue