summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-02-05 18:08:30 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-02-05 18:08:30 +0000
commite924e6a691a454ae8ed3ae9df178ebaccdf3cef1 (patch)
tree52df3221c235ae471edebcf22c05af26fdc4c87e
parentHome page ebuilds should be grouped by firstseen, not moddate (diff)
downloadgentoobrowse-2.0.0_beta6.tar.bz2
gentoobrowse-2.0.0_beta6.tar.xz
gentoobrowse-2.0.0_beta6.zip
Add use group pages and update links on package pagegentoobrowse-2.0.0_beta6
-rw-r--r--gentoobrowse/src/mash.ice11
-rw-r--r--gentoobrowse/src/test.cpp16
-rw-r--r--gentoobrowse/src/use.json39
-rw-r--r--gentoobrowse/xslt/package.xslt29
-rw-r--r--gentoobrowse/xslt/use.xslt3
-rw-r--r--gentoobrowse/xslt/usegroup-detail.xslt36
-rw-r--r--gentoobrowse/xslt/usegroup.xslt57
7 files changed, 179 insertions, 12 deletions
diff --git a/gentoobrowse/src/mash.ice b/gentoobrowse/src/mash.ice
index ff3f5f9..40680fa 100644
--- a/gentoobrowse/src/mash.ice
+++ b/gentoobrowse/src/mash.ice
@@ -106,4 +106,15 @@ module GentooBrowse {
class UseIndex extends PageBase {
Gentoo::Uses uses;
};
+
+ ["slicer:root:gentoo"]
+ class UseGroup extends PageBase {
+ Gentoo::Uses uses;
+ string group;
+ };
+
+ ["slicer:root:gentoo"]
+ class UseGroupIndex extends PageBase {
+ Gentoo::StringList groups;
+ };
};
diff --git a/gentoobrowse/src/test.cpp b/gentoobrowse/src/test.cpp
index a3fff0e..79d3d42 100644
--- a/gentoobrowse/src/test.cpp
+++ b/gentoobrowse/src/test.cpp
@@ -111,7 +111,7 @@ BOOST_FIXTURE_TEST_SUITE(ta, CoreWithDefaultRouter);
BOOST_AUTO_TEST_CASE( endpointCount )
{
- BOOST_REQUIRE_EQUAL(22, AdHoc::PluginManager::getDefault()->getAll<IceSpider::RouteHandlerFactory>().size());
+ BOOST_REQUIRE_EQUAL(24, AdHoc::PluginManager::getDefault()->getAll<IceSpider::RouteHandlerFactory>().size());
BOOST_REQUIRE_EQUAL(5, routes.size());
}
@@ -206,6 +206,20 @@ BOOST_AUTO_TEST_CASE( use_404 )
request.standardAssertions(typeid(this).name());
}
+BOOST_AUTO_TEST_CASE( usegroup )
+{
+ ChromiumRequestHtml request(this, HttpMethod::GET, "/usegroup");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( usegroup_gles )
+{
+ ChromiumRequestHtml request(this, HttpMethod::GET, "/usegroup/i18n");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
BOOST_AUTO_TEST_CASE( search_default )
{
ChromiumRequestHtml request(this, HttpMethod::GET, "/search");
diff --git a/gentoobrowse/src/use.json b/gentoobrowse/src/use.json
index a0bd57d..02ec208 100644
--- a/gentoobrowse/src/use.json
+++ b/gentoobrowse/src/use.json
@@ -44,6 +44,45 @@
}
},
"type": "GentooBrowse.Use"
+ },
+ "useGroupIndex": {
+ "path": "/usegroup",
+ "bases": [ "common" ],
+ "mutators": [ "addUser" ],
+ "outputSerializers": {
+ "text/html": {
+ "serializer": "IceSpider.XsltStreamSerializer",
+ "params": [ "\"xslt/usegroup.xslt\"" ]
+ }
+ },
+ "operations": {
+ "groups": {
+ "operation": "Gentoo.Portage.getUseGroups"
+ }
+ },
+ "type": "GentooBrowse.UseGroupIndex"
+ },
+ "useGroupDetail": {
+ "path": "/usegroup/{group}",
+ "bases": [ "common" ],
+ "mutators": [ "addUser" ],
+ "outputSerializers": {
+ "text/html": {
+ "serializer": "IceSpider.XsltStreamSerializer",
+ "params": [ "\"xslt/usegroup-detail.xslt\"" ]
+ }
+ },
+ "operations": {
+ "uses": {
+ "operation": "Gentoo.Portage.getGroupUses"
+ }
+ },
+ "params": {
+ "group": {
+ "source": "URL"
+ }
+ },
+ "type": "GentooBrowse.UseGroup"
}
},
"slices": [
diff --git a/gentoobrowse/xslt/package.xslt b/gentoobrowse/xslt/package.xslt
index 287ede2..e6de8f0 100644
--- a/gentoobrowse/xslt/package.xslt
+++ b/gentoobrowse/xslt/package.xslt
@@ -138,7 +138,10 @@
</xsl:if>
<xsl:for-each select="use[group != preceding-sibling::use[1]/group or not(preceding-sibling::use[1]/group)]/group">
<h3>
- <xsl:value-of select="." />
+ <a>
+ <xsl:attribute name="href">/usegroup/<xsl:value-of select="." /></xsl:attribute>
+ <xsl:value-of select="." />
+ </a>
</h3>
<dl class="dl-horizontal">
<xsl:apply-templates select="../../use[group = current()]" />
@@ -149,20 +152,24 @@
</xsl:template>
<xsl:template match="/gentoo/uses/use">
<dt>
- <a>
- <xsl:attribute name="href">
- <xsl:text>/use/</xsl:text>
- <xsl:if test="group">
- <xsl:value-of select="group" />
- <xsl:text>_</xsl:text>
- </xsl:if>
- <xsl:value-of select="use" />
- </xsl:attribute>
+ <xsl:if test="group">
<xsl:if test="packageid">
<xsl:attribute name="class">local</xsl:attribute>
</xsl:if>
<xsl:value-of select="use" />
- </a>
+ </xsl:if>
+ <xsl:if test="not(group)">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>/use/</xsl:text>
+ <xsl:value-of select="use" />
+ </xsl:attribute>
+ <xsl:if test="packageid">
+ <xsl:attribute name="class">local</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="use" />
+ </a>
+ </xsl:if>
</dt>
<dd>
<xsl:value-of select="description" />
diff --git a/gentoobrowse/xslt/use.xslt b/gentoobrowse/xslt/use.xslt
index 3b148a2..8c8509d 100644
--- a/gentoobrowse/xslt/use.xslt
+++ b/gentoobrowse/xslt/use.xslt
@@ -20,6 +20,9 @@
<xsl:variable name="firsts" select="use[substring(use, 1, 1) != substring(preceding-sibling::use[1]/use, 1, 1)]" />
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav">
+ <li>
+ <a href="/usegroup"><i class="icon-chevron-right">&#160;</i> Groups</a>
+ </li>
<xsl:for-each select="$firsts">
<xsl:variable name="char" select="substring(use, 1, 1)" />
<li>
diff --git a/gentoobrowse/xslt/usegroup-detail.xslt b/gentoobrowse/xslt/usegroup-detail.xslt
new file mode 100644
index 0000000..af71785
--- /dev/null
+++ b/gentoobrowse/xslt/usegroup-detail.xslt
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:import href="base.xslt" />
+ <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" />
+
+ <xsl:template name="head">
+ <title><xsl:value-of select="/gentoo/group" /> options &#183; Gentoo Browse</title>
+ <meta name="description"><xsl:value-of select="/gentoo/group" /> options</meta>
+ </xsl:template>
+
+ <xsl:template name="header">
+ <h1><xsl:value-of select="/gentoo/group" /> options</h1>
+ </xsl:template>
+
+ <xsl:template name="content">
+ <xsl:apply-templates select="/gentoo/uses" />
+ </xsl:template>
+
+ <xsl:template match="/gentoo/uses">
+ <div class="span3 bs-docs-sidebar">
+ </div>
+ <div class="span9">
+ <dl class="dl-horizontal">
+ <xsl:for-each select="use">
+ <dt>
+ <xsl:value-of select="use" />
+ </dt>
+ <dd>
+ <xsl:value-of select="description" />
+ </dd>
+ </xsl:for-each>
+ </dl>
+ </div>
+ </xsl:template>
+</xsl:stylesheet>
+
diff --git a/gentoobrowse/xslt/usegroup.xslt b/gentoobrowse/xslt/usegroup.xslt
new file mode 100644
index 0000000..9afafec
--- /dev/null
+++ b/gentoobrowse/xslt/usegroup.xslt
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:import href="base.xslt" />
+ <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" />
+
+ <xsl:template name="head">
+ <title>Use group index &#183; Gentoo Browse</title>
+ <meta name="description">Use group index</meta>
+ </xsl:template>
+
+ <xsl:template name="header">
+ <h1>Use group index</h1>
+ </xsl:template>
+
+ <xsl:template name="content">
+ <xsl:apply-templates select="/gentoo/groups" />
+ </xsl:template>
+
+ <xsl:template match="/gentoo/groups">
+ <xsl:variable name="firsts" select="element[substring(., 1, 1) != substring(preceding-sibling::element[1], 1, 1)]" />
+ <div class="span3 bs-docs-sidebar">
+ <ul class="nav nav-list bs-docs-sidenav">
+ <xsl:for-each select="$firsts">
+ <xsl:variable name="char" select="substring(., 1, 1)" />
+ <li>
+ <a>
+ <xsl:attribute name="href">#<xsl:value-of select="$char" /></xsl:attribute>
+ <i class="icon-chevron-right">&#160;</i> <xsl:value-of select="$char" />
+ </a>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </div>
+ <div class="span9">
+ <xsl:for-each select="$firsts">
+ <xsl:variable name="char" select="substring(., 1, 1)" />
+ <section>
+ <xsl:attribute name="id"><xsl:value-of select="$char" /></xsl:attribute>
+ <h2 class="page-header">
+ <xsl:value-of select="$char" />
+ </h2>
+ <ul>
+ <xsl:for-each select="../element[substring(., 1, 1) = $char]">
+ <li>
+ <a>
+ <xsl:attribute name="href">/usegroup/<xsl:value-of select="." /></xsl:attribute>
+ <xsl:value-of select="." />
+ </a>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </section>
+ </xsl:for-each>
+ </div>
+ </xsl:template>
+</xsl:stylesheet>
+