diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 18:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 18:08:42 +0300 |
commit | c27acb1d376f7127cd33eadcc8f5683ed55262bc (patch) | |
tree | 685c31391dca71a73782b5c8626f4ef5b582dc21 /app/assets/javascripts/snippets | |
parent | 1808454313ed75c92e1384466e8c83bfbc8ae25e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/snippets')
-rw-r--r-- | app/assets/javascripts/snippets/components/app.vue | 3 | ||||
-rw-r--r-- | app/assets/javascripts/snippets/components/snippet_blob_view.vue | 26 | ||||
-rw-r--r-- | app/assets/javascripts/snippets/constants.js | 3 |
3 files changed, 32 insertions, 0 deletions
diff --git a/app/assets/javascripts/snippets/components/app.vue b/app/assets/javascripts/snippets/components/app.vue index 7a2145a800c..e98f56d87f5 100644 --- a/app/assets/javascripts/snippets/components/app.vue +++ b/app/assets/javascripts/snippets/components/app.vue @@ -2,6 +2,7 @@ import GetSnippetQuery from '../queries/snippet.query.graphql'; import SnippetHeader from './snippet_header.vue'; import SnippetTitle from './snippet_title.vue'; +import SnippetBlob from './snippet_blob_view.vue'; import { GlLoadingIcon } from '@gitlab/ui'; export default { @@ -9,6 +10,7 @@ export default { SnippetHeader, SnippetTitle, GlLoadingIcon, + SnippetBlob, }, apollo: { snippet: { @@ -50,6 +52,7 @@ export default { <template v-else> <snippet-header :snippet="snippet" /> <snippet-title :snippet="snippet" /> + <snippet-blob :snippet="snippet" /> </template> </div> </template> diff --git a/app/assets/javascripts/snippets/components/snippet_blob_view.vue b/app/assets/javascripts/snippets/components/snippet_blob_view.vue new file mode 100644 index 00000000000..b91e08a4251 --- /dev/null +++ b/app/assets/javascripts/snippets/components/snippet_blob_view.vue @@ -0,0 +1,26 @@ +<script> +import BlobEmbeddable from '~/blob/components/blob_embeddable.vue'; +import { SNIPPET_VISIBILITY_PUBLIC } from '../constants'; + +export default { + components: { + BlobEmbeddable, + }, + props: { + snippet: { + type: Object, + required: true, + }, + }, + computed: { + embeddable() { + return this.snippet.visibilityLevel === SNIPPET_VISIBILITY_PUBLIC; + }, + }, +}; +</script> +<template> + <div> + <blob-embeddable v-if="embeddable" class="mb-3" :url="snippet.webUrl" /> + </div> +</template> diff --git a/app/assets/javascripts/snippets/constants.js b/app/assets/javascripts/snippets/constants.js new file mode 100644 index 00000000000..87e3fe360a3 --- /dev/null +++ b/app/assets/javascripts/snippets/constants.js @@ -0,0 +1,3 @@ +export const SNIPPET_VISIBILITY_PRIVATE = 'private'; +export const SNIPPET_VISIBILITY_INTERNAL = 'internal'; +export const SNIPPET_VISIBILITY_PUBLIC = 'public'; |