Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:html'; | 5 import 'dart:html'; |
| 6 | 6 |
| 7 import 'package:observatory/app.dart'; | 7 import 'package:observatory/app.dart'; |
| 8 import 'package:observatory/src/elements/helpers/tag.dart'; | 8 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 9 import 'package:observatory/src/elements/shims/binding.dart'; | 9 import 'package:observatory/src/elements/shims/binding.dart'; |
| 10 import 'package:observatory/src/elements/nav/menu.dart'; | 10 import 'package:observatory/src/elements/nav/menu.dart'; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 _link = value; render(); | 30 _link = value; render(); |
| 31 } | 31 } |
| 32 set last(bool value) { | 32 set last(bool value) { |
| 33 _last = value; render(); | 33 _last = value; render(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 NavMenuElementWrapper.created() : super.created() { | 36 NavMenuElementWrapper.created() : super.created() { |
| 37 binder.registerCallback(this); | 37 binder.registerCallback(this); |
| 38 _anchor = getAttribute('anchor'); | 38 _anchor = getAttribute('anchor'); |
| 39 _link = getAttribute('link'); | 39 _link = getAttribute('link'); |
| 40 _last = getAttribute('') != null; | 40 _last = _getBoolAttribute('last'); |
|
Cutch
2016/07/21 18:25:03
Aren't there multiple places that this should be u
cbernaschina
2016/07/21 22:03:03
all the ...-nav-menu
I've already updated the rela
| |
| 41 createShadowRoot(); | 41 createShadowRoot(); |
| 42 render(); | 42 render(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 @override | 45 @override |
| 46 void attached() { | 46 void attached() { |
| 47 super.attached(); | 47 super.attached(); |
| 48 render(); | 48 render(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void render() { | 51 void render() { |
| 52 shadowRoot.children = []; | 52 shadowRoot.children = []; |
| 53 if (_anchor == null || _last == null) return; | 53 if (_anchor == null || _last == null) return; |
| 54 | 54 |
| 55 shadowRoot.children = [ | 55 shadowRoot.children = [ |
| 56 new NavMenuElement(_anchor, link: _link, last: last, | 56 new NavMenuElement(_anchor, link: _link, last: last, |
| 57 queue: ObservatoryApplication.app.queue) | 57 queue: ObservatoryApplication.app.queue) |
| 58 ..children = [new ContentElement()] | 58 ..children = [new ContentElement()] |
| 59 ]; | 59 ]; |
| 60 } | 60 } |
| 61 | |
| 62 bool _getBoolAttribute(String name) { | |
| 63 final String value = getAttribute('last'); | |
| 64 return !(value == null || value == 'false'); | |
| 65 } | |
| 61 } | 66 } |
| OLD | NEW |