Skip to content

Commit 0b6a88c

Browse files
committed
ldh:LeftSidebar initialization
1 parent 98a8c72 commit 0b6a88c

File tree

4 files changed

+40
-43
lines changed

4 files changed

+40
-43
lines changed

src/main/webapp/static/com/atomgraph/linkeddatahub/css/bootstrap.css

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/navigation.xsl

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ LIMIT 10
5858

5959
<!-- TEMPLATES -->
6060

61-
<xsl:template name="ldh:DocTree">
61+
<xsl:template name="ldh:LeftSidebar">
6262
<xsl:param name="base" select="ldt:base()" as="xs:anyURI"/>
6363

6464
<h2 class="nav-header btn">
@@ -100,6 +100,10 @@ LIMIT 10
100100
<xsl:template name="ldh:DocTreeActivateHref">
101101
<xsl:context-item as="element()" use="required"/> <!-- document tree container -->
102102
<xsl:param name="href" as="xs:anyURI"/>
103+
104+
<xsl:message>
105+
ldh:DocTreeActivateHref $href: <xsl:value-of select="$href"/>
106+
</xsl:message>
103107

104108
<!-- make the previously active list items inactive -->
105109
<xsl:for-each select=".//li[contains-token(@class, 'active')]">
@@ -111,12 +115,12 @@ LIMIT 10
111115
</xsl:for-each>
112116
</xsl:template>
113117

114-
<!-- Update both doc-tree and class-list after navigation -->
118+
<!-- Update both left-sidebar and class-list after navigation -->
115119
<xsl:template name="ldh:NavigationUpdate">
116120
<xsl:param name="href" as="xs:anyURI"/>
117121

