Fixed a few forms around the site to properly handle pressing enter.
This commit is contained in:
parent
7b3fe0a3fb
commit
9a116d81be
3 changed files with 11 additions and 5 deletions
app/views
|
@ -18,7 +18,8 @@ module.exports = class ForkModal extends ModalView
|
||||||
@model = options.model
|
@model = options.model
|
||||||
@modelClass = @model.constructor
|
@modelClass = @model.constructor
|
||||||
|
|
||||||
forkModel: ->
|
forkModel: (e) ->
|
||||||
|
e.preventDefault()
|
||||||
@showLoading()
|
@showLoading()
|
||||||
forms.clearFormAlerts(@$el)
|
forms.clearFormAlerts(@$el)
|
||||||
newModel = new @modelClass($.extend(true, {}, @model.attributes))
|
newModel = new @modelClass($.extend(true, {}, @model.attributes))
|
||||||
|
|
|
@ -56,7 +56,8 @@ module.exports = class SaveLevelModal extends SaveVersionModal
|
||||||
# Sometimes we have two versions: one in a search collection and one with a URL. We only save changes to the latter.
|
# Sometimes we have two versions: one in a search collection and one with a URL. We only save changes to the latter.
|
||||||
false
|
false
|
||||||
|
|
||||||
commitLevel: ->
|
commitLevel: (e) ->
|
||||||
|
e.preventDefault()
|
||||||
modelsToSave = []
|
modelsToSave = []
|
||||||
formsToSave = []
|
formsToSave = []
|
||||||
for form in @$el.find('form')
|
for form in @$el.find('form')
|
||||||
|
|
|
@ -11,11 +11,11 @@ module.exports = class SaveVersionModal extends ModalView
|
||||||
modalWidthPercent: 60
|
modalWidthPercent: 60
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click #save-version-button': 'onClickSaveButton'
|
'click #save-version-button': 'saveChanges'
|
||||||
'click #cla-link': 'onClickCLALink'
|
'click #cla-link': 'onClickCLALink'
|
||||||
'click #agreement-button': 'onAgreedToCLA'
|
'click #agreement-button': 'onAgreedToCLA'
|
||||||
'click #submit-patch-button': 'submitPatch'
|
'click #submit-patch-button': 'submitPatch'
|
||||||
'submit form': 'submitPatch'
|
'submit form': 'onSubmitForm'
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super options
|
super options
|
||||||
|
@ -40,7 +40,11 @@ module.exports = class SaveVersionModal extends ModalView
|
||||||
console.error 'Couldn\'t create delta view:', e
|
console.error 'Couldn\'t create delta view:', e
|
||||||
@$el.find('.commit-message input').attr('placeholder', $.i18n.t('general.commit_msg'))
|
@$el.find('.commit-message input').attr('placeholder', $.i18n.t('general.commit_msg'))
|
||||||
|
|
||||||
onClickSaveButton: ->
|
onSubmitForm: (e) ->
|
||||||
|
e.preventDefault()
|
||||||
|
if @isPatch then @submitPatch() else @saveChanges()
|
||||||
|
|
||||||
|
saveChanges: ->
|
||||||
Backbone.Mediator.publish 'save-new-version', {
|
Backbone.Mediator.publish 'save-new-version', {
|
||||||
major: @$el.find('#major-version').prop('checked')
|
major: @$el.find('#major-version').prop('checked')
|
||||||
commitMessage: @$el.find('#commit-message').val()
|
commitMessage: @$el.find('#commit-message').val()
|
||||||
|
|
Reference in a new issue