Skip to content

Commit

Permalink
Merged revisions 24783-24788 via svnmerge from
Browse files Browse the repository at this point in the history
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk

........
  r24783 | malayeri | 2011-04-19 16:51:42 +0200 (Tue, 19 Apr 2011) | 1 line

  [scaladoc] CSS tweaks, changes to display of linear supertypes/known
subclasses. Closes #4458. No review. ........ r24784 | malayeri |
2011-04-19 17:30:26 +0200 (Tue, 19 Apr 2011) | 1 line

  [scaladoc] Change URL when navigating Scaladoc, so as to allow linking
to individual pages with the left frame intact. Patch submitted by
Ruediger Keller. Closes #4473. No review. ........ r24785 | malayeri |
2011-04-19 17:38:17 +0200 (Tue, 19 Apr 2011) | 1 line

  [scaladoc] Removed some drop shadows from CSS, to improve readability.
No review. ........ r24786 | prokopec | 2011-04-19 18:57:44 +0200 (Tue,
19 Apr 2011) | 5 lines

  Removed GenTravOnceLike and TravOnceLike, put their functionality
  to GenTravOnce and TravOnce. Remove immutable Gen* traits. Removing
  mutable Gen* traits.

  No review.
........
  r24787 | pedrofurla | 2011-04-20 05:03:51 +0200 (Wed, 20 Apr 2011) | 1 line

  Makes entire package area clickable in the left panel. Contributed by
Simon Ochsenreither (soc). Closes #4464. Review by malayeri. ........
r24788 | pedrofurla | 2011-04-20 05:33:58 +0200 (Wed, 20 Apr 2011) | 1
line

  Shows deprecation message only once. Contributed by Simon
Ochsenreither (soc). Closes #4466. Review by malayeri. ........
  • Loading branch information
Antonio Cunei committed Apr 20, 2011
1 parent a387c9f commit 7c3ec20
Show file tree
Hide file tree
Showing 42 changed files with 1,027 additions and 1,047 deletions.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/doc/html/page/Index.scala
Expand Up @@ -72,7 +72,7 @@ class Index(universe: doc.Universe, index: doc.Index) extends HtmlPage {
def packageElem(pack: model.Package): NodeSeq = {
<xml:group>
{ if (!pack.isRootPackage)
<h3><a class="tplshow" href={ relativeLinkTo(pack) } target="template">{ pack.qualifiedName }</a></h3>
<a class="tplshow" href={ relativeLinkTo(pack) } target="template">{ pack.qualifiedName }</a>
else NodeSeq.Empty
}
<ol class="templates">{
Expand Down
40 changes: 22 additions & 18 deletions src/compiler/scala/tools/nsc/doc/html/page/Template.scala
Expand Up @@ -320,18 +320,28 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
case _ => NodeSeq.Empty
}

val annotations: Seq[scala.xml.Node] =
val annotations: Seq[scala.xml.Node] = {
// A list of annotations which don't show their arguments, e. g. because they are shown separately.
val annotationsWithHiddenArguments = List("deprecated", "Deprecated")

def showArguments(annotation: Annotation) = {
if (annotationsWithHiddenArguments.contains(annotation.qualifiedName)) false else true
}

if (!mbr.annotations.isEmpty) {
<dt>Annotations</dt>
<dd>{
mbr.annotations.map { annot =>
<xml:group>
<span class="name">@{ templateToHtml(annot.annotationClass) }</span>{ argumentsToHtml(annot.arguments) }
<span class="name">@{ templateToHtml(annot.annotationClass) }</span>{
if (showArguments(annot)) argumentsToHtml(annot.arguments) else NodeSeq.Empty
}
</xml:group>
}
}
</dd>
} else NodeSeq.Empty
}

val sourceLink: Seq[scala.xml.Node] = mbr match {
case dtpl: DocTemplateEntity if (isSelf && dtpl.sourceUrl.isDefined && dtpl.inSource.isDefined && !isReduced) =>
Expand Down Expand Up @@ -398,28 +408,22 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {

val linearization = mbr match {
case dtpl: DocTemplateEntity if isSelf && !isReduced && dtpl.linearizationTemplates.nonEmpty =>
<div class="toggleContainer">
<div class="attributes block">
<span class="link showElement">Linear Supertypes</span>
<span class="link hideElement">Linear Supertypes</span>
</div>
<div class="superTypes hiddenContent">
<p>{ typesToHtml(dtpl.linearizationTypes, hasLinks = true, sep = xml.Text(", ")) }</p>
</div>
<div class="toggleContainer block">
<span class="toggle">Linear Supertypes</span>
<div class="superTypes hiddenContent">{
typesToHtml(dtpl.linearizationTypes, hasLinks = true, sep = xml.Text(", "))
}</div>
</div>
case _ => NodeSeq.Empty
}

val subclasses = mbr match {
case dtpl: DocTemplateEntity if isSelf && !isReduced && dtpl.subClasses.nonEmpty =>
<div class="toggleContainer">
<div class="attributes block">
<span class="link showElement">Known Subclasses</span>
<span class="link hideElement">Known Subclasses</span>
</div>
<div class="subClasses hiddenContent">
<p>{ templatesToHtml(dtpl.subClasses.sortBy(_.name), xml.Text(", ")) }</p>
</div>
<div class="toggleContainer block">
<span class="toggle">Known Subclasses</span>
<div class="subClasses hiddenContent">{
templatesToHtml(dtpl.subClasses.sortBy(_.name), xml.Text(", "))
}</div>
</div>
case _ => NodeSeq.Empty
}
Expand Down
51 changes: 27 additions & 24 deletions src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css
Expand Up @@ -226,7 +226,6 @@ h1 {
float: right;
font-weight: normal;
color: white;
padding: 0 8px;
}

#tpl .packfocus {
Expand All @@ -237,27 +236,31 @@ h1 {
}

#tpl .packages > ol {
background-color: #dadfe6;
/*margin-bottom: 5px;*/
background-color: #dadfe6;
/*margin-bottom: 5px;*/
}

/*#tpl .packages > ol > li {
margin-bottom: 1px;
}*/

#tpl .packages > li > h3 {
#tpl .packages > li > a {
padding: 0px 5px;
}

#tpl .packages > li > a.tplshow {
display: block;
color: white;
font-weight: bold;
display: block;
text-shadow: #000000 0 1px 0;
text-shadow: #000000 0 1px 0;
}

#tpl ol > li.pack {
padding: 3px 5px;
background: url("packagesbg.gif");
background-repeat:repeat-x;
min-height: 14px;
background: url("packagesbg.gif");
background-repeat:repeat-x;
min-height: 14px;
background-color: #6e808e;
}

