BigW Consortium Gitlab

Commit fa8b228f by Jacob Schatz

restores merge request coffee file

parent 906de20f
......@@ -22,7 +22,6 @@ class @MergeRequest
if $("a.btn-close").length
@initTaskList()
@initMergeRequestBtnEventListeners()
# Local jQuery finder
$: (selector) ->
......@@ -36,54 +35,6 @@ class @MergeRequest
# Show the first tab (Commits)
$('.merge-request-tabs a[data-toggle="tab"]:first').tab('show')
initMergeRequestBtnEventListeners: ->
_this = @
mergeRequestFailMessage = 'Unable to update this merge request at this time.'
$('a.btn-close, a.btn-reopen').on 'click', (e) ->
e.preventDefault()
e.stopImmediatePropagation()
$this = $(this)
isClose = $this.hasClass('btn-close')
shouldSubmit = $this.hasClass('btn-comment')
if shouldSubmit
_this.submitNoteForm($this.closest('form'))
$this.prop('disabled', true)
url = $this.attr('href')
$.ajax
type: 'PUT',
url: url,
error: (jqXHR, textStatus, errorThrown) ->
mergeRequestStatus = if isClose then 'close' else 'open'
new Flash(mergeRequestFailMessage, 'alert')
success: (data, textStatus, jqXHR) ->
if data.saved
if isClose
$('a.btn-close').addClass('hidden')
$('a.issuable-edit').addClass('hidden')
$('a.btn-reopen').removeClass('hidden')
$('div.status-box-closed').removeClass('hidden')
$('div.status-box-open').addClass('hidden')
$('div.mr-state-widget-closed').removeClass('hidden')
$('div.mr-state-widget-opened').addClass('hidden')
else
$('a.btn-reopen').addClass('hidden')
$('a.issuable-edit').removeClass('hidden')
$('a.btn-close').removeClass('hidden')
$('div.status-box-closed').addClass('hidden')
$('div.status-box-open').removeClass('hidden')
$('div.mr-state-widget-closed').addClass('hidden')
$('div.mr-state-widget-opened').removeClass('hidden')
else
new Flash(mergeRequestFailMessage, 'alert')
$this.prop('disabled', false)
submitNoteForm: (form) =>
noteText = form.find("textarea.js-note-text").val()
if noteText.trim().length > 0
form.submit()
showAllCommits: ->
this.$('.first-commits').remove()
this.$('.all-commits').removeClass 'hide'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment