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';
function initRepo(el) {
if (!el) return null;
return new Vue({
el,
store,
@ -38,8 +40,7 @@ function initRepo(el) {
onTopOfBranch: convertPermissionToBoolean(data.onTopOfBranch),
currentRef: data.ref,
path: data.currentPath,
// TODO: get through data attribute
currentBranch: document.querySelector('.js-project-refs-dropdown').dataset.ref,
currentBranch: data.currentBranch,
isRoot: convertPermissionToBoolean(data.root),
isInitialRoot: convertPermissionToBoolean(data.root),
});

View File

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