mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Added delta views to the other save modals. Fixed modified deltas in delta views. A few style tweaks.
This commit is contained in:
parent
5629284c76
commit
3c832d3707
13 changed files with 54 additions and 18 deletions
|
@ -54,7 +54,7 @@ module.exports.interpretDelta = (delta, path, left, schema) ->
|
|||
betterDelta.path = betterPath.join(' :: ')
|
||||
betterDelta.schema = childSchema
|
||||
betterDelta.left = childLeft
|
||||
betterDelta.right = jsondiffpatch.patch childLeft, delta
|
||||
betterDelta.right = jsondiffpatch.patch childLeft, delta unless betterDelta.action is 'moved-index'
|
||||
|
||||
betterDelta
|
||||
|
||||
|
|
|
@ -112,6 +112,9 @@ a[data-toggle="modal"]
|
|||
//position: absolute
|
||||
width: 99%
|
||||
|
||||
.background-wrapper.plain
|
||||
background: white
|
||||
|
||||
.modal-content
|
||||
@include box-shadow(none)
|
||||
|
||||
|
|
|
@ -34,3 +34,10 @@
|
|||
color: red
|
||||
.panel-heading
|
||||
background-color: lighten(red, 42%)
|
||||
|
||||
.delta-moved-index
|
||||
border-color: darkslategray
|
||||
strong
|
||||
color: darkslategray
|
||||
.panel-heading
|
||||
background-color: lighten(darkslategray, 60%)
|
|
@ -1,6 +1,6 @@
|
|||
#save-version-modal
|
||||
.modal-body
|
||||
padding: 0px 50px 30px 20px
|
||||
padding: 10px 50px 30px 20px
|
||||
|
||||
#cla-link
|
||||
cursor: pointer
|
||||
|
|
|
@ -13,7 +13,7 @@ block content
|
|||
button(data-i18n="general.history").btn.btn-primary#history-button History
|
||||
button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="editor.revert", disabled=authorized === true ? undefined : "true").btn.btn-primary#revert-button Revert
|
||||
button(data-i18n="article.edit_btn_preview", disabled=authorized === true ? undefined : "true").btn.btn-primary#preview-button Preview
|
||||
button(data-toggle="coco-modal", data-target="modal/save_version", data-i18n="common.save", disabled=authorized === true ? undefined : "true").btn.btn-primary#save-button Save
|
||||
button(data-i18n="common.save", disabled=authorized === true ? undefined : "true").btn.btn-primary#save-button Save
|
||||
|
||||
h3(data-i18n="article.edit_article_title") Edit Article
|
||||
span
|
||||
|
|
|
@ -30,4 +30,7 @@
|
|||
if delta.action === 'text-diff'
|
||||
.col-md-12
|
||||
div.text-diff
|
||||
if delta.action === 'moved-index'
|
||||
.col-md-12
|
||||
span Moved array value #{JSON.stringify(delta.left)} to index #{delta.destinationIndex}
|
||||
- i += 1
|
|
@ -13,7 +13,7 @@ block content
|
|||
img#portrait.img-thumbnail
|
||||
|
||||
button.btn.btn-secondary#history-button(data-i18n="general.history") History
|
||||
button.btn.btn-primary#save-button(data-toggle="coco-modal", data-target="modal/save_version", data-i18n="common.save", disabled=authorized === true ? undefined : "true") Save
|
||||
button.btn.btn-primary#save-button(data-i18n="common.save", disabled=authorized === true ? undefined : "true") Save
|
||||
button.btn.btn-primary#revert-button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="editor.revert", disabled=authorized === true ? undefined : "true") Revert
|
||||
|
||||
h3 Edit Thang Type: "#{thangType.attributes.name}"
|
||||
|
|
|
@ -4,14 +4,14 @@ block modal-header-content
|
|||
h3(data-i18n="versions.save_version_title") Save New Version
|
||||
|
||||
block modal-body-content
|
||||
form.form
|
||||
.form-group
|
||||
label.control-label(for="commitMessage", data-i18n="general.commit_msg") Commit Message
|
||||
textarea#commit-message.input-large.form-control(name="commitMessage", type="text")
|
||||
.form-group
|
||||
label.control-label(for="level-version-is-major", data-i18n="versions.new_major_version") New Major Version
|
||||
input#major-version.input-large.form-control(name="version-is-major", type="checkbox")
|
||||
span.help-block
|
||||
.changes-stub
|
||||
form.form-inline
|
||||
.form-group.commit-message
|
||||
input.form-control#commit-message(name="commitMessage", type="text", placeholder="Commit Message")
|
||||
.checkbox
|
||||
label
|
||||
input#major-version(name="version-is-major", type="checkbox")
|
||||
| Major Changes
|
||||
|
||||
block modal-body-wait-content
|
||||
h3(data-i18n="common.saving") Saving...
|
||||
|
|
|
@ -3,6 +3,7 @@ VersionHistoryView = require './versions_view'
|
|||
ErrorView = require '../../error_view'
|
||||
template = require 'templates/editor/article/edit'
|
||||
Article = require 'models/Article'
|
||||
SaveVersionModal = require 'views/modal/save_version_modal'
|
||||
|
||||
module.exports = class ArticleEditView extends View
|
||||
id: "editor-article-edit-view"
|
||||
|
@ -12,6 +13,7 @@ module.exports = class ArticleEditView extends View
|
|||
events:
|
||||
'click #preview-button': 'openPreview'
|
||||
'click #history-button': 'showVersionHistory'
|
||||
'click #save-button': 'openSaveModal'
|
||||
|
||||
subscriptions:
|
||||
'save-new-version': 'saveNewArticle'
|
||||
|
@ -80,12 +82,15 @@ module.exports = class ArticleEditView extends View
|
|||
return if @startsLoading
|
||||
@showReadOnly() unless me.isAdmin() or @article.hasWriteAccess(me)
|
||||
|
||||
openPreview: =>
|
||||
openPreview: ->
|
||||
@preview = window.open('/editor/article/x/preview', 'preview', 'height=800,width=600')
|
||||
@preview.focus() if window.focus
|
||||
@preview.onload = => @pushChangesToPreview()
|
||||
return false
|
||||
|
||||
openSaveModal: ->
|
||||
@openModalView(new SaveVersionModal({model: @article}))
|
||||
|
||||
saveNewArticle: (e) ->
|
||||
@treema.endExistingEdits()
|
||||
for key, value of @treema.data
|
||||
|
|
|
@ -9,6 +9,7 @@ module.exports = class LevelSaveView extends SaveVersionModal
|
|||
template: template
|
||||
instant: false
|
||||
modalWidthPercent: 60
|
||||
plain: true
|
||||
|
||||
events:
|
||||
'click #save-version-button': 'commitLevel'
|
||||
|
|
|
@ -9,6 +9,7 @@ View = require 'views/kinds/RootView'
|
|||
ThangComponentEditView = require 'views/editor/components/main'
|
||||
VersionHistoryView = require './versions_view'
|
||||
ColorsTabView = require './colors_tab_view'
|
||||
SaveVersionModal = require 'views/modal/save_version_modal'
|
||||
ErrorView = require '../../error_view'
|
||||
template = require 'templates/editor/thang/edit'
|
||||
|
||||
|
@ -33,6 +34,7 @@ module.exports = class ThangTypeEditView extends View
|
|||
'click #marker-button': 'toggleDots'
|
||||
'click #end-button': 'endAnimation'
|
||||
'click #history-button': 'showVersionHistory'
|
||||
'click #save-button': 'openSaveModal'
|
||||
|
||||
subscriptions:
|
||||
'save-new-version': 'saveNewThangType'
|
||||
|
@ -396,11 +398,14 @@ module.exports = class ThangTypeEditView extends View
|
|||
@showAnimation()
|
||||
@showingSelectedNode = false
|
||||
|
||||
destroy: ->
|
||||
@camera?.destroy()
|
||||
super()
|
||||
|
||||
showVersionHistory: (e) ->
|
||||
versionHistoryView = new VersionHistoryView thangType:@thangType, @thangTypeID
|
||||
@openModalView versionHistoryView
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
||||
|
||||
openSaveModal: ->
|
||||
@openModalView(new SaveVersionModal({model: @thangType}))
|
||||
|
||||
destroy: ->
|
||||
@camera?.destroy()
|
||||
super()
|
||||
|
|
|
@ -5,6 +5,7 @@ module.exports = class ModalView extends CocoView
|
|||
closeButton: true
|
||||
closesOnClickOutside: true
|
||||
modalWidthPercent: null
|
||||
plain: false
|
||||
|
||||
shortcuts:
|
||||
'esc': 'hide'
|
||||
|
@ -31,6 +32,7 @@ module.exports = class ModalView extends CocoView
|
|||
@$el.on 'hide.bs.modal', =>
|
||||
@onHidden() unless @hidden
|
||||
@hidden = true
|
||||
@$el.find('.background-wrapper').addClass('plain') if @plain
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
ModalView = require 'views/kinds/ModalView'
|
||||
template = require 'templates/modal/save_version'
|
||||
DeltaView = require 'views/editor/delta'
|
||||
|
||||
module.exports = class SaveVersionModal extends ModalView
|
||||
id: 'save-version-modal'
|
||||
template: template
|
||||
plain: true
|
||||
|
||||
events:
|
||||
'click #save-version-button': 'onClickSaveButton'
|
||||
'click #cla-link': 'onClickCLALink'
|
||||
'click #agreement-button': 'onAgreedToCLA'
|
||||
|
||||
constructor: (options) ->
|
||||
super options
|
||||
@model = options.model
|
||||
|
||||
afterRender: ->
|
||||
super()
|
||||
@$el.find(if me.get('signedCLA') then '#accept-cla-wrapper' else '#save-version-button').hide()
|
||||
return unless @model
|
||||
changeEl = @$el.find('.changes-stub')
|
||||
deltaView = new DeltaView({model:@model})
|
||||
@insertSubView(deltaView, changeEl)
|
||||
|
||||
onClickSaveButton: ->
|
||||
Backbone.Mediator.publish 'save-new-version', {
|
||||
|
|
Loading…
Reference in a new issue