summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorDonna Malayeri <lindydonna@gmail.com>2010-04-26 13:30:09 +0000
committerDonna Malayeri <lindydonna@gmail.com>2010-04-26 13:30:09 +0000
commitc2f6ae9755b7393ae873ce89c2caf1cd1f7148be (patch)
treec506cceec8f63818f3b2a9829fb8850f88aeefac /src/compiler
parent4ab780e8be41a7d47c07e8c6121ebe06ba3dfd89 (diff)
downloadscala-c2f6ae9755b7393ae873ce89c2caf1cd1f7148be.tar.gz
scala-c2f6ae9755b7393ae873ce89c2caf1cd1f7148be.tar.bz2
scala-c2f6ae9755b7393ae873ce89c2caf1cd1f7148be.zip
[scaladoc] Moved object/template icons to the l...
[scaladoc] Moved object/template icons to the left of the link in the index. Review by dubochet.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/page/Index.scala45
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css11
2 files changed, 45 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala
index 8f1d537c43..784a92f1ff 100644
--- a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala
@@ -63,18 +63,41 @@ class Index(universe: Universe) extends HtmlPage {
<ol class="templates">{
val tpls: Map[String, Seq[DocTemplateEntity]] =
(pack.templates filter (t => !t.isPackage && !isExcluded(t) )) groupBy (_.name)
+
+ val placeholderSeq: NodeSeq = <div class="placeholder"></div>
+
+ def createLink(entity: DocTemplateEntity, includePlaceholder: Boolean, includeText: Boolean) = {
+ val entityType = docEntityKindToString(entity)
+ val linkContent = (
+ { if (includePlaceholder) placeholderSeq else NodeSeq.Empty }
+ ++
+ { if (includeText) <span class="tplLink">{ Text(packageQualifiedName(entity)) }</span> else NodeSeq.Empty }
+ )
+ <a class="tplshow" href={ relativeLinkTo(entity) }><span class={ entityType }>({ Text(entityType) })</span>{ linkContent }</a>
+ }
+
for (tn <- tpls.keySet.toSeq sortBy (_.toLowerCase)) yield {
- val entries = tpls(tn) sortWith { (less, more) => less.isTrait || more.isObject }
- def doEntry(ety: DocTemplateEntity, firstEty: Boolean): NodeSeq = {
- val etyTpe =
- if (ety.isTrait) "trait" else if (ety.isClass) "class" else if (ety.isObject) "object" else "package"
- <a class="tplshow" href={ relativeLinkTo(ety) }>
- { if (firstEty) Text(packageQualifiedName(ety)) else NodeSeq.Empty }
- <span class={ etyTpe }>({ Text(etyTpe) })</span>
- </a>
- }
- <li title={ entries.head.qualifiedName }>{
- doEntry(entries.head, true) ++ (entries.tail map (doEntry(_, false)))
+ val entities = tpls(tn)
+ val row = (entities find (e => e.isPackage || e.isObject), entities find (e => e.isTrait || e.isClass))
+
+ val itemContents = row match {
+ case (Some(obj), None) => createLink(obj, includePlaceholder = true, includeText = true)
+
+ case (maybeObj, Some(template)) =>
+ val firstLink = maybeObj match {
+ case Some(obj) => createLink(obj, includePlaceholder = false, includeText = false)
+ case None => placeholderSeq
+ }
+
+ firstLink ++ createLink(template, includePlaceholder = false, includeText = true)
+
+ case _ => // FIXME: this default case should not be necessary. For some reason AnyRef is not a package, object, trait, or class
+ val entry = entities.head
+ placeholderSeq ++ createLink(entry, includePlaceholder = false, includeText = true)
+ }
+
+ <li title={ entities.head.qualifiedName }>{
+ itemContents
}</li>
}
}</ol>
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css
index 0bae7dbc3a..fc3f6d4c29 100644
--- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css
+++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css
@@ -145,10 +145,21 @@ h1 {
}
#tpl ol > li .icon {
+ padding-right: 5px;
bottom: -2px;
position: relative;
}
+#tpl .templates div.placeholder {
+ padding-right: 5px;
+ width: 13px;
+ display: inline-block;
+}
+
+#tpl .templates span.tplLink {
+ padding-left: 8px;
+}
+
#content {
border-left-width: 1px;
border-left-color: black;