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

Side by Side Diff: appengine/chromium_rietveld/new_static/components/cr-issue-patchsets.html

Issue 1152723005: Expand patchset if patchsetID provided in URL (Closed) Base URL: https://chromium.googlesource.com/infra/infra@master
Patch Set: Address comments Created 5 years, 6 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
« no previous file with comments | « no previous file | appengine/chromium_rietveld/new_static/components/cr-patchset-header.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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="../common/cr-collapsible.html"> 5 <link rel="import" href="../common/cr-collapsible.html">
6 <link rel="import" href="cr-issue-patchset.html"> 6 <link rel="import" href="cr-issue-patchset.html">
7 <link rel="import" href="cr-patchset-header.html"> 7 <link rel="import" href="cr-patchset-header.html">
8 8
9 <polymer-element name="cr-issue-patchsets" attributes="patchsets"> 9 <polymer-element name="cr-issue-patchsets" attributes="patchsets">
10 <template> 10 <template>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 <cr-keyboard on-key-e="{{ handleExpandKey }}" global></cr-keyboard> 69 <cr-keyboard on-key-e="{{ handleExpandKey }}" global></cr-keyboard>
70 </template> 70 </template>
71 <script> 71 <script>
72 Polymer({ 72 Polymer({
73 created: function() { 73 created: function() {
74 this.patchsets = null; 74 this.patchsets = null;
75 this.showOlderPatchsets = false; 75 this.showOlderPatchsets = false;
76 this.olderPatchsets = null; 76 this.olderPatchsets = null;
77 this.currentPatchset = null; 77 this.currentPatchset = null;
78 }, 78 },
79 attached: function() {
80 if (window.location.hash.startsWith('#ps')) {
81 var psId = parseInt(window.location.hash.substring(3));
82 this.showOlderPatchsets = true;
83 this.patchsets.forEach(function(patchset) {
84 patchset.active = (patchset.id == psId);
85 });
86 }
87 },
79 patchsetsChanged: function(oldValue, newValue) { 88 patchsetsChanged: function(oldValue, newValue) {
80 var value = newValue || []; 89 var value = newValue || [];
81 this.olderPatchsets = value.to(-1); 90 this.olderPatchsets = value.to(-1);
82 this.currentPatchset = value.last(); 91 this.currentPatchset = value.last();
83 this.showOlderPatchsets = false;
84 }, 92 },
85 pluralize: function(text, count) { 93 pluralize: function(text, count) {
86 if (!count) 94 if (!count)
87 return ""; 95 return "";
88 if (count == 1) 96 if (count == 1)
89 return text; 97 return text;
90 return text.pluralize(); 98 return text.pluralize();
91 }, 99 },
92 handleShowOlderPatchsets: function() { 100 handleShowOlderPatchsets: function() {
93 this.showOlderPatchsets = true; 101 this.showOlderPatchsets = true;
94 }, 102 },
95 handleExpandKey: function(event) { 103 handleExpandKey: function(event) {
96 event.preventDefault(); 104 event.preventDefault();
97 var sections = this.shadowRoot.querySelectorAll(".patchset"); 105 var sections = this.shadowRoot.querySelectorAll(".patchset");
98 var last = sections[sections.length - 1]; 106 var last = sections[sections.length - 1];
99 if (!last) 107 if (!last)
100 return; 108 return;
101 last.active = true; 109 last.active = true;
102 last.querySelector("cr-issue-patchset").expandAllDiffs().then(fu nction() { 110 last.querySelector("cr-issue-patchset").expandAllDiffs().then(fu nction() {
103 last.scrollIntoView(true); 111 last.scrollIntoView(true);
104 }); 112 });
105 }, 113 },
106 }); 114 });
107 </script> 115 </script>
108 </polymer-element> 116 </polymer-element>
OLDNEW
« no previous file with comments | « no previous file | appengine/chromium_rietveld/new_static/components/cr-patchset-header.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698