diff options
Diffstat (limited to 'app/assets/javascripts/merge_request.js')
-rw-r--r-- | app/assets/javascripts/merge_request.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 56ebf84c4f6..05644b3d03c 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -1,10 +1,6 @@ /*= require jquery.waitforimages */ - - /*= require task_list */ - - /*= require merge_request_tabs */ (function() { @@ -12,6 +8,11 @@ this.MergeRequest = (function() { function MergeRequest(opts) { + // Initialize MergeRequest behavior + // + // Options: + // action - String, current controller action + // this.opts = opts != null ? opts : {}; this.submitNoteForm = bind(this.submitNoteForm, this); this.$el = $('.merge-request'); @@ -21,6 +22,7 @@ }; })(this)); this.initTabs(); + // Prevent duplicate event bindings this.disableTaskList(); this.initMRBtnListeners(); if ($("a.btn-close").length) { @@ -28,14 +30,17 @@ } } + // Local jQuery finder MergeRequest.prototype.$ = function(selector) { return this.$el.find(selector); }; MergeRequest.prototype.initTabs = function() { if (this.opts.action !== 'new') { + // `MergeRequests#new` has no tab-persisting or lazy-loading behavior window.mrTabs = new MergeRequestTabs(this.opts); } else { + // Show the first tab (Commits) return $('.merge-request-tabs a[data-toggle="tab"]:first').tab('show'); } }; @@ -96,6 +101,8 @@ url: $('form.js-issuable-update').attr('action'), data: patchData }); + // TODO (rspeicher): Make the merge request description inline-editable like a + // note so that we can re-use its form here }; return MergeRequest; |