| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2015 The Chromium Authors. All rights reserved. | 2 Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. | 4 found in the LICENSE file. |
| 5 --> | 5 --><html><head><link rel="import" href="ct-alert-extension.html"> |
| 6 <link rel="import" href="ct-alert-extension.html"> | |
| 7 <link rel="import" href="ct-alert-card-buttons.html"> | 6 <link rel="import" href="ct-alert-card-buttons.html"> |
| 8 <link rel="import" href="ct-user-prefs.html"> | 7 <link rel="import" href="ct-user-prefs.html"> |
| 9 <polymer-element name="ct-alert-card" attributes="alert tree"> | 8 <!-- |
| 10 <template> | 9 TODO(polyup): unable to infer path to components |
| 11 <style> | 10 directory. This import path is probably incomplete. |
| 11 --> |
| 12 <link rel="import" href="iron-flex-layout/iron-flex-layout.html"> |
| 13 <dom-module id="ct-alert-card"> |
| 14 <style> |
| 15 /* TODO(polyup): For speed, consider reworking these styles with .classes |
| 16 and #ids rather than [attributes]. |
| 17 */ |
| 18 [layout] { |
| 19 @apply(--layout); |
| 20 } |
| 21 [layout][horizontal] { |
| 22 @apply(--layout-horizontal); |
| 23 } |
| 24 [layout][vertical] { |
| 25 @apply(--layout-vertical); |
| 26 } |
| 27 [layout][flex] { |
| 28 @apply(--layout-flex); |
| 29 } |
| 30 </style> |
| 31 <style> |
| 12 :host { | 32 :host { |
| 13 display: block; | 33 display: block; |
| 14 } | 34 } |
| 15 div { | 35 div { |
| 16 margin-bottom: 10px; | 36 margin-bottom: 10px; |
| 17 } | 37 } |
| 18 .title { | 38 .title { |
| 19 font-weight: bold; | 39 font-weight: bold; |
| 20 } | 40 } |
| 21 .since { | 41 .since { |
| 22 font-style: fixed-width; | 42 font-style: fixed-width; |
| 23 } | 43 } |
| 24 .title, .since, .body, .severity, .links { | 44 .title, .since, .body, .severity, .links { |
| 25 margin: 0.5em; | 45 margin: 0.5em; |
| 26 } | 46 } |
| 27 </style> | 47 </style> |
| 48 <template> |
| 28 <ct-user-prefs id="userPrefs"></ct-user-prefs> | 49 <ct-user-prefs id="userPrefs"></ct-user-prefs> |
| 29 <div horizontal layout> | 50 <div horizontal="" layout=""> |
| 30 <ct-alert-card-buttons bug="{{ bug }}" alert="{{ alert }}" tree="{{ tree }
}"></ct-alert-card-buttons> | 51 <ct-alert-card-buttons bug="{{ bug }}" alert="{{ alert }}" tree="{{ tree }
}"></ct-alert-card-buttons> |
| 31 <div flex vertical layout class='severity-{{ alert.severity }}'> | 52 <div flex="" vertical="" layout="" class$="{{computeClass(alert)}}"> |
| 32 <div class='title'> | 53 <div class="title"> |
| 33 {{ alert.title }} | 54 <span>{{ alert.title }}</span> |
| 34 </div> | 55 </div> |
| 35 <div class='links'> | 56 <div class="links"> |
| 36 <template repeat="{{ link in alert.links }}"> | 57 <template is="dom-repeat" items="{{alert.links}}" as="link"> |
| 37 <a href="{{ {url: link.href, useUber: $.userPrefs.values.useUberchro
megw} | rewriteUrl }}" target="{{ $.userPrefs.values.linkTarget }}">{{ link.titl
e }}</a> | 58 <a target="{{ $.userPrefs.values.linkTarget }}" href$="{{computeHref
($, link)}}">{{ link.title }}</a> |
| 38 </template> | 59 </template> |
| 39 </div> | 60 </div> |
| 40 <div class='since'> | 61 <div class="since"> |
| 41 </div> | 62 </div> |
| 42 <div class='body'> | 63 <div class="body"> |
| 43 {{ alert.body }} | 64 <span>{{ alert.body }}</span> |
| 44 </div> | 65 </div> |
| 45 </div> | 66 </div> |
| 46 <div if='{{ alert.type }}'> | 67 <div if="{{ alert.type }}"> |
| 47 <ct-alert-extension extension="{{ alert.extension }}" type="{{ alert.typ
e }}"></ct-alert-extension> | 68 <ct-alert-extension extension="{{ alert.extension }}" type="{{ alert.typ
e }}"></ct-alert-extension> |
| 48 </div> | 69 </div> |
| 49 </div> | 70 </div> |
| 50 </template> | 71 </template> |
| 51 <script> | 72 <script> |
| 52 Polymer({ | 73 Polymer({ |
| 53 rewriteUrl: function(props) { | 74 is: 'ct-alert-card', |
| 54 if (this.$ && this.$.userPrefs) { | 75 properties: { |
| 55 return this.$.userPrefs.rewriteUrl(props.url); | 76 alert: { notify: true }, |
| 77 tree: { notify: true } |
| 78 }, |
| 79 rewriteUrl: function (props) { |
| 80 if (this.$ && this.$.userPrefs) { |
| 81 return this.$.userPrefs.rewriteUrl(props.url); |
| 82 } |
| 83 return props.url; |
| 84 }, |
| 85 computeClass: function (alert) { |
| 86 return 'severity-' + alert.severity; |
| 87 }, |
| 88 computeHref: function ($, link) { |
| 89 return this.rewriteUrl({ |
| 90 url: link.href, |
| 91 useUber: $.userPrefs.values.useUberchromegw |
| 92 }); |
| 56 } | 93 } |
| 57 return props.url; | 94 }); |
| 58 }, | |
| 59 }); | |
| 60 </script> | 95 </script> |
| 61 </polymer-element> | 96 </dom-module> |
| 62 | 97 |
| 63 | 98 |
| OLD | NEW |