summaryrefslogtreecommitdiff
path: root/src/components/Commit.vue
blob: 63e176490768381cf147f63988db08d23e34ff64 (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
50
51
52
53
<template lang="pug">
  .commit(:id="data.hash")
    .repo
      a(
        :href="'/repo/'+data.repository_url" :title="data.repository_url"
      ) {{ data.repository_url }}

    .head
      h5
        a(:href="'/commit/'+data.hash") {{ data.hash }}
      div
        span.tree tree:
        h6
          a(:href="'/commit/'+data.tree") {{ data.tree }}

    .author_committer
      div
        img.avatar(
          :src="'https://gravatar.com/avatar/'+author"
          :alt="data.author_email"
        )
        p Author: 
          b(:title="data.author_email") {{ data.author_name }} 
            | <{{data.author_email}}></b>
      div
        img.avatar(
          :src="'https://gravatar.com/avatar/'+committer"
          :alt="data.committer_email"
        )
        p Committer: 
          b(:title="data.committer_email") {{ data.committer_name }} 
            | <{{data.committer_email}}></b>

    .text
      p
        | {{ first_line(data.text) }}
        span.middot ·
        span.date {{ data.date | moment("ddd, D MMM YYYY HH:mm:ss ZZ") }}
</template>

<script>
export default {
  name: 'Commit',
  // `author` is the hash md5 of the author's gravatar
  // `committer` is the hash md5 of the committer's gravatar
  props: ['data', 'author', 'committer'],
  methods: {
    first_line(text) {
      return text.split('\n')[0]
    }
  }
}
</script>