summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-03-04 21:16:33 +0000
committerrandomdan <randomdan@localhost>2013-03-04 21:16:33 +0000
commit0113ece32d036b2608135e03d13e5431a25eadb2 (patch)
tree121bde87a2d4e6bd574a261aca909e1bd84dc287
parentFix spelling mistake (diff)
downloadgentoobrowse-0113ece32d036b2608135e03d13e5431a25eadb2.tar.bz2
gentoobrowse-0113ece32d036b2608135e03d13e5431a25eadb2.tar.xz
gentoobrowse-0113ece32d036b2608135e03d13e5431a25eadb2.zip
Reinstate package herd links and package tracking
Tidy up search results page
-rw-r--r--gentoobrowse/css/general.css8
-rw-r--r--gentoobrowse/js/pkgtracking.js12
-rw-r--r--gentoobrowse/xslt/package.xslt72
-rw-r--r--gentoobrowse/xslt/search.xslt69
4 files changed, 85 insertions, 76 deletions
diff --git a/gentoobrowse/css/general.css b/gentoobrowse/css/general.css
index d164659..e15e534 100644
--- a/gentoobrowse/css/general.css
+++ b/gentoobrowse/css/general.css
@@ -813,7 +813,7 @@ form.bs-docs-example {
box-shadow: inset 1px 0 0 rgba(0,0,0,.1), inset -1px 0 0 rgba(0,0,0,.1);
}
/* Chevrons */
-.bs-docs-sidenav .icon-chevron-right {
+.bs-docs-sidenav i {
float: right;
margin-top: 2px;
margin-right: -6px;
@@ -822,11 +822,11 @@ form.bs-docs-example {
.bs-docs-sidenav > li > a:hover {
background-color: #f5f5f5;
}
-.bs-docs-sidenav a:hover .icon-chevron-right {
+.bs-docs-sidenav a:hover i {
opacity: .5;
}
-.bs-docs-sidenav .active .icon-chevron-right,
-.bs-docs-sidenav .active a:hover .icon-chevron-right {
+.bs-docs-sidenav .active i
+.bs-docs-sidenav .active a:hover i {
background-image: url(../img/glyphicons-halflings-white.png);
opacity: 1;
}
diff --git a/gentoobrowse/js/pkgtracking.js b/gentoobrowse/js/pkgtracking.js
index a8d9f1b..1c171b6 100644
--- a/gentoobrowse/js/pkgtracking.js
+++ b/gentoobrowse/js/pkgtracking.js
@@ -5,8 +5,7 @@ function track(pid)
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("packageid=" + pid);
if (xmlhttp.status == 200) {
- document.getElementById("dotrack").style.display = "none";
- document.getElementById("dountrack").style.display = "inline";
+ toggleTracking();
}
}
@@ -17,7 +16,12 @@ function untrack(pid)
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("packageid=" + pid);
if (xmlhttp.status == 200) {
- document.getElementById("dountrack").style.display = "none";
- document.getElementById("dotrack").style.display = "inline";
+ toggleTracking();
}
}
+
+function toggleTracking()
+{
+ $('#dotrack').toggle();
+ $('#dountrack').toggle();
+}
diff --git a/gentoobrowse/xslt/package.xslt b/gentoobrowse/xslt/package.xslt
index 395c5ca..2dac0a6 100644
--- a/gentoobrowse/xslt/package.xslt
+++ b/gentoobrowse/xslt/package.xslt
@@ -26,6 +26,12 @@
</h1>
<p class="lead">
<xsl:value-of select="/gentoo/package/description" />
+ <xsl:if test="/gentoo/package/herd != 'no-herd' and /gentoo/package/herd != ''">
+ <small><xsl:text> </xsl:text>(<a>
+ <xsl:attribute name="href">/herd/<xsl:value-of select="/gentoo/package/herd" /></xsl:attribute>
+ <xsl:attribute name="title">Other packages in the <xsl:value-of select="/gentoo/package/herd" /> herd</xsl:attribute>
+ <xsl:value-of select="/gentoo/package/herd" /> herd</a>)</small>
+ </xsl:if>
</p>
<xsl:apply-templates select="/gentoo/package/urls" />
</xsl:template>
@@ -34,29 +40,43 @@
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav">
<xsl:if test="/gentoo/package/summary != ''">
- <li><a href="#summary"><i class="icon-chevron-right"></i>Summary</a></li>
+ <li><a href="#summary"><i class="icon-chevron-right"/>Summary</a></li>
</xsl:if>
- <li><a href="#versions"><i class="icon-chevron-right"></i>Versions</a></li>
+ <li><a href="#versions"><i class="icon-chevron-right"/>Versions</a></li>
<xsl:if test="/gentoo/package/uses/use">
- <li><a href="#uses"><i class="icon-chevron-right"></i>USE flags</a></li>
+ <li><a href="#uses"><i class="icon-chevron-right"/>USE flags</a></li>
</xsl:if>
<xsl:if test="/gentoo/package/deps/package">
- <li><a href="#deps"><i class="icon-chevron-right"></i>Dependencies</a></li>
+ <li><a href="#deps"><i class="icon-chevron-right"/>Dependencies</a></li>
</xsl:if>
<xsl:if test="/gentoo/package/rdeps/package">
- <li><a href="#rdeps"><i class="icon-chevron-right"></i>Runtime dependencies</a></li>
+ <li><a href="#rdeps"><i class="icon-chevron-right"/>Runtime dependencies</a></li>
</xsl:if>
<xsl:if test="/gentoo/package/depees/package">
- <li><a href="#depees"><i class="icon-chevron-right"></i>Depending packages</a></li>
+ <li><a href="#depees"><i class="icon-chevron-right"/>Depending packages</a></li>
</xsl:if>
<xsl:if test="/gentoo/package/packageBugs/bug">
- <li><a href="#bugs"><i class="icon-chevron-right"></i>Open bugs</a></li>
+ <li><a href="#bugs"><i class="icon-chevron-right"/>Open bugs</a></li>
</xsl:if>
<xsl:if test="/gentoo/package/maskdetails/mask">
- <li><a href="#masks"><i class="icon-chevron-right"></i>Masks</a></li>
+ <li><a href="#masks"><i class="icon-chevron-right"/>Masks</a></li>
</xsl:if>
<xsl:if test="/gentoo/package/changelog/entry">
- <li><a href="#changelog"><i class="icon-chevron-right"></i>Change log</a></li>
+ <li><a href="#changelog"><i class="icon-chevron-right"/>Change log</a></li>
+ </xsl:if>
+ <xsl:if test="/gentoo/project2:session/loggedInUserID">
+ <li>
+ <a id="dotrack">
+ <xsl:attribute name="href">javascript:track(<xsl:value-of select="/gentoo/package/packageid" />);</xsl:attribute>
+ <xsl:if test="count(/gentoo/package/tracks/track) = 1">
+ <xsl:attribute name="style">display: none</xsl:attribute>
+ </xsl:if><i class="icon-eye-close"/>Follow</a>
+ <a id="dountrack">
+ <xsl:attribute name="href">javascript:untrack(<xsl:value-of select="/gentoo/package/packageid" />);</xsl:attribute>
+ <xsl:if test="count(/gentoo/package/tracks/track) = 0">
+ <xsl:attribute name="style">display: none</xsl:attribute>
+ </xsl:if><i class="icon-eye-open"/>Unfollow</a>
+ </li>
</xsl:if>
</ul>
</div>
@@ -71,40 +91,6 @@
<xsl:apply-templates select="package/maskdetails" />
<xsl:apply-templates select="package/changelog" />
</div>
- <!--
- <xsl:apply-templates select="packageUrls" />
- <section id="pkgsummary">
- <h2>
- <xsl:if test="herd != 'no-herd' and herd != ''">
- <small><xsl:text> </xsl:text>(<a>
- <xsl:attribute name="href">/herd/<xsl:value-of select="herd" /></xsl:attribute>
- <xsl:attribute name="title">Other packages in the <xsl:value-of select="herd" /> herd</xsl:attribute>
- <xsl:value-of select="herd" />
- </a>)</small>
- </xsl:if>
- <xsl:if test="count(/gentoo/project2:session/loggedInUserID) != 0">
- <a id="dotrack">
- <xsl:attribute name="href">javascript:track(<xsl:value-of select="/gentoo/summary/package/packageid" />);</xsl:attribute>
- <xsl:if test="count(tracks/track) = 1">
- <xsl:attribute name="style">display: none</xsl:attribute>
- </xsl:if>(Track)</a>
- <a id="dountrack">
- <xsl:attribute name="href">javascript:untrack(<xsl:value-of select="/gentoo/summary/package/packageid" />);</xsl:attribute>
- <xsl:if test="count(tracks/track) = 0">
- <xsl:attribute name="style">display: none</xsl:attribute>
- </xsl:if>(Untrack)</a>
- </xsl:if>
- </h2>
- <h3>
- <xsl:value-of select="description" />
- </h3>
- <xsl:if test="summary != description and summary != ''">
- <p class="summary">
- <xsl:value-of select="summary" />
- </p>
- </xsl:if>
- </section>
- -->
</xsl:template>
<!-- Package URLs -->
diff --git a/gentoobrowse/xslt/search.xslt b/gentoobrowse/xslt/search.xslt
index 5ae949a..644a906 100644
--- a/gentoobrowse/xslt/search.xslt
+++ b/gentoobrowse/xslt/search.xslt
@@ -9,7 +9,7 @@
</xsl:template>
<xsl:template name="header">
- <h1>Search results for &quot;<xsl:value-of select="/gentoo/project2:params/criteria"/>&quot;</h1>
+ <h1>Search results</h1>
<p class="lead">
<xsl:value-of select="count(/gentoo/searchResults/package)" /> packages,
<xsl:value-of select="count(/gentoo/bugSearchResults/bug)" /> bugs
@@ -19,37 +19,56 @@
<xsl:template name="content">
<div class="span3 bs-docs-sidebar">
- <ul class="nav nav-list bs-docs-sidenav">
- <li><a href="#packages"><i class="icon-chevron-right"></i>Packages</a></li>
- <li><a href="#bugs"><i class="icon-chevron-right"></i>Bugs</a></li>
- </ul>
+ <xsl:if test="/gentoo/searchResults|bugSearchResults/*">
+ <ul class="nav nav-list bs-docs-sidenav">
+ <xsl:if test="/gentoo/searchResults/*">
+ <li><a href="#packages"><i class="icon-chevron-right"></i>Packages</a></li>
+ </xsl:if>
+ <xsl:if test="/gentoo/bugSearchResults/*">
+ <li><a href="#bugs"><i class="icon-chevron-right"></i>Bugs</a></li>
+ </xsl:if>
+ </ul>
+ </xsl:if>
</div>
<div class="span9">
- <xsl:apply-templates select="/gentoo/searchResults" />
- <xsl:apply-templates select="/gentoo/bugSearchResults" />
+ <xsl:if test="/gentoo/searchResults/*|/gentoo/bugSearchResults/*">
+ <xsl:apply-templates select="/gentoo/searchResults" />
+ <xsl:apply-templates select="/gentoo/bugSearchResults" />
+ </xsl:if>
+ <xsl:if test="not(/gentoo/searchResults/*|/gentoo/bugSearchResults/*)">
+ <section id="nothing">
+ <h2 class="page-header">Sorry</h2>
+ <p class="text-warning">Nothing found matching your search terms.</p>
+ </section>
+ </xsl:if>
</div>
</xsl:template>
<xsl:template match="/gentoo/searchResults">
- <section id="packages">
- <h2 class="page-header">Packages</h2>
- <xsl:apply-templates select="package" />
- </section>
+ <xsl:if test="/gentoo/searchResults/*">
+ <section id="packages">
+ <h2 class="page-header">Packages</h2>
+ <xsl:apply-templates select="package" />
+ </section>
+ </xsl:if>
</xsl:template>
+
<xsl:template match="/gentoo/bugSearchResults">
- <section id="bugs">
- <h2 class="page-header">Bugs</h2>
- <xsl:for-each select="bug">
- <p>
- <a>
- <xsl:attribute name="href">http://bugs.gentoo.org/<xsl:value-of select="bugid" /></xsl:attribute>
- <xsl:attribute name="title"><xsl:value-of select="summary" /></xsl:attribute>
- <xsl:value-of select="bugid" />
- </a>
- :
- <xsl:value-of select="summary" />
- </p>
- </xsl:for-each>
- </section>
+ <xsl:if test="/gentoo/bugSearchResults/*">
+ <section id="bugs">
+ <h2 class="page-header">Bugs</h2>
+ <xsl:for-each select="bug">
+ <p>
+ <a>
+ <xsl:attribute name="href">http://bugs.gentoo.org/<xsl:value-of select="bugid" /></xsl:attribute>
+ <xsl:attribute name="title"><xsl:value-of select="summary" /></xsl:attribute>
+ <xsl:value-of select="bugid" />
+ </a>
+ :
+ <xsl:value-of select="summary" />
+ </p>
+ </xsl:for-each>
+ </section>
+ </xsl:if>
</xsl:template>
</xsl:stylesheet>