summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/third_party/polymer2/bower_components/chopsui/chops-cl-link.html
blob: 5286c50726c549cdf336db9f0b1e63171df11b2c (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
<link rel="import" href="../polymer/polymer.html">

<dom-module id="chops-cl-link">
  <template>
    <style>
      :host {
        font-family: 'Roboto', 'Noto', sans-serif;
      }
    </style>
    <a href$="https://crrev.com/[[change]]">[[change]]</a>
    (<a href$="mailto:[[ownerEmail]]">[[_userName]]</a>):
    [[description]]
  </template>
  <script>
    'use strict';

    /**
     * `<chops-cl-link>` displays basic information of a cl with a
     * link to the full details of the change
     *
     * Provide the change number, owner email, and description.
     *
     * @customElement
     * @polymer
     * @demo /demo/chops-cl-link_demo.html
     */
    class ChopsClLink extends Polymer.Element {
      static get is() { return 'chops-cl-link'; }

      static get properties() {
        return {
          /** The change number. */
          change: String,
          /** The owner's email. */
          ownerEmail: String,
          /** The change description. */
          description: String,
          _userName : {
            type: String,
            computed: '_computeUserName(ownerEmail)',
          },
        }
      }

      _computeUserName(email) {
        let cutoff = email.indexOf('@');
        return (cutoff < 0) ? 'Unkown' : email.substring(0, cutoff);
      }

    }
    customElements.define(ChopsClLink.is, ChopsClLink);
  </script>
<dom-module>