Skip to content

Commit

Permalink
Removed [@about] from the chart match pattern in ldh:RenderRow mode
Browse files Browse the repository at this point in the history
Block's inner content is always `.row-fluid`

Fix all progress bar selectors

Attempt to fix the progress bar selector

Change `@class` value depending on `$show-row-block-controls`

Pass `$show-row-block-controls` client-side

Blocks nested within `ldh:Object` do not show their own progress bars

Hide progress bar of query blocks

Fixed XPath syntax

Only ldh:Object can nest blocks

Query/chart blocks also get progress bar <div>s
  • Loading branch information
namedgraph committed Jan 4, 2025
1 parent 0d1a9b3 commit e1534f6
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ exclude-result-prefixes="#all"

<!-- render block -->

<!-- match resources that are not LDH system resources -->
<xsl:template match="*[@typeof[not(. = ('&ldh;Object', '&ldh;View', '&ldh;GraphChart', '&ldh;ResultSetChart'))]]" mode="ldh:RenderRow" priority="1">
<xsl:apply-templates mode="#current"/>

<!-- hide the progress bar -->
<xsl:for-each select="ancestor::div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>
</xsl:template>

<xsl:template match="*" mode="ldh:RenderRow">
<xsl:apply-templates mode="#current"/>
</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ exclude-result-prefixes="#all"
</xsl:template>

<!-- render chart block -->
<xsl:template match="*[@about][@typeof = ('&ldh;ResultSetChart', '&ldh;GraphChart')][descendant::*[@property = '&spin;query'][@resource]][descendant::*[@property = '&ldh;chartType'][@resource]]" mode="ldh:RenderRow" priority="2"> <!-- prioritize above block.xsl -->
<xsl:template match="*[@typeof = ('&ldh;ResultSetChart', '&ldh;GraphChart')][descendant::*[@property = '&spin;query'][@resource]][descendant::*[@property = '&ldh;chartType'][@resource]]" mode="ldh:RenderRow" priority="2"> <!-- prioritize above block.xsl -->
<xsl:param name="block" select="ancestor-or-self::div[contains-token(@class, 'block')][1]" as="element()"/>
<xsl:param name="about" select="$block/@about" as="xs:anyURI"/>
<xsl:param name="container" select="." as="element()"/>
Expand Down Expand Up @@ -719,8 +719,8 @@ $series: <xsl:value-of select="$series"/>
<ixsl:set-style name="display" select="'none'" object="."/>
</xsl:for-each>-->

<!-- hide the progress bar -->
<xsl:for-each select="$block/ancestor::div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')]">
<!-- hide the progress bar - either of this block (if it contains a progress bar) or of the parent block -->
<xsl:for-each select="($block//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')], $block/ancestor::div[contains-token(@class, 'block')]//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')])[1]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ exclude-result-prefixes="#all"
<xsl:with-param name="mode" select="$mode"/>
<xsl:with-param name="show-edit-button" select="$show-edit-button" tunnel="yes"/>
<xsl:with-param name="object-metadata" select="$object-metadata" tunnel="yes"/>
<xsl:with-param name="show-row-block-controls" select="false()"/> <!-- blocks nested within ldh:Object do not show their own progress bars -->
</xsl:apply-templates>
</xsl:variable>

Expand Down Expand Up @@ -206,16 +207,5 @@ exclude-result-prefixes="#all"
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="*[@typeof[not(. = ('&ldh;Object', '&ldh;View', '&ldh;GraphChart', '&ldh;ResultSetChart'))]]" mode="ldh:RenderRow" priority="1">
<xsl:apply-templates mode="#current"/>

<!-- hide the progress bar -->
<xsl:for-each select="ancestor::div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ exclude-result-prefixes="#all"
</xsl:result-document>
</xsl:for-each>

<!-- hide the progress bar - either of this block (if it contains a progress bar) or of the parent block -->
<xsl:for-each select="($block//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')], $block/ancestor::div[contains-token(@class, 'block')]//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')])[1]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>

