From eb3b69e2136a848202ce4d0e3d4263c473b33e50 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 28 Apr 2017 12:54:13 -0500 Subject: Cache create Branch path --- app/assets/javascripts/create_merge_request_dropdown.js | 3 ++- app/views/projects/issues/_new_branch.html.haml | 2 +- 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') -- cgit v1.2.1