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

Side by Side Diff: chrome/browser/resources/chromeos/login/enrollment_license_card.js

Issue 2959853003: Add UI components for license type selection in ChromeOS login UI. (Closed)
Patch Set: Remove unused flex import Created 3 years, 5 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Polymer element for displaying enrollment license selection
7 card.
8 */
9
10 Polymer({
11 is: 'enrollment-license-card',
12
13 behaviors: [I18nBehavior],
14
15 properties: {
16 /**
17 * Whether the UI disabled.
18 */
19 disabled: {
20 type: Boolean,
21 value: true,
22 },
23
24 /**
25 * Selected license type
26 */
27 selected: {
28 type: String,
29 value: 'sometype',
30 },
31
32 /**
33 * Array with available license types.
34 */
35 licenses: {
36 type: Array,
37 value: function() {
38 return [
39 {
40 id: 'licenseType',
41 label: 'perpetualLicenseTypeTitle',
42 count: 123,
43 disabled: false,
44 hidden: false,
45 },
46 ];
47 },
48 observer: 'licensesChanged_',
49 },
50 },
51
52 get submitButton() {
53 return this.$.submitButton;
54 },
55
56 buttonClicked_: function() {
57 this.fire('buttonclick');
58 },
59
60 licensesChanged_: function(newValue, oldValue) {
61 var firstSelection = '';
62 for (var i = 0, item; item = this.licenses[i]; ++i) {
63 if (this.isSelectable_(item) && firstSelection == '') {
64 firstSelection = item.id;
65 break;
66 }
67 }
68 if (firstSelection != '') {
69 this.selected = firstSelection;
70 } else if (this.licenses[0]) {
71 this.selected = this.licenses[0].id;
72 } else {
73 this.selected = '';
74 this.disabled = true;
75 }
76 },
77
78 isSelectable_: function(item) {
79 return item.count > 0 && !item.disabled && !item.hidden;
80 },
81
82 formatTitle_: function(item) {
83 return this.i18n('licenseCountTemplate', this.i18n(item.label), item.count);
84 },
85
86 or_: function(left, right) {
87 return left || right;
88 },
89 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698