get branch name from the DOM

This commit is contained in:
Phil Hughes 2017-10-31 10:18:56 +00:00
parent ac8e94d4d5
commit 307883a5eb
No known key found for this signature in database
GPG key ID: 32245528C52E0F9F
2 changed files with 4 additions and 2 deletions

View file

@ -9,6 +9,8 @@ import store from './stores';
import Translate from '../vue_shared/translate'; import Translate from '../vue_shared/translate';
function initRepo(el) { function initRepo(el) {
if (!el) return null;
return new Vue({ return new Vue({
el, el,
store, store,
@ -38,8 +40,7 @@ function initRepo(el) {
onTopOfBranch: convertPermissionToBoolean(data.onTopOfBranch), onTopOfBranch: convertPermissionToBoolean(data.onTopOfBranch),
currentRef: data.ref, currentRef: data.ref,
path: data.currentPath, path: data.currentPath,
// TODO: get through data attribute currentBranch: data.currentBranch,
currentBranch: document.querySelector('.js-project-refs-dropdown').dataset.ref,
isRoot: convertPermissionToBoolean(data.root), isRoot: convertPermissionToBoolean(data.root),
isInitialRoot: convertPermissionToBoolean(data.root), isInitialRoot: convertPermissionToBoolean(data.root),
}); });

View file

@ -1,6 +1,7 @@
#repo{ data: { root: @path.empty?.to_s, #repo{ data: { root: @path.empty?.to_s,
root_url: project_tree_path(project), root_url: project_tree_path(project),
url: content_url, url: content_url,
current_branch: @ref,
ref: @commit.id, ref: @commit.id,
project_name: project.name, project_name: project.name,
project_url: project_path(project), project_url: project_path(project),