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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/login/enrollment_license_card.js
diff --git a/chrome/browser/resources/chromeos/login/enrollment_license_card.js b/chrome/browser/resources/chromeos/login/enrollment_license_card.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f3de855e85a05f83bc8017ac75783f85a52353f
--- /dev/null
+++ b/chrome/browser/resources/chromeos/login/enrollment_license_card.js
@@ -0,0 +1,89 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Polymer element for displaying enrollment license selection
+ card.
+ */
+
+Polymer({
+ is: 'enrollment-license-card',
+
+ behaviors: [I18nBehavior],
+
+ properties: {
+ /**
+ * Whether the UI disabled.
+ */
+ disabled: {
+ type: Boolean,
+ value: true,
+ },
+
+ /**
+ * Selected license type
+ */
+ selected: {
+ type: String,
+ value: 'sometype',
+ },
+
+ /**
+ * Array with available license types.
+ */
+ licenses: {
+ type: Array,
+ value: function() {
+ return [
+ {
+ id: 'licenseType',
+ label: 'perpetualLicenseTypeTitle',
+ count: 123,
+ disabled: false,
+ hidden: false,
+ },
+ ];
+ },
+ observer: 'licensesChanged_',
+ },
+ },
+
+ get submitButton() {
+ return this.$.submitButton;
+ },
+
+ buttonClicked_: function() {
+ this.fire('buttonclick');
+ },
+
+ licensesChanged_: function(newValue, oldValue) {
+ var firstSelection = '';
+ for (var i = 0, item; item = this.licenses[i]; ++i) {
+ if (this.isSelectable_(item) && firstSelection == '') {
+ firstSelection = item.id;
+ break;
+ }
+ }
+ if (firstSelection != '') {
+ this.selected = firstSelection;
+ } else if (this.licenses[0]) {
+ this.selected = this.licenses[0].id;
+ } else {
+ this.selected = '';
+ this.disabled = true;
+ }
+ },
+
+ isSelectable_: function(item) {
+ return item.count > 0 && !item.disabled && !item.hidden;
+ },
+
+ formatTitle_: function(item) {
+ return this.i18n('licenseCountTemplate', this.i18n(item.label), item.count);
+ },
+
+ or_: function(left, right) {
+ return left || right;
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698