summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/snippets/components/snippet_title.vue
blob: 06484ad51101d1dc5fa86bf6bdb75f6ff65cb817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script>
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import { GlSprintf } from '@gitlab/ui';

export default {
  components: {
    TimeAgoTooltip,
    GlSprintf,
  },
  props: {
    snippet: {
      type: Object,
      required: true,
    },
  },
};
</script>
<template>
  <div class="snippet-header limited-header-width">
    <h2 class="snippet-title prepend-top-0 mb-3" data-qa-selector="snippet_title">
      {{ snippet.title }}
    </h2>
    <div
      v-if="snippet.description"
      class="description"
      data-qa-selector="snippet_description_field"
    >
      <div class="md js-snippet-description" v-html="snippet.descriptionHtml"></div>
    </div>

    <small v-if="snippet.updatedAt !== snippet.createdAt" class="edited-text">
      <gl-sprintf :message="__('Edited %{timeago}')">
        <template #timeago>
          <time-ago-tooltip :time="snippet.updatedAt" tooltip-placement="bottom" />
        </template>
      </gl-sprintf>
    </small>
  </div>
</template>