Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.vue « preview « components « repository « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7f974838359b44ed94119197df02f70d4ef211cb (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
40
41
42
43
44
45
46
47
48
49
<script>
import { GlLink, GlLoadingIcon } from '@gitlab/ui';
import getReadmeQuery from '../../queries/getReadme.query.graphql';

export default {
  apollo: {
    readme: {
      query: getReadmeQuery,
      variables() {
        return {
          url: this.blob.webUrl,
        };
      },
      loadingKey: 'loading',
    },
  },
  components: {
    GlLink,
    GlLoadingIcon,
  },
  props: {
    blob: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      readme: null,
      loading: 0,
    };
  },
};
</script>

<template>
  <article class="file-holder limited-width-container readme-holder">
    <div class="file-title">
      <i aria-hidden="true" class="fa fa-file-text-o fa-fw"></i>
      <gl-link :href="blob.webUrl">
        <strong>{{ blob.name }}</strong>
      </gl-link>
    </div>
    <div class="blob-viewer">
      <gl-loading-icon v-if="loading > 0" size="md" class="my-4 mx-auto" />
      <div v-else-if="readme" v-html="readme.html"></div>
    </div>
  </article>
</template>