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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
667 B
JavaScript
Raw Normal View History

2021-01-29 00:20:46 +05:30
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import GlobalSearchSidebar from './components/app.vue';
Vue.use(Translate);
2022-11-25 23:54:43 +05:30
export const sidebarInitState = () => {
const el = document.getElementById('js-search-sidebar');
if (!el) return {};
2023-03-17 16:20:25 +05:30
const { navigationJson } = el.dataset;
const navigationJsonParsed = JSON.parse(navigationJson);
return { navigationJsonParsed };
2022-11-25 23:54:43 +05:30
};
2021-03-08 18:12:59 +05:30
export const initSidebar = (store) => {
2021-01-29 00:20:46 +05:30
const el = document.getElementById('js-search-sidebar');
if (!el) return false;
return new Vue({
el,
store,
render(createElement) {
return createElement(GlobalSearchSidebar);
},
});
};