<xsl:apply-templates mode="#current"/>
</xsl:template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ exclude-result-prefixes="#all"

<xsl:template match="*[@typeof = '&ldh;View'][descendant::*[@property = '&spin;query'][@resource]]" mode="ldh:RenderRow" priority="2"> <!-- prioritize above block.xsl -->
<xsl:param name="block" select="ancestor-or-self::div[contains-token(@class, 'block')][1]" as="element()"/>
<!-- <xsl:param name="about" select="$block/@about" as="xs:anyURI"/>-->
<xsl:param name="this" select="ac:absolute-path(ldh:base-uri(.))" as="xs:anyURI"/> <!-- document URL -->
<xsl:param name="parent-about" select="$block/ancestor::*[@about][1]/@about" as="xs:anyURI"/> <!-- outer @about context -->
<xsl:param name="container" select="." as="element()"/>
<xsl:param name="graph" select="descendant::*[@property = '&ldh;graph']/@resource" as="xs:anyURI?"/>
<xsl:param name="mode" select="descendant::*[@property = '&ac;mode']/@resource" as="xs:anyURI?"/>
<xsl:param name="refresh-content" as="xs:boolean?"/>
<!-- <xsl:param name="base-uri" select="ldh:base-uri(.)" as="xs:anyURI"/>-->
<xsl:param name="query-uri" select="descendant::*[@property = '&spin;query']/@resource" as="xs:anyURI"/>

<!-- <xsl:message>ldh:View ldh:RenderBlock $about: <xsl:value-of select="$about"/></xsl:message>-->
Expand Down Expand Up @@ -715,8 +713,8 @@ exclude-result-prefixes="#all"
</xsl:call-template>
</xsl:if>

<!-- hide the progress bar -->
<xsl:for-each select="$block/ancestor::div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')]">
<!-- hide the progress bar - either of this block (if it contains a progress bar) or of the parent block -->
<xsl:for-each select="($block//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')], $block/ancestor::div[contains-token(@class, 'block')]//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')])[1]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<!ENTITY http "http://www.w3.org/2011/http#">
<!ENTITY sc "http://www.w3.org/2011/http-statusCodes#">
<!ENTITY acl "http://www.w3.org/ns/auth/acl#">
<!ENTITY sd "http://www.w3.org/ns/sparql-service-description#">
<!ENTITY sh "http://www.w3.org/ns/shacl#">
<!ENTITY sd "http://www.w3.org/ns/sparql-service-description#">
<!ENTITY ldt "https://www.w3.org/ns/ldt#">
<!ENTITY dh "https://www.w3.org/ns/ldt/document-hierarchy#">
<!ENTITY dct "http://purl.org/dc/terms/">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<!ENTITY sc "http://www.w3.org/2011/http-statusCodes#">
<!ENTITY acl "http://www.w3.org/ns/auth/acl#">
<!ENTITY cert "http://www.w3.org/ns/auth/cert#">
<!ENTITY sd "http://www.w3.org/ns/sparql-service-description#">
<!ENTITY sh "http://www.w3.org/ns/shacl#">
<!ENTITY sd "http://www.w3.org/ns/sparql-service-description#">
<!ENTITY ldt "https://www.w3.org/ns/ldt#">
<!ENTITY c "https://www.w3.org/ns/ldt/core/domain#">
<!ENTITY ct "https://www.w3.org/ns/ldt/core/templates#">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<!ENTITY acl "http://www.w3.org/ns/auth/acl#">
<!ENTITY ldt "https://www.w3.org/ns/ldt#">
<!ENTITY dh "https://www.w3.org/ns/ldt/document-hierarchy#">
<!ENTITY sd "http://www.w3.org/ns/sparql-service-description#">
<!ENTITY sh "http://www.w3.org/ns/shacl#">
<!ENTITY sd "http://www.w3.org/ns/sparql-service-description#">
<!ENTITY dct "http://purl.org/dc/terms/">
<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
<!ENTITY sioc "http://rdfs.org/sioc/ns#">
Expand Down Expand Up @@ -460,21 +460,16 @@ extension-element-prefixes="ixsl"
</xsl:template>

