Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Tools / GardeningServer / ui / ct-failure-card-buttons.html
1 <!--
2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6
7 <link rel="import" href="../model/ct-builder-list.html">
8 <link rel="import" href="ct-button.html">
9 <link rel="import" href="ct-view-handler.html">
10 <link rel="import" href="../bower_components/paper-dialog/paper-dialog.html">
11 <link rel="import" href="../bower_components/paper-dialog/paper-dialog-transition.html">
12 <link rel="import" href="../bower_components/paper-input/paper-input.html">
13
14 <polymer-element name="ct-failure-card-buttons" attributes="group bug">
15   <template>
16     <style>
17       :host {
18         display: flex;
19       }
20       :host > * {
21         margin-right: 5px;
22       }
23       ct-button {
24         white-space: nowrap;
25       }
26
27       #bugReminder {
28         font-size: large;
29         color: red;
30       }
31     </style>
32     <ct-view-handler></ct-view-handler>
33     <a href="{{ group.examineUrl }}">
34       <ct-button id="examine" label="Examine"></ct-button>
35     </a>
36     <template if="{{ !group.isSnoozed }}">
37       <ct-button id="snooze" on-tap="{{ snooze }}" label="Snooze"></ct-button>
38     </template>
39     <template if="{{ group.isSnoozed }}">
40       <ct-button id="snooze" on-tap="{{ unsnooze }}" label="Unsnooze"></ct-button>
41     </template>
42     <ct-button id="link-bug" on-tap="{{ linkBug }}" label="Link Bug"></ct-button>
43
44     <paper-dialog heading="Enter bug number" transition="paper-transition-center" id="bugDialog">
45       <paper-input label="Bug# or URL" floatingLabel autofocus id="bug"></paper-input>
46       <div><a id="fileBugLink" target="_blank" on-click="{{ fileBugClicked }}">
47         <template if="{{ !_fileBugClicked }}">
48           File bug
49         </template>
50       </a></div>
51       <template if="{{ _fileBugClicked }}">
52         <div id="bugReminder">
53           Remember to enter the new bug number above!
54         </div>
55       </template>
56       <ct-button label="Remove bug link" on-tap="{{ removeBug }}" dismissive id="dialogRemoveBug"></ct-button>
57       <ct-button label="OK" on-tap="{{ saveBug }}" affirmative id="dialogOk"></ct-button>
58     </paper-dialog>
59   </template>
60   <script>
61     Polymer({
62       group: null,
63       _fileBugClicked: false,
64
65       snooze: function() {
66         this.group.snoozeUntil(Date.now() + 60 * 60 * 1000);
67       },
68
69       unsnooze: function() {
70         this.group.unsnooze();
71       },
72
73       linkBug: function() {
74         this.$.bug.value = this.group.bug;
75         this._fileBugClicked = false;
76         this.$.fileBugLink.href = this.group.data.fileBugLink();
77         this.$.bugDialog.toggle();
78       },
79
80       saveBug: function() {
81         this.group.setBug(this.$.bug.value);
82       },
83
84       removeBug: function() {
85         this.group.clearBug();
86       },
87
88       fileBugClicked: function() {
89         this._fileBugClicked = true;
90       },
91     });
92   </script>
93 </polymer-element>