Expand All @@ -266,24 +269,24 @@ h1 {
}

#tpl .templates > li {
padding-left: 5px;
min-height: 18px;
padding-left: 5px;
min-height: 18px;
}

#tpl ol > li .icon {
padding-right: 5px;
padding-right: 5px;
bottom: -2px;
position: relative;
}

#tpl .templates div.placeholder {
padding-right: 5px;
width: 13px;
display: inline-block;
padding-right: 5px;
width: 13px;
display: inline-block;
}

#tpl .templates span.tplLink {
padding-left: 5px;
padding-left: 5px;
}

#content {
Expand All @@ -306,18 +309,18 @@ h1 {
}

.ui-layout-pane {
background: #FFF;
overflow: auto;
background: #FFF;
overflow: auto;
}

.ui-layout-resizer {
background-image:url('filterbg.gif');
background-repeat:repeat-x;
background-color: #ededee; /* light gray */
border:1px solid #bbbbbb;
border-top:0;
border-bottom:0;
border-left: 0;
background-image:url('filterbg.gif');
background-repeat:repeat-x;
background-color: #ededee; /* light gray */
border:1px solid #bbbbbb;
border-top:0;
border-bottom:0;
border-left: 0;
}

.ui-layout-toggler {
Expand Down
73 changes: 64 additions & 9 deletions src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js
Expand Up @@ -9,18 +9,22 @@ var scheduler = undefined;
var kindFilterState = undefined;
var focusFilterState = undefined;

var title = $(document).attr('title')
var title = $(document).attr('title');

var lastHash = "";

$(document).ready(function() {
$('body').layout({ west__size: '20%' });
$('#browser').layout({
center__paneSelector: ".ui-west-center"
//,center__initClosed:true
,north__paneSelector: ".ui-west-north"
});
});
$('iframe').bind("load", function(){
var subtitle = $(this).contents().find('title').text();
$(document).attr('title', (title ? title + " - " : "") + subtitle);

setUrlFragmentFromFrameSrc();
});

// workaround for IE's iframe sizing lack of smartness
Expand All @@ -43,8 +47,60 @@ $(document).ready(function() {
configureKindFilter();
configureEntityList();

setFrameSrcFromUrlFragment();

// If the url fragment changes, adjust the src of iframe "template".
$(window).bind('hashchange', function() {
if(lastFragment != window.location.hash) {
lastFragment = window.location.hash;
setFrameSrcFromUrlFragment();
}
});
});

// Set the iframe's src according to the fragment of the current url.
// fragment = "#scala.Either" => iframe url = "scala/Either.html"
// fragment = "#scala.Either@isRight:Boolean" => iframe url = "scala/Either.html#isRight:Boolean"
function setFrameSrcFromUrlFragment() {
var fragment = location.hash.slice(1);
if(fragment) {
var loc = fragment.split("@")[0].replace(/\./g, "/");
if(loc.indexOf(".html") < 0) loc += ".html";
if(fragment.indexOf('@') > 0) loc += ("#" + fragment.split("@", 2)[1]);
frames["template"].location.replace(loc);
}
else
frames["template"].location.replace("package.html");
}

// Set the url fragment according to the src of the iframe "template".
// iframe url = "scala/Either.html" => url fragment = "#scala.Either"
// iframe url = "scala/Either.html#isRight:Boolean" => url fragment = "#scala.Either@isRight:Boolean"
function setUrlFragmentFromFrameSrc() {
try {
var commonLength = location.pathname.lastIndexOf("/");
var frameLocation = frames["template"].location;
var relativePath = frameLocation.pathname.slice(commonLength + 1);

if(!relativePath || frameLocation.pathname.indexOf("/") < 0)
return;

// Add #, remove ".html" and replace "/" with "."
fragment = "#" + relativePath.replace(/\.html$/, "").replace(/\//g, ".");

// Add the frame's hash after an @
if(frameLocation.hash) fragment += ("@" + frameLocation.hash.slice(1));

// Use replace to not add history items
lastFragment = fragment;
location.replace(fragment);
}
catch(e) {
// Chrome doesn't allow reading the iframe's location when
// used on the local file system.
}
}

var Index = {};

(function (ns) {
Expand All @@ -70,12 +126,11 @@ var Index = {};
return [
'<li class="pack">',
'<a class="packfocus">focus</a><a class="packhide">hide</a>',
'<h3>',
'<a class="tplshow" target="template" href="',
pack.replace(/\./g, '/'),
'/package.html">',
pack,
'</a></h3></li>'
'</a></li>'
].join('');
};

Expand Down Expand Up @@ -139,13 +194,13 @@ var Index = {};

function subPackages(pack) {
return $.grep($('#tpl ol.packages'), function (element, index) {
var pack = $('h3', element).text();
var pack = $('li.pack > .tplshow', element).text();
return pack.indexOf(pack + '.') == 0;
});
}

ns.hidePackage = function (ol) {
var selected = $('h3', ol).text();
var selected = $('li.pack > .tplshow', ol).text();
hiddenPackages[selected] = true;

$('ol.templates', ol).hide();
Expand All @@ -156,7 +211,7 @@ var Index = {};
}

ns.showPackage = function (ol, state) {
var selected = $('h3', ol).text();
var selected = $('li.pack > .tplshow', ol).text();
hiddenPackages[selected] = false;

$('ol.templates', ol).show();
Expand All @@ -166,7 +221,7 @@ var Index = {};

// When the filter is in "packs" state,
// we don't want to show the `.templates`
var key = $('h3', element).text();
var key = $('li.pack > .tplshow', element).text();
if (hiddenPackages[key] || state == 'packs') {
$('ol.templates', element).hide();
}
Expand Down Expand Up @@ -344,7 +399,7 @@ function configureFocusFilter() {
function focusFilter(package) {
scheduler.clear("filter");

var currentFocus = $('h3', package).text();
var currentFocus = $('li.pack > .tplshow', package).text();
$("#focusfilter > .focuscoll").empty();
$("#focusfilter > .focuscoll").append(currentFocus);

Expand Down

0 comments on commit 7c3ec20

Please sign in to comment.