summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-04-28 12:54:13 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2017-05-03 13:42:55 -0500
commiteb3b69e2136a848202ce4d0e3d4263c473b33e50 (patch)
tree8c64acce71aa151de581dcfbe58eaca017308d66
parentc50da6ff552ff7917d53269847cc8fef79e352db (diff)
downloadgitlab-ce-eb3b69e2136a848202ce4d0e3d4263c473b33e50.tar.gz
Cache create Branch path
-rw-r--r--app/assets/javascripts/create_merge_request_dropdown.js3
-rw-r--r--app/views/projects/issues/_new_branch.html.haml2
2 files changed, 3 insertions, 2 deletions
diff --git a/app/assets/javascripts/create_merge_request_dropdown.js b/app/assets/javascripts/create_merge_request_dropdown.js
index 77f9f832d14..c51bf24cd45 100644
--- a/app/assets/javascripts/create_merge_request_dropdown.js
+++ b/app/assets/javascripts/create_merge_request_dropdown.js
@@ -18,6 +18,7 @@ export default class CreateMergeRequestDropdown {
this.availableButton = this.wrapperEl.querySelector('.available');
this.unavailableButton = this.wrapperEl.querySelector('.unavailable');
+ this.createBranchPath = this.wrapperEl.dataset.createBranchPath;
this.canCreatePath = this.wrapperEl.dataset.canCreatePath;
this.createMrPath = this.wrapperEl.dataset.createMrPath;
this.droplabInitialized = false;
@@ -153,7 +154,7 @@ export default class CreateMergeRequestDropdown {
return $.ajax({
method: 'POST',
dataType: 'json',
- url: this.wrapperEl.dataset.createBranch,
+ url: this.createBranchPath,
beforeSend: () => (this.isCreatingBranch = true),
})
.done((data) => {
diff --git a/app/views/projects/issues/_new_branch.html.haml b/app/views/projects/issues/_new_branch.html.haml
index 0bd930094ef..0a23365271b 100644
--- a/app/views/projects/issues/_new_branch.html.haml
+++ b/app/views/projects/issues/_new_branch.html.haml
@@ -1,6 +1,6 @@
- if can?(current_user, :push_code, @project)
.pull-right
- .create-mr-dropdown-wrap{ data: { can_create_path: can_create_branch_namespace_project_issue_path(@project.namespace, @project, @issue), create_mr_path: create_merge_request_namespace_project_issue_path(@project.namespace, @project, @issue), create_branch: namespace_project_branches_path(@project.namespace, @project, branch_name: @issue.to_branch_name, issue_iid: @issue.iid) } }
+ .create-mr-dropdown-wrap{ data: { can_create_path: can_create_branch_namespace_project_issue_path(@project.namespace, @project, @issue), create_mr_path: create_merge_request_namespace_project_issue_path(@project.namespace, @project, @issue), create_branch_path: namespace_project_branches_path(@project.namespace, @project, branch_name: @issue.to_branch_name, issue_iid: @issue.iid) } }
.btn-group.unavailable
%button.btn.btn-grouped{ type: 'button', disabled: 'disabled' }
= icon('exclamation-triangle')