Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: appengine/chromium_rietveld/new_static/components/cr-patchset-header.html

Issue 873593007: Add the ability to delete patchsets. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix |sending| Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 <!-- Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 Use of this source code is governed by a BSD-style license that can be 2 Use of this source code is governed by a BSD-style license that can be
3 found in the LICENSE file. --> 3 found in the LICENSE file. -->
4 4
5 <link rel="import" href="cr-patchset-title-dialog.html"> 5 <link rel="import" href="cr-patchset-edit-dialog.html">
6 6
7 <polymer-element name="cr-patchset-header" attributes="patchset"> 7 <polymer-element name="cr-patchset-header" attributes="patchset">
8 <template> 8 <template>
9 <style> 9 <style>
10 :host { 10 :host {
11 display: block; 11 display: block;
12 background: #F6F6F6; 12 background: #F6F6F6;
13 border-bottom: 1px solid #ebebeb; 13 border-bottom: 1px solid #ebebeb;
14 display: flex; 14 display: flex;
15 padding: 0.5em 16px; 15 padding: 0.5em 16px;
16 position: relative; 16 position: relative;
17 } 17 }
18 18
19 .patchset-title { 19 .patchset-title {
20 display: flex; 20 display: flex;
21 font-weight: bold; 21 font-weight: bold;
22 flex: 1; 22 flex: 1;
23 } 23 }
24 24
25 .patchset-actions, 25 .patchset-actions,
26 .patchset-comments, 26 .patchset-comments,
27 .patchset-date { 27 .patchset-date {
28 margin-left: 8px; 28 margin-left: 8px;
29 } 29 }
30 </style> 30 </style>
31 <div class="patchset-title"> 31 <div class="patchset-title">
32 Patch {{ patchset.sequence }}<template if="{{ patchset.title }}">: { { patchset.title }}</template> 32 Patch {{ patchset.sequence }}<template if="{{ patchset.title }}">: { { patchset.title }}</template>
33 </div> 33 </div>
34 <div class="patchset-actions">
35 <template if="{{ userIsOwner }}">
36 <cr-action on-tap="{{ showEditTitleDialog }}">Edit</cr-action>
37 </template>
38 </div>
39 <div class="patchset-comments"> 34 <div class="patchset-comments">
40 {{ patchset.messageCount - patchset.draftCount | pluralize("comment" ) }} 35 {{ patchset.messageCount - patchset.draftCount | pluralize("comment" ) }}
41 <template if="{{ patchset.draftCount }}"> 36 <template if="{{ patchset.draftCount }}">
42 <template if="{{ patchset.messageCount - patchset.draftCount }}" >,</template> 37 <template if="{{ patchset.messageCount - patchset.draftCount }}" >,</template>
43 {{ patchset.draftCount | pluralize("draft") }} 38 {{ patchset.draftCount | pluralize("draft") }}
44 </template> 39 </template>
45 </div> 40 </div>
46 <div class="patchset-date">{{ patchset.created | formatDate }}</div> 41 <div class="patchset-date">{{ patchset.created | formatDate }}</div>
42 <div class="patchset-actions">
43 <template if="{{ userIsOwner }}">
44 <cr-action on-tap="{{ showEditDialog }}">Edit</cr-action>
45 </template>
46 </div>
47 </template> 47 </template>
48 <script> 48 <script>
49 Polymer("cr-patchset-header", { 49 Polymer("cr-patchset-header", {
50 patchset: null, 50 patchset: null,
51 userIsOwner: false, 51 userIsOwner: false,
52 domReady: function() { 52 domReady: function() {
53 this.userIsOwner = this.patchset.issue.owner.isCurrentUser(); 53 this.userIsOwner = this.patchset.issue.owner.isCurrentUser();
54 }, 54 },
55 pluralize: function(count, text) { 55 pluralize: function(count, text) {
56 if (!count) 56 if (!count)
57 return ""; 57 return "";
58 if (count == 1) 58 if (count == 1)
59 return count + " " + text; 59 return count + " " + text;
60 return count + " " + text.pluralize(); 60 return count + " " + text.pluralize();
61 }, 61 },
62 formatDate: function(date) { 62 formatDate: function(date) {
63 if (!date) 63 if (!date)
64 return ""; 64 return "";
65 return date.relative(); 65 return date.relative();
66 }, 66 },
67 showEditTitleDialog: function(event) { 67 showEditDialog: function(event) {
68 // Don't collapse the patchset. 68 // Don't collapse the patchset.
69 event.stopPropagation(); 69 event.stopPropagation();
70 var dialog = document.createElement("cr-patchset-title-dialog"); 70 var dialog = document.createElement("cr-patchset-edit-dialog");
71 dialog.patchset = this.patchset; 71 dialog.patchset = this.patchset;
72 dialog.addEventListener("close", function() { 72 dialog.addEventListener("close", function() {
73 dialog.remove(); 73 dialog.remove();
74 }); 74 });
75 document.body.appendChild(dialog); 75 // TODO(esprehn): This is a hack, we need to be a child of the
76 // issue to dispatch a "refresh-issue" event. Instead we should
77 // stop using that event and use a real data model API that
78 // components interact with like <cr-datasource>.
79 var dialogs = document.querySelector("html /deep/ cr-issue::shad ow #dialogs");
80 dialogs.appendChild(dialog);
76 dialog.showModal(); 81 dialog.showModal();
77 }, 82 },
78 }); 83 });
79 </script> 84 </script>
80 </polymer-element> 85 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698