diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-12 15:55:54 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-13 17:24:21 +0200 |
commit | 31e28ebcebc054eaeef2eddba64ff2ff7ca3104f (patch) | |
tree | 4402445fc4977c59582470d2f2d2bdf14b553388 /app/assets | |
parent | ab4ea3720c084063ab83cef3aaf3a0b6adbc2a3c (diff) | |
download | gitlab-ce-31e28ebcebc054eaeef2eddba64ff2ff7ca3104f.tar.gz |
Load related MRs/branches asynchronously
Currently this works by loading the HAML partials via XHR. While this is
not the nicest setup it _is_ the easiest setup using the tools we
currently have.
Loading this data asynchronously doesn't make loading the related
MRs/branches itself faster, it merely ensures that loading the issue
itself is not slowed down.
Fixes gitlab-org/gitlab-ce#14949
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/issue.js.coffee | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/assets/javascripts/issue.js.coffee b/app/assets/javascripts/issue.js.coffee index 946d83b7bdd..c7d74a12f99 100644 --- a/app/assets/javascripts/issue.js.coffee +++ b/app/assets/javascripts/issue.js.coffee @@ -10,6 +10,9 @@ class @Issue @initTaskList() @initIssueBtnEventListeners() + @initMergeRequests() + @initRelatedBranches() + initTaskList: -> $('.detail-page-description .js-task-list-container').taskList('enable') $(document).on 'tasklist:changed', '.detail-page-description .js-task-list-container', @updateTaskList @@ -69,3 +72,23 @@ class @Issue type: 'PATCH' url: $('form.js-issuable-update').attr('action') data: patchData + + initMergeRequests: -> + $container = $('#merge-requests') + + $.getJSON($container.data('url')) + .error -> + new Flash('Failed to load referenced merge requests', 'alert') + .success (data) -> + if 'html' of data + $container.html(data.html) + + initRelatedBranches: -> + $container = $('#related-branches') + + $.getJSON($container.data('url')) + .error -> + new Flash('Failed to load related branches', 'alert') + .success (data) -> + if 'html' of data + $container.html(data.html) |