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

Side by Side Diff: client/web/type.dart

Issue 149573008: Factor out the anchor prefix to easily allow switching to #! (Closed) Base URL: https://github.com/dart-lang/dartdoc-viewer.git@master
Patch Set: Fixes from review Created 6 years, 10 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 | « client/web/search.dart ('k') | client/web/typedef.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.type; 5 library web.type;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'package:dartdoc_viewer/item.dart'; 8 import 'package:dartdoc_viewer/item.dart';
9 import 'package:dartdoc_viewer/location.dart';
9 import 'package:dartdoc_viewer/search.dart' show searchIndex; 10 import 'package:dartdoc_viewer/search.dart' show searchIndex;
10 import 'package:polymer/polymer.dart'; 11 import 'package:polymer/polymer.dart';
11 12
12 // TODO(jmesserly): just extend HtmlElement? 13 // TODO(jmesserly): just extend HtmlElement?
13 @CustomTag('dartdoc-type') 14 @CustomTag('dartdoc-type')
14 class TypeElement extends PolymerElement { 15 class TypeElement extends PolymerElement {
15 @published NestedType type; 16 @published NestedType type;
16 17
17 Element _child; 18 Element _child;
18 19
(...skipping 11 matching lines...) Expand all
30 if (type == null || type.isDynamic) return; 31 if (type == null || type.isDynamic) return;
31 this.append(_child = createInner(type)); 32 this.append(_child = createInner(type));
32 } 33 }
33 34
34 /// Creates an HTML element for a parameterized type. 35 /// Creates an HTML element for a parameterized type.
35 static Element createInner(NestedType type) { 36 static Element createInner(NestedType type) {
36 var span = new SpanElement()..classes.add('type'); 37 var span = new SpanElement()..classes.add('type');
37 if (searchIndex.map.containsKey(type.outer.qualifiedName)) { 38 if (searchIndex.map.containsKey(type.outer.qualifiedName)) {
38 var outer = new AnchorElement() 39 var outer = new AnchorElement()
39 ..text = type.outer.simpleType 40 ..text = type.outer.simpleType
40 ..href = '#${type.outer.location}'; 41 ..href = locationPrefixed(type.outer.location);
41 span.append(outer); 42 span.append(outer);
42 } else { 43 } else {
43 span.appendText(type.outer.simpleType); 44 span.appendText(type.outer.simpleType);
44 } 45 }
45 if (type.inner.isNotEmpty) { 46 if (type.inner.isNotEmpty) {
46 span.appendText('<'); 47 span.appendText('<');
47 for (var element in type.inner) { 48 for (var element in type.inner) {
48 if (element != type.inner.first) span.appendText(', '); 49 if (element != type.inner.first) span.appendText(', ');
49 span.append(createInner(element)); 50 span.append(createInner(element));
50 } 51 }
51 span.appendText('>'); 52 span.appendText('>');
52 } 53 }
53 return span; 54 return span;
54 } 55 }
55 } 56 }
OLDNEW
« no previous file with comments | « client/web/search.dart ('k') | client/web/typedef.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698