debian-mirror-gitlab/app/assets/javascripts/new_commit_form.js.coffee
2015-12-23 02:04:40 +05:30

21 lines
702 B
CoffeeScript

class @NewCommitForm
constructor: (form) ->
@newBranch = form.find('.js-new-branch')
@originalBranch = form.find('.js-original-branch')
@createMergeRequest = form.find('.js-create-merge-request')
@createMergeRequestContainer = form.find('.js-create-merge-request-container')
@renderDestination()
@newBranch.keyup @renderDestination
renderDestination: =>
different = @newBranch.val() != @originalBranch.val()
if different
@createMergeRequestContainer.show()
@createMergeRequest.prop('checked', true) unless @wasDifferent
else
@createMergeRequestContainer.hide()
@createMergeRequest.prop('checked', false)
@wasDifferent = different