debian-mirror-gitlab/app/assets/javascripts/search/sidebar/index.js
2022-11-25 23:54:43 +05:30

28 lines
603 B
JavaScript

import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import GlobalSearchSidebar from './components/app.vue';
Vue.use(Translate);
export const sidebarInitState = () => {
const el = document.getElementById('js-search-sidebar');
if (!el) return {};
const { navigation } = el.dataset;
return JSON.parse(navigation);
};
export const initSidebar = (store) => {
const el = document.getElementById('js-search-sidebar');
if (!el) return false;
return new Vue({
el,
store,
render(createElement) {
return createElement(GlobalSearchSidebar);
},
});
};