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 /** ID used as title for the group card. */ |
| 30 riskTag: { |
| 31 type: String, |
| 32 reflectToAttribute: true, |
| 33 readOnly: true, |
| 34 notify: false |
| 35 } |
| 36 }, |
| 37 |
| 38 /** |
| 39 * @override |
| 40 * @param {string} riskTag String ID used as title for the group card. |
| 41 */ |
| 42 factoryImpl: function(riskTag) { |
| 43 this._setRiskTag(riskTag); |
| 44 }, |
| 45 |
| 46 /** |
| 47 * Used in HMTL file to translate displayed string. |
| 48 * @param {string} key The key for the i18n. |
| 49 * @return {string} i18n of |key|. |
| 50 */ |
| 51 translate: function(key) { |
| 52 return loadTimeData.getString(key); |
| 53 }, |
| 54 |
| 55 /** |
| 56 * Creates a new DOM element for the given policy. |
| 57 * @param {string} policy Name of the policy. |
| 58 */ |
| 59 addPolicy: function(policy) { |
| 60 // TODO(fhorschig): Create policy paper-items with possibility to (un)fold. |
| 61 var node = document.createElement('p'); |
| 62 node.textContent = policy; |
| 63 this.$.content.appendChild(node); |
| 64 } |
| 65 }); |
OLD | NEW |