Commit ddf9cf41 authored by Denys Mishunov's avatar Denys Mishunov

Re-named Snippet app to 'show'

This is done in anticipation for Snippet Edit Vue application that
is under construction at the time of the commit
parent b7b5cc99
...@@ -3,7 +3,7 @@ import ZenMode from '~/zen_mode'; ...@@ -3,7 +3,7 @@ import ZenMode from '~/zen_mode';
import LineHighlighter from '~/line_highlighter'; import LineHighlighter from '~/line_highlighter';
import BlobViewer from '~/blob/viewer'; import BlobViewer from '~/blob/viewer';
import snippetEmbed from '~/snippet/snippet_embed'; import snippetEmbed from '~/snippet/snippet_embed';
import initSnippetsApp from '~/snippets'; import { SnippetShowInit } from '~/snippets';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
if (!gon.features.snippetsVue) { if (!gon.features.snippetsVue) {
...@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', () => {
new ZenMode(); // eslint-disable-line no-new new ZenMode(); // eslint-disable-line no-new
snippetEmbed(); snippetEmbed();
} else { } else {
initSnippetsApp(); SnippetShowInit();
initNotes(); initNotes();
} }
}); });
...@@ -3,7 +3,7 @@ import BlobViewer from '~/blob/viewer'; ...@@ -3,7 +3,7 @@ import BlobViewer from '~/blob/viewer';
import ZenMode from '~/zen_mode'; import ZenMode from '~/zen_mode';
import initNotes from '~/init_notes'; import initNotes from '~/init_notes';
import snippetEmbed from '~/snippet/snippet_embed'; import snippetEmbed from '~/snippet/snippet_embed';
import initSnippetsApp from '~/snippets'; import { SnippetShowInit } from '~/snippets';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
if (!gon.features.snippetsVue) { if (!gon.features.snippetsVue) {
...@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', () => {
new ZenMode(); // eslint-disable-line no-new new ZenMode(); // eslint-disable-line no-new
snippetEmbed(); snippetEmbed();
} else { } else {
initSnippetsApp(); SnippetShowInit();
initNotes(); initNotes();
} }
}); });
...@@ -3,19 +3,16 @@ import Translate from '~/vue_shared/translate'; ...@@ -3,19 +3,16 @@ import Translate from '~/vue_shared/translate';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import SnippetsApp from './components/app.vue'; import SnippetsApp from './components/show.vue';
Vue.use(VueApollo); Vue.use(VueApollo);
Vue.use(Translate); Vue.use(Translate);
export default () => { function appFactory(el, Component) {
const el = document.getElementById('js-snippet-view');
if (!el) { if (!el) {
return false; return false;
} }
const { snippetGid } = el.dataset;
const apolloProvider = new VueApollo({ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(), defaultClient: createDefaultClient(),
}); });
...@@ -24,11 +21,17 @@ export default () => { ...@@ -24,11 +21,17 @@ export default () => {
el, el,
apolloProvider, apolloProvider,
render(createElement) { render(createElement) {
return createElement(SnippetsApp, { return createElement(Component, {
props: { props: {
snippetGid, ...el.dataset,
}, },
}); });
}, },
}); });
}
export const SnippetShowInit = () => {
appFactory(document.getElementById('js-snippet-view'), SnippetsApp);
}; };
export default () => {};
import SnippetApp from '~/snippets/components/app.vue'; import SnippetApp from '~/snippets/components/show.vue';
import SnippetHeader from '~/snippets/components/snippet_header.vue'; import SnippetHeader from '~/snippets/components/snippet_header.vue';
import SnippetTitle from '~/snippets/components/snippet_title.vue'; import SnippetTitle from '~/snippets/components/snippet_title.vue';
import SnippetBlob from '~/snippets/components/snippet_blob_view.vue'; import SnippetBlob from '~/snippets/components/snippet_blob_view.vue';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment