| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library web.category; | 5 library web.category; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'package:dartdoc_viewer/item.dart'; | 8 import 'package:dartdoc_viewer/item.dart'; |
| 9 import 'package:dartdoc_viewer/app.dart'; | 9 import 'package:dartdoc_viewer/app.dart'; |
| 10 import 'package:dartdoc_viewer/member.dart'; | 10 import 'package:dartdoc_viewer/member.dart'; |
| 11 import 'dart:html'; | 11 import 'dart:html'; |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * An HTML representation of a Category. | 14 * An HTML representation of a Category. |
| 15 * | 15 * |
| 16 * Used as a placeholder for an CategoryItem object. | 16 * Used as a placeholder for an CategoryItem object. |
| 17 */ | 17 */ |
| 18 @CustomTag("dartdoc-category") | 18 @CustomTag("dartdoc-category") |
| 19 class CategoryElement extends DartdocElement { | 19 class CategoryElement extends DartdocElement { |
| 20 @published Category category; | 20 @published Category category; |
| 21 | 21 |
| 22 // Note: only one of these is used at any given time, the other two will be | 22 // Note: only one of these is used at any given time, the other two will be |
| 23 // null. We do it this way to keep the <template if> outside of the | 23 // null. We do it this way to keep the <template if> outside of the |
| 24 // <template repeat>, so the repeat is more strongly typed. | 24 // <template repeat>, so the repeat is more strongly typed. |
| 25 @published ObservableList<Item> items; | 25 @published ObservableList<Item> items; |
| 26 @published ObservableList<Typedef> typedefs; |
| 26 @published ObservableList<Variable> variables; | 27 @published ObservableList<Variable> variables; |
| 27 @published ObservableList<Method> methods; | 28 @published ObservableList<Method> methods; |
| 28 | 29 |
| 29 @observable bool hasItems = false; | 30 @observable bool hasItems = false; |
| 30 | 31 |
| 31 @observable String title; | 32 @observable String title; |
| 32 @observable String stylizedName; | 33 @observable String stylizedName; |
| 33 | 34 |
| 34 @observable String accordionStyle; | 35 @observable String accordionStyle; |
| 35 @observable String divClass; | 36 @observable String divClass; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 56 } | 57 } |
| 57 | 58 |
| 58 void categoryChanged() { | 59 void categoryChanged() { |
| 59 title = category == null ? '' : category.name; | 60 title = category == null ? '' : category.name; |
| 60 stylizedName = category == null ? '' : category.name.replaceAll(' ', '-'); | 61 stylizedName = category == null ? '' : category.name.replaceAll(' ', '-'); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void itemsChanged() => _updateHasItems(); | 64 void itemsChanged() => _updateHasItems(); |
| 64 void variablesChanged() => _updateHasItems(); | 65 void variablesChanged() => _updateHasItems(); |
| 65 void methodsChanged() => _updateHasItems(); | 66 void methodsChanged() => _updateHasItems(); |
| 67 void typedefsChanged() => _updateHasItems(); |
| 66 | 68 |
| 67 void _updateHasItems() { | 69 void _updateHasItems() { |
| 68 hasItems = items != null && items.isNotEmpty || | 70 hasItems = items != null && items.isNotEmpty || |
| 69 variables != null && variables.isNotEmpty || | 71 variables != null && variables.isNotEmpty || |
| 70 methods != null && methods.isNotEmpty; | 72 methods != null && methods.isNotEmpty || |
| 73 typedefs != null && typedefs.isNotEmpty; |
| 71 } | 74 } |
| 72 | 75 |
| 73 void hideShow(event, detail, AnchorElement target) { | 76 void hideShow(event, detail, AnchorElement target) { |
| 74 _isExpanded = !_isExpanded; | 77 _isExpanded = !_isExpanded; |
| 75 } | 78 } |
| 76 } | 79 } |
| OLD | NEW |