debian-mirror-gitlab/app/assets/javascripts/new_commit_form.js.coffee

22 lines
702 B
CoffeeScript
Raw Normal View History

2015-11-26 14:37:03 +05:30
class @NewCommitForm
constructor: (form) ->
@newBranch = form.find('.js-new-branch')
@originalBranch = form.find('.js-original-branch')
@createMergeRequest = form.find('.js-create-merge-request')
2015-12-23 02:04:40 +05:30
@createMergeRequestContainer = form.find('.js-create-merge-request-container')
2015-11-26 14:37:03 +05:30
@renderDestination()
@newBranch.keyup @renderDestination
renderDestination: =>
different = @newBranch.val() != @originalBranch.val()
if different
2015-12-23 02:04:40 +05:30
@createMergeRequestContainer.show()
2015-11-26 14:37:03 +05:30
@createMergeRequest.prop('checked', true) unless @wasDifferent
else
2015-12-23 02:04:40 +05:30
@createMergeRequestContainer.hide()
2015-11-26 14:37:03 +05:30
@createMergeRequest.prop('checked', false)
@wasDifferent = different