OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @fileoverview | |
7 * 'policy-group' is an MD element, that contains a description of a group | |
8 * and all policies that are tagged with the groups name. Policies with multiple | |
9 * tags will appear in multiple groups. | |
10 * | |
11 * Example: | |
12 * | |
13 * <policy-group></policy-group> | |
14 * | |
15 * By inserting an element as created with | |
16 * | |
17 * new PolicyGroup('Privacy and Security') | |
18 * | |
19 * into a document's DOM would render a paper card with the title 'Privacy | |
20 * and Security'. New Policies are added with |addPolicy|. | |
21 * | |
22 * @group Chrome Policy Elements | |
23 * @element policy-group | |
24 */ | |
25 PolicyGroup = Polymer({ | |
26 is: 'policy-group', | |
27 | |
28 properties: { | |
29 /** | |
30 * Tag name used as title for the group card. | |
31 * @type {string} | |
stevenjb
2015/10/09 16:39:27
For "simple" types like String, Closure can infer
fhorschig
2015/10/09 16:42:37
Okay, removed.
| |
32 */ | |
33 riskTag: { | |
34 type: String, | |
35 reflectToAttribute: true, | |
36 readOnly: true, | |
37 notify: false | |
38 } | |
39 }, | |
40 | |
41 /** | |
42 * @override | |
43 * @param {string} riskTag String ID used as title for the group card. | |
44 */ | |
45 factoryImpl: function(riskTag) { | |
46 this._setRiskTag(riskTag); | |
47 }, | |
48 | |
49 /** | |
50 * Used in HMTL file to translate displayed string. | |
51 * @param {string} key The key for the i18n. | |
52 * @return {string} i18n of |key|. | |
53 */ | |
54 translate: function(key) { | |
55 return loadTimeData.getString(key); | |
56 }, | |
57 | |
58 /** | |
59 * Creates a new DOM element for the given policy. | |
60 * @param {string} policy Name of the policy. | |
61 */ | |
62 addPolicy: function(policy) { | |
63 // TODO(fhorschig): Create policy paper-items with possibility to (un)fold. | |
64 var node = document.createElement('p'); | |
65 node.textContent = policy; | |
66 this.$.content.appendChild(node); | |
67 } | |
68 }); | |
OLD | NEW |