debian-mirror-gitlab/app/assets/javascripts/new_commit_form.js.coffee
2016-01-14 18:37:52 +05:30

21 lines
705 B
CoffeeScript

class @NewCommitForm
constructor: (form) ->
@newBranch = form.find('.js-target-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