<!-- BLOCK -->

<xsl:template match="*[@rdf:about][rdf:type/@rdf:resource = ('&sp;Describe', '&sp;Construct', '&sp;Ask', '&sp;Select')]" mode="bs2:Row" priority="1">
<xsl:next-match>
<xsl:with-param name="class" select="'row-fluid block'"/>
</xsl:next-match>
</xsl:template>

<!-- resource block overrides -->
<xsl:template match="*[@rdf:about][rdf:type/@rdf:resource = '&ldh;Object']" mode="bs2:Row" priority="1">
<xsl:template match="*[@rdf:about][rdf:type/@rdf:resource = ('&ldh;Object', '&ldh;View', '&ldh;GraphChart', '&ldh;ResultSetChart', '&sp;Describe', '&sp;Construct', '&sp;Ask', '&sp;Select')]" mode="bs2:Row" priority="1">
<!-- TO-DO: use $ldh:requestUri to resolve URIs server-side -->
<xsl:param name="id" select="if (contains(@rdf:about, ac:absolute-path(ldh:base-uri(.)) || '#')) then substring-after(@rdf:about, ac:absolute-path(ldh:base-uri(.)) || '#') else generate-id()" as="xs:string?"/>
<xsl:param name="class" select="'row-fluid block'" as="xs:string?"/>
<xsl:param name="about" select="@rdf:about" as="xs:anyURI?"/>
<xsl:param name="typeof" select="rdf:type/@rdf:resource/xs:anyURI(.)" as="xs:anyURI*"/>
<xsl:param name="draggable" select="$acl:mode = '&acl;Write'" as="xs:boolean?"/>
<xsl:param name="show-row-block-controls" select="true()" as="xs:boolean"/>

<xsl:apply-templates select="key('resources', .)" mode="bs2:RowContentHeader"/>

Expand All @@ -498,24 +493,29 @@ extension-element-prefixes="ixsl"
<xsl:attribute name="draggable" select="'false'"/>
</xsl:if>

<div class="span12 progress progress-striped active">
<div class="row-fluid row-block-controls" style="position: relative; top: 30px; margin-top: -30px; z-index: 1;">
<div class="span12">
<xsl:if test="$acl:mode = '&acl;Write'">
<button type="button" class="btn btn-edit pull-right" style="display: none;">
<xsl:apply-templates select="key('resources', '&ac;EditMode', document(ac:document-uri('&ac;')))" mode="ac:label"/>
</button>
</xsl:if>
<div class="row-fluid">
<div style="width: 25%;" class="span12 bar"></div>
<div class="span12">
<xsl:if test="$show-row-block-controls">
<xsl:attribute name="class" select="'span12 progress progress-striped active'"/>

<div class="row-fluid row-block-controls" style="position: relative; top: 30px; margin-top: -30px; z-index: 1;">
<div class="span12">
<xsl:if test="$acl:mode = '&acl;Write'">
<button type="button" class="btn btn-edit pull-right" style="display: none;">
<xsl:apply-templates select="key('resources', '&ac;EditMode', document(ac:document-uri('&ac;')))" mode="ac:label"/>
</button>
</xsl:if>
<div class="row-fluid">
<div style="width: 25%;" class="span12 bar"></div>
</div>
</div>
</div>
</div>
</xsl:if>

<!-- client-side $container -->
<xsl:next-match>
<xsl:with-param name="id" select="()"/> <!-- only top-level blocks have @id-->
<xsl:with-param name="about" select="()"/> <!-- only top-level blocks have @about -->
<xsl:with-param name="id" select="()"/> <!-- only block <div>s have @id-->
<xsl:with-param name="about" select="()"/> <!-- only block <div>s have @about -->
<xsl:with-param name="class" select="'row-fluid'"/>
</xsl:next-match>
</div>
</div>
Expand Down

0 comments on commit e1534f6

Please sign in to comment.