diff options
Diffstat (limited to 'app/assets/javascripts/repo/index.js')
-rw-r--r-- | app/assets/javascripts/repo/index.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/assets/javascripts/repo/index.js b/app/assets/javascripts/repo/index.js index 7d0123e3d3a..85e960df497 100644 --- a/app/assets/javascripts/repo/index.js +++ b/app/assets/javascripts/repo/index.js @@ -1,9 +1,11 @@ import $ from 'jquery'; import Vue from 'vue'; +import { convertPermissionToBoolean } from '../lib/utils/common_utils'; import Service from './services/repo_service'; import Store from './stores/repo_store'; import Repo from './components/repo.vue'; import RepoEditButton from './components/repo_edit_button.vue'; +import newBranchForm from './components/new_branch_form.vue'; import Translate from '../vue_shared/translate'; function initDropdowns() { @@ -31,8 +33,13 @@ function setInitialStore(data) { Store.projectUrl = data.projectUrl; Store.canCommit = data.canCommit; Store.onTopOfBranch = data.onTopOfBranch; + Store.newMrTemplateUrl = decodeURIComponent(data.newMrTemplateUrl); + Store.customBranchURL = decodeURIComponent(data.blobUrl); + Store.isRoot = convertPermissionToBoolean(data.root); + Store.isInitialRoot = convertPermissionToBoolean(data.root); Store.currentBranch = $('button.dropdown-menu-toggle').attr('data-ref'); Store.checkIsCommitable(); + Store.setBranchHash(); } function initRepo(el) { @@ -56,6 +63,26 @@ function initRepoEditButton(el) { }); } +function initNewBranchForm() { + const el = document.querySelector('.js-new-branch-dropdown'); + + if (!el) return null; + + return new Vue({ + el, + components: { + newBranchForm, + }, + render(createElement) { + return createElement('new-branch-form', { + props: { + currentBranch: Store.currentBranch, + }, + }); + }, + }); +} + function initRepoBundle() { const repo = document.getElementById('repo'); const editButton = document.querySelector('.editable-mode'); @@ -67,6 +94,7 @@ function initRepoBundle() { initRepo(repo); initRepoEditButton(editButton); + initNewBranchForm(); } $(initRepoBundle); |