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

Unified Diff: client/web/element_summary.html

Issue 11636011: Web components based app to view dart docs. Still has rough edges. (Closed) Base URL: https://github.com/dart-lang/dart-api-app.git@master
Patch Set: more fixes Created 7 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/web/doc_link.html ('k') | client/web/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/web/element_summary.html
diff --git a/client/web/doc_link.html b/client/web/element_summary.html
similarity index 60%
copy from client/web/doc_link.html
copy to client/web/element_summary.html
index c88cb531902545c8caec2c535bdcd23b37346531..cb89a2098e7b30ca58ba82f741e5b956fec11878 100644
--- a/client/web/doc_link.html
+++ b/client/web/element_summary.html
@@ -1,43 +1,22 @@
<!DOCTYPE html>
-<html><body>
- <element name="x-doc-link" constructor="DocLink" extends="span">
- <template>
- <template instantiate="if ref.refId != 'void'">
- <a href="{{permalink(ref)}}">{{ref.name}}</a>
- </template>
- <template instantiate="if ref.refId == 'void'">
- {{ref.name}}
- </template>
- </template>
- <script type="application/dart">
- import 'package:web_ui/web_ui.dart';
- import 'ast.dart';
- import 'model.dart';
-
- class DocLink extends WebComponent {
- /// Must be a Reference or Element.
- var ref;
- }
- </script>
- </element>
+<html>
+ <head>
+ <link rel="components" href="doc_link.html">
+ </head>
- <element name="x-member-blocks" constructor="MemberBlocks" extends="div">
+ <body>
+ <element name="x-member-blocks" extends="div">
<template>
<template iterate='block in blocks'>
<div>
<h3>{{block.kindTitle}}</h3>
- <ul>
- <template iterate='element in block.elements'>
- <li class="{{kindCssClass(element)}}">
- <x-element-summary element="{{element}}"></x-element-summary>
- </li>
- </template>
- </ul>
+ <template iterate='element in block.elements'>
+ <x-element-summary element="{{element}}"></x-element-summary>
+ </template>
</div>
</template>
</template>
<script type="application/dart">
- // TODO(jacobr): this is kinda a rediculous way to do this
import 'package:web_ui/web_ui.dart';
import 'ast.dart';
import 'model.dart';
@@ -48,21 +27,23 @@
</script>
</element>
- <element name="x-element-signature" constructor="ElementSignature" extends="span">
+ <element name="x-element-signature" extends="span">
<template>
<span class="element-class">
- <template instantiate="if (element is MethodElementBase || element is TypedefElement) && element.returnType != null">
+ <template instantiate="if hasReturnType">
<x-doc-link ref="{{element.returnType}}"></x-doc-link>
</template>
</span>
<span class="element-definition">
- <span class="element-name"><x-doc-link ref="{{element}}"></x-doc-link></span>
- <template instantiate="if element is MethodElement || element is ConstructorElement || element is TypedefElement">
+ <span class="element-name">
+ <x-doc-link ref="{{element}}" short="{{true}}"></x-doc-link>
+ </span>
+ <template instantiate="if hasArguments">
<span class="args">(
<template iterate="param in element.parameters">
<span class="arg">
<template instantiate="if param.type != null">
- <span class = "arg-type">
+ <span class="arg-type">
<x-doc-link ref="{{param.type}}"></x-doc-link>
</span>
</template>
@@ -80,26 +61,36 @@
class ElementSignature extends WebComponent {
Element element;
+
+ bool get hasReturnType =>
+ (element is MethodLikeElement || element is TypedefElement)
+ && element.returnType != null;
+
+ bool get hasArguments =>
+ element is MethodElement || element is ConstructorElement
+ || element is TypedefElement;
}
</script>
</element>
- <element name="x-element-summary" constructor="ElementSummary" extends="div">
+ <element name="x-element-summary" extends="div">
<template>
<!--TODO(jacobr): use id instead of data-id and use a different escaping scheme-->
- <details class="element-details {{(element is MethodElementBase) ? 'member-details' : 'type-details'}}" data-id="{{element.id}}" open="{{currentMember != null && element.id == currentMember.id}}">
- <summary>
+ <details class="element-details {{kindClass}} {{memberOrTypeClass}}"
+ data-id="{{element.id}}"
+ open="{{isOpen}}">
+ <summary>
<div class="overflow-shadow"></div>
<template instantiate="if element is! ClassElement">
<x-element-signature element="{{element}}">
</x-element-signature>
</template>
<template instantiate="if element is ClassElement">
- <x-doc-link class="element-name element-definition" ref="{{element}}"></x-doc-link>
+ <x-doc-link class="element-name element-definition"
+ ref="{{element}}">
+ </x-doc-link>
</template>
- <div class="documentation">
- {{element.commentHtml}}
- </div>
+ <div class="documentation">{{element.commentHtml}}</div>
</summary>
<details class="extended-element-info">
<summary>View ?? comments.</summary>
@@ -115,21 +106,30 @@
class ElementSummary extends WebComponent {
Element element;
+
+ String get kindClass => kindCssClass(element);
+ String get memberOrTypeClass =>
+ (element is MethodLikeElement) ? 'member-details' : 'type-details';
+
+ bool get isOpen =>
+ currentMember != null && element.id == currentMember.id;
}
</script>
</element>
- <element name="x-class-hierarchy-subtree" constructor="ClassHierarchySubtree" extends="div">
+ <element name="x-class-hierarchy-subtree" extends="div">
<template>
<template instantiate="if (index < clazz.superclasses.length)">
<div><x-doc-link ref={{clazz.superclasses[index]}}></x-doc-link></div>
- <div style="padding-left: 15px">
+ <!-- TODO(jacobr): why doesn't it work to just put this class on the
+ x-class-hierarchy-subtree node? -->
+ <div class="child-subtree">
<x-class-hierarchy-subtree clazz="{{clazz}}" index="{{index+1}}">
</x-class-hierarchy-subtree>
</div>
</template>
<template instantiate="if index == clazz.superclasses.length">
- <div><strong>{{clazz.name}}</strong></div>
+ <div><strong>{{clazz.shortDescription}}</strong></div>
</template>
</template>
<script type="application/dart">
@@ -145,7 +145,7 @@
</script>
</element>
- <element name="x-class-hierarchy" constructor="ClassHierarchy" extends="div">
+ <element name="x-class-hierarchy" extends="div">
<template>
<x-class-hierarchy-subtree clazz="{{clazz}}" index="{{0}}">
</x-class-hierarchy-subtree>
@@ -160,5 +160,4 @@
}
</script>
</element>
-<!-- more below... -->
</body></html>
« no previous file with comments | « client/web/doc_link.html ('k') | client/web/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698