Permalink
Browse files

SI-6017 Generate Scaladoc's index links in Scala side

There is no reason to do it in JavaScript.
  • Loading branch information...
1 parent d4b46f6 commit 3f0bce95fffcea60b3cbf8bc9e0c9a410f732cde @kzys kzys committed Jan 7, 2013
@@ -48,10 +48,22 @@ class Index(universe: doc.Universe, val index: doc.Index) extends HtmlPage {
</div>
</body>
+ def letters: NodeSeq = {
+ val xs = index.firstLetterIndex.keys.toSeq
+ xs.sorted map {
+ c => <a target="template" href={ "index/index-" + c + ".html" }>{
+ if (c == '_') '#' else c.toUpper
+ }</a>
+ }
+ }
+
def browser =
<div id="browser" class="ui-layout-west">
<div class="ui-west-center">
- <div id="filter"></div>
+ <div id="filter">
+ <div id="textfilter"></div>
+ <div id="letters">{ letters }</div>
+ </div>
<div class="pack" id="tpl">{
def packageElem(pack: model.Package): NodeSeq = {
<xml:group>
@@ -335,8 +335,7 @@ function keyboardScrolldownLeftPane() {
/* Configures the text filter */
function configureTextFilter() {
scheduler.add("init", function() {
- $("#filter").append("<div id='textfilter'><span class='pre'/><span class='input'><input id='index-input' type='text' accesskey='/'/></span><span class='post'/></div>");
- printAlphabet();
+ $("#textfilter").append("<span class='pre'/><span class='input'><input id='index-input' type='text' accesskey='/'/></span><span class='post'/>");
var input = $("#textfilter input");
resizeFilterBlock();
input.bind('keyup', function(event) {
@@ -532,19 +531,3 @@ function kindFilterSync() {
function resizeFilterBlock() {
$("#tpl").css("top", $("#filter").outerHeight(true));
}
-
-function printAlphabet() {
- var html = '<a target="template" href="index/index-_.html">#</a>';
- var c;
- for (c = 'a'; c <= 'z'; c = String.fromCharCode(c.charCodeAt(0) + 1)) {
- html += [
- '<a target="template" href="index/index-',
- c,
- '.html">',
- c.toUpperCase(),
- '</a>'
- ].join('');
- }
- $("#filter").append('<div id="letters">' + html + '</div>');
-}
-
@@ -16,6 +16,9 @@ object Test extends ScaladocModelTest {
val index = IndexModelFactory.makeIndex(universe)
// Because "STAR" and "Star" are different
assert(index.firstLetterIndex('s').keys.toSeq.length == 2)
+
+ val indexPage = new Index(universe, index)
+ assert(indexPage.letters.length == 1)
}
case _ => assert(false)
}

0 comments on commit 3f0bce9

Please sign in to comment.