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

Side by Side Diff: chrome/browser/resources/settings/controls/settings_radio_group.js

Issue 2052543002: MD Settings: disable <paper-radio-button>s inside of a <settings-radio-group> when controlled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asdf Created 4 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 | « chrome/browser/resources/settings/controls/settings_radio_group.html ('k') | 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control 7 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control
8 * a supplied preference. 8 * a supplied preference.
9 * 9 *
10 * Example: 10 * Example:
11 * <settings-radio-group pref="{{prefs.settings.foo}}" 11 * <settings-radio-group pref="{{prefs.settings.foo}}"
12 * label="Foo Options." buttons="{{fooOptionsList}}"> 12 * label="Foo Options." buttons="{{fooOptionsList}}">
13 * </settings-radio-group> 13 * </settings-radio-group>
14 */ 14 */
15 Polymer({ 15 Polymer({
16 is: 'settings-radio-group', 16 is: 'settings-radio-group',
17 17
18 behaviors: [PrefControlBehavior], 18 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior],
19 19
20 properties: { 20 properties: {
21 disabled_: {
22 observer: 'disabledChanged_',
23 type: Boolean,
24 value: false,
25 },
26
21 /** 27 /**
22 * IronSelectableBehavior selected attribute. 28 * IronSelectableBehavior selected attribute.
23 */ 29 */
24 selected: { 30 selected: {
25 type: String, 31 type: String,
26 notify: true, 32 notify: true,
27 observer: 'selectedChanged_' 33 observer: 'selectedChanged_'
28 }, 34 },
29 }, 35 },
30 36
31 observers: [ 37 observers: [
32 'prefChanged_(pref.*)', 38 'prefChanged_(pref.*)',
33 ], 39 ],
34 40
35 /** @private */ 41 /** @private */
36 prefChanged_: function() { 42 prefChanged_: function() {
43 this.disabled_ = this.isPrefPolicyControlled(this.pref);
37 this.selected = Settings.PrefUtil.prefToString( 44 this.selected = Settings.PrefUtil.prefToString(
38 /** @type {!chrome.settingsPrivate.PrefObject} */(this.pref)); 45 /** @type {!chrome.settingsPrivate.PrefObject} */(this.pref));
39 }, 46 },
40 47
41 /** @private */ 48 /** @private */
49 disabledChanged_: function() {
50 if (this.disabled_) {
michaelpg 2016/06/08 19:23:16 why does this assume policy is never reversed?
Dan Beam 2016/06/09 02:11:33 it doesn't assume this, it was just trying not to
51 var radioButtons = this.queryAllEffectiveChildren('paper-radio-button');
52 for (var i = 0; i < radioButtons.length; ++i) {
53 radioButtons[i].disabled = true;
54 }
55 }
56 },
57
58 /** @private */
42 selectedChanged_: function(selected) { 59 selectedChanged_: function(selected) {
43 if (!this.pref) 60 if (!this.pref)
44 return; 61 return;
45 this.set('pref.value', 62 this.set('pref.value',
46 Settings.PrefUtil.stringToPrefValue(selected, this.pref)); 63 Settings.PrefUtil.stringToPrefValue(selected, this.pref));
47 }, 64 },
48 }); 65 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/controls/settings_radio_group.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698