debian-mirror-gitlab/app/assets/javascripts/search/topbar/index.js

32 lines
678 B
JavaScript
Raw Normal View History

2021-02-22 17:27:13 +05:30
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
2021-03-11 19:13:27 +05:30
import GlobalSearchTopbar from './components/app.vue';
2021-02-22 17:27:13 +05:30
Vue.use(Translate);
2021-03-11 19:13:27 +05:30
export const initTopbar = (store) => {
const el = document.getElementById('js-search-topbar');
2021-02-22 17:27:13 +05:30
if (!el) {
return false;
}
2021-03-11 19:13:27 +05:30
let { groupInitialData, projectInitialData } = el.dataset;
2021-02-22 17:27:13 +05:30
2021-03-11 19:13:27 +05:30
groupInitialData = JSON.parse(groupInitialData);
projectInitialData = JSON.parse(projectInitialData);
2021-02-22 17:27:13 +05:30
return new Vue({
el,
store,
render(createElement) {
2021-03-11 19:13:27 +05:30
return createElement(GlobalSearchTopbar, {
2021-02-22 17:27:13 +05:30
props: {
2021-03-11 19:13:27 +05:30
groupInitialData,
projectInitialData,
2021-02-22 17:27:13 +05:30
},
});
},
});
};