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

Side by Side Diff: dashboard/dashboard/elements/editable-list.html

Issue 1927823003: [Polymer 1.0] Convert editable-list.py to Polymer 1.0. (Closed) Base URL: https://github.com/catapult-project/catapult.git@polymer10-migration
Patch Set: Created 4 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2016 The Chromium Authors. All rights reserved. 3 Copyright 2016 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/dashboard/static/simple_xhr.html"> 8 <link rel="import" href="/dashboard/static/simple_xhr.html">
9 9
10 <polymer-element name="editable-list" attributes="xsrfToken"> 10 <dom-module id="editable-list">
11 <template> 11 <template>
12 <style> 12 <style>
13 .item-container { 13 .item-container {
14 padding-bottom: 4px; 14 padding-bottom: 4px;
15 } 15 }
16 16
17 .item-box { 17 .item-box {
18 border: 1px solid #e5ecf9; 18 border: 1px solid #e5ecf9;
19 background-color: #aec9ff; 19 background-color: #aec9ff;
20 padding: 4px 5px 4px 5px; 20 padding: 4px 5px 4px 5px;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 <div class="add-input-container"> 83 <div class="add-input-container">
84 <label> 84 <label>
85 {{itemLabel}}<br /> 85 {{itemLabel}}<br />
86 <input id="item_textfield" 86 <input id="item_textfield"
87 type="text" 87 type="text"
88 min="1" 88 min="1"
89 min="35" 89 min="35"
90 size="35"></input> 90 size="35"></input>
91 </label> 91 </label>
92 92
93 <div hidden?="{{!subItemLabel}}"> 93 <div hidden$="{{!subItemLabel}}">
94 <label> 94 <label>
95 {{subItemLabel}}<br /> 95 {{subItemLabel}}<br />
96 <input id="sub_item_textfield" 96 <input id="sub_item_textfield"
97 type="text" 97 type="text"
98 min="1" 98 min="1"
99 max="35" 99 max="35"
100 size="35"></input> 100 size="35"></input>
101 </label> 101 </label>
102 </div> 102 </div>
103 103
104 <br /> 104 <br />
105 <button class="kennedy-button-submit" 105 <button class="kennedy-button-submit"
106 on-click="{{addItemClicked}}">Add</button> 106 on-click="addItemClicked">Add</button>
107 </div> 107 </div>
108 108
109 <br /> 109 <br />
110 110
111 <template repeat="{{item, i in editable_list}}"> 111 <template is="dom-repeat" items="{{editable_list}}">
112 <p class="item-container"> 112 <p class="item-container">
113 <span class="item-box" removing?={{item.removing}}> 113 <span class="item-box" removing$={{item.removing}}>
114 {{item.name}}<a class="remove-button" 114 {{item.name}}<a class="remove-button"
115 on-click="{{removeItemClicked}}" 115 on-click="removeItemClicked"
116 removing?={{item.removing}}></a></span> 116 removing$={{item.removing}}></a></span>
117 117
118 <span hidden?="{{!item.sub_items}}">:&nbsp;&nbsp;</span> 118 <span hidden$="{{!item.sub_items}}">:&nbsp;&nbsp;</span>
119 119
120 <template repeat="{{sub_item, j in item.sub_items}}"> 120 <template is="dom-repeat" items="{{item.sub_items}}" as="sub_item">
121 <span class="item-box sub-item" removing?={{sub_item.removing}}> 121 <span class="item-box sub-item" removing$={{sub_item.removing}}>
122 {{sub_item.name}}<a class="remove-button" on-click="{{removeItemClick ed}}"></a> 122 {{sub_item.name}}<a class="remove-button" on-click="removeItemClicked "></a>
123 </span> 123 </span>
124 </template> 124 </template>
125 </p> 125 </p>
126 </template> 126 </template>
127 </template> 127 </template>
128 <script> 128 <script>
129 'use strict'; 129 'use strict';
130 Polymer('editable-list', { 130 Polymer({
131
132 is: 'editable-list',
133
134 properties: {
135 xsrfToken: {}
136 },
131 137
132 init: function(editable_list, handlerURL, itemLabel, subItemLabel) { 138 init: function(editable_list, handlerURL, itemLabel, subItemLabel) {
133 this.editable_list = editable_list.sort(this.itemCompare); 139 this.editable_list = editable_list.sort(this.itemCompare);
134 this.handlerURL = handlerURL; 140 this.handlerURL = handlerURL;
135 this.itemLabel = itemLabel; 141 this.itemLabel = itemLabel;
136 this.subItemLabel = subItemLabel; 142 this.subItemLabel = subItemLabel;
137 }, 143 },
138 144
139 /** 145 /**
140 * Handles remove item button clicked. 146 * Handles remove item button clicked.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 getItemByValue: function(value) { 255 getItemByValue: function(value) {
250 for (var i = 0; i < this.editable_list.length; i++) { 256 for (var i = 0; i < this.editable_list.length; i++) {
251 if (this.editable_list[i]['name'] == value) { 257 if (this.editable_list[i]['name'] == value) {
252 return this.editable_list[i]; 258 return this.editable_list[i];
253 } 259 }
254 } 260 }
255 return null; 261 return null;
256 } 262 }
257 }); 263 });
258 </script> 264 </script>
259 </polymer-element> 265 </dom-module>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698