118122
<!-- activate the current URL in the document tree -->
119-
<xsl:for-each select="id('doc-tree', ixsl:page())">
123+
<xsl:for-each select="id('left-sidebar', ixsl:page())">
120124
<xsl:call-template name="ldh:DocTreeActivateHref">
121125
<xsl:with-param name="href" select="$href"/>
122126
</xsl:call-template>
@@ -175,7 +179,7 @@ LIMIT 10
175179
<ixsl:promise select="ixsl:http-request($context('request')) =>
176180
ixsl:then(ldh:rethread-response($context, ?)) =>
177181
ixsl:then(ldh:handle-response#1) =>
178-
ixsl:then(ldh:doc-tree-resource-response#1)"
182+
ixsl:then(ldh:left-sidebar-resource-response#1)"
179183
on-failure="ldh:promise-failure#1"/>
180184
</xsl:template>
181185

@@ -199,18 +203,18 @@ LIMIT 10
199203

200204
<!-- show left-side document tree -->
201205

202-
<xsl:template match="body[id('doc-tree', ixsl:page())]" mode="ixsl:onmousemove">
206+
<xsl:template match="body[id('left-sidebar', ixsl:page())]" mode="ixsl:onmousemove">
203207
<xsl:variable name="x" select="ixsl:get(ixsl:event(), 'clientX')"/>
204208

205209
<!-- check that the mouse is on the left edge -->
206210
<xsl:if test="$x = 0">
207-
<!-- show #doc-tree -->
208-
<ixsl:set-style name="display" select="'block'" object="id('doc-tree', ixsl:page())"/>
211+
<!-- show #left-sidebar -->
212+
<ixsl:set-style name="display" select="'block'" object="id('left-sidebar', ixsl:page())"/>
209213
</xsl:if>
210214
</xsl:template>
211215

212216
<!-- hide the document tree container if its position is fixed (i.e. the layout is not responsive) -->
213-
<xsl:template match="div[@id = 'doc-tree'][ixsl:style(.)?position = 'fixed']" mode="ixsl:onmouseout">
217+
<xsl:template match="div[@id = 'left-sidebar'][ixsl:style(.)?position = 'fixed']" mode="ixsl:onmouseout">
214218
<xsl:variable name="related-target" select="ixsl:get(ixsl:event(), 'relatedTarget')" as="element()?"/> <!-- the element mouse entered -->
215219

216220
<!-- only hide if the related target does not have this div as ancestor (is not its child) -->
@@ -219,10 +223,10 @@ LIMIT 10
219223
</xsl:if>
220224
</xsl:template>
221225

222-
<xsl:template match="div[@id = 'doc-tree']//li/a[@href]" mode="ixsl:onclick" priority="1">
226+
<xsl:template match="div[@id = 'left-sidebar']//li/a[@href]" mode="ixsl:onclick" priority="1">
223227
<xsl:variable name="href" select="@href" as="xs:anyURI"/>
224228

225-
<xsl:for-each select="ancestor::div[@id = 'doc-tree']">
229+
<xsl:for-each select="ancestor::div[@id = 'left-sidebar']">
226230
<xsl:call-template name="ldh:DocTreeActivateHref">
227231
<xsl:with-param name="href" select="$href"/>
228232
</xsl:call-template>
@@ -383,13 +387,13 @@ LIMIT 10
383387
<xsl:sequence select="$context"/>
384388
</xsl:function>
385389

386-
<xsl:function name="ldh:doc-tree-resource-response" as="map(*)" ixsl:updating="yes">
390+
<xsl:function name="ldh:left-sidebar-resource-response" as="map(*)" ixsl:updating="yes">
387391
<xsl:param name="context" as="map(*)"/>
388392
<xsl:variable name="response" select="$context('response')" as="map(*)"/>
389393
<xsl:variable name="container" select="$context('container')" as="element()"/> <!-- <ul> element -->
390394
<xsl:variable name="uri" select="$context('uri')" as="xs:anyURI"/>
391395

392-
<xsl:message>ldh:doc-tree-resource-response</xsl:message>
396+
<xsl:message>ldh:left-sidebar-resource-response</xsl:message>
393397

394398
<xsl:for-each select="$response">
395399
<xsl:choose>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/layout.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ exclude-result-prefixes="#all">
12771277
<!-- DOCUMENT TREE -->
12781278

12791279
<xsl:template match="rdf:RDF | srx:sparql" mode="bs2:DocumentTree">
1280-
<xsl:param name="id" select="'doc-tree'" as="xs:string?"/>
1280+
<xsl:param name="id" select="'left-sidebar'" as="xs:string?"/>
12811281
<xsl:param name="class" select="'well well-small sidebar-nav'" as="xs:string?"/>
12821282

12831283
<div>
@@ -1288,7 +1288,7 @@ exclude-result-prefixes="#all">
12881288
<xsl:attribute name="class" select="$class"/>
12891289
</xsl:if>
12901290

1291-
<!-- placeholder for client-side ldh:DocTree template -->
1291+
<!-- placeholder for client-side ldh:LeftSidebar template -->
12921292
</div>
12931293
</xsl:template>
12941294

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/client.xsl

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -323,23 +323,15 @@ WHERE
323323
<xsl:with-param name="apps" select="$ldh:apps"/>
324324
</xsl:call-template>
325325
</xsl:for-each>
326-
<!-- initialize document tree -->
327-
<xsl:for-each select="id('doc-tree', ixsl:page())">
326+
<!-- initialize navigation (e.g. the left sidebar) -->
327+
<xsl:for-each select="id('left-sidebar', ixsl:page())">
328328
<xsl:result-document href="?." method="ixsl:replace-content">
329-
<xsl:call-template name="ldh:DocTree"/>
329+
<xsl:call-template name="ldh:LeftSidebar"/>
330330
</xsl:result-document>
331-
<xsl:call-template name="ldh:DocTreeActivateHref">
332-
<xsl:with-param name="href" select="ldt:base()"/>
333-
</xsl:call-template>
334-
</xsl:for-each>
335-
336-
<!-- load class list -->
337-
<xsl:for-each select="id('class-list', ixsl:page())">
338-
<xsl:call-template name="ldh:ClassListLoad">
339-
<xsl:with-param name="container" select="."/>
340-
<xsl:with-param name="endpoint" select="sd:endpoint()"/>
341-
</xsl:call-template>
342331
</xsl:for-each>
332+
<xsl:call-template name="ldh:NavigationUpdate">
333+
<xsl:with-param name="href" select="base-uri(ixsl:page())"/>
334+
</xsl:call-template>
343335
</xsl:otherwise>
344336
</xsl:choose>
345337
</xsl:template>
@@ -759,7 +751,7 @@ WHERE
759751
<xsl:when test="starts-with(?media-type, 'application/xhtml+xml')">
760752
<xsl:variable name="endpoint-link" select="tokenize(?headers?link, ',')[contains(., '&sd;endpoint')]" as="xs:string?"/>
761753
<xsl:variable name="endpoint" select="if ($endpoint-link) then xs:anyURI(substring-before(substring-after(substring-before($endpoint-link, ';'), '&lt;'), '&gt;')) else ()" as="xs:anyURI?"/>
762-
<xsl:variable name="base" select="lapp:origin($href)" as="xs:anyURI"/>
754+
<xsl:variable name="base" select="xs:anyURI(lapp:origin($href) || '/')" as="xs:anyURI"/>
763755
<!-- set new base URI if the current app has changed -->
764756
<xsl:if test="not($base = ldt:base())">
765757
<xsl:message>Application change. Base URI: <xsl:value-of select="$base"/></xsl:message>
@@ -850,7 +842,8 @@ WHERE
850842
</xsl:call-template>
851843
</xsl:if>
852844

853-
<xsl:call-template name="ldh:PostHTMLDocumentLoad">
845+
<!-- update the sidebar -->
846+
<xsl:call-template name="ldh:NavigationUpdate">
854847
<xsl:with-param name="href" select="$href"/>
855848
</xsl:call-template>
856849

@@ -862,21 +855,21 @@ WHERE
862855

863856
<!-- post-HTML load hook, mainly for navigation updates -->
864857

865-
<xsl:template name="ldh:PostHTMLDocumentLoad">
866-
<xsl:param name="href" as="xs:anyURI"/> <!-- possibly proxied URL -->
858+
<!-- <xsl:template name="ldh:PostHTMLDocumentLoad">
859+
<xsl:param name="href" as="xs:anyURI"/> possibly proxied URL
867860
868-
<!-- update both doc-tree and class-list -->
861+
update the sidebar
869862
<xsl:call-template name="ldh:NavigationUpdate">
870863
<xsl:with-param name="href" select="$href"/>
871864
</xsl:call-template>
872-
</xsl:template>
865+
</xsl:template>-->
873866

874867
<xsl:template name="ldt:AppChanged">
875868
<xsl:param name="base" as="xs:anyURI"/>
876869

877-
<xsl:for-each select="id('doc-tree', ixsl:page())">
870+
<xsl:for-each select="id('left-sidebar', ixsl:page())">
878871
<xsl:result-document href="?." method="ixsl:replace-content">
879-
<xsl:call-template name="ldh:DocTree">
872+
<xsl:call-template name="ldh:LeftSidebar">
880873
<xsl:with-param name="base" select="$base"/>
881874
</xsl:call-template>
882875
</xsl:result-document>

0 commit comments

Comments
 (0)