Skip to content

Commit

Permalink
Attempt to reuse .add-constructor handling from form.xsl for `ldh…
Browse files Browse the repository at this point in the history
…:XHTML` as we;;
  • Loading branch information
namedgraph committed May 26, 2024
1 parent 89ed298 commit 2b20da4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,6 @@ exclude-result-prefixes="#all"
</xsl:next-match>
</xsl:template>

<!-- make sure block value input is shown as required without loading $constraints (workaround for better performance) -->
<!--
<xsl:template match="*[rdf:type/@rdf:resource = '&ldh;View']/spin:query | *[rdf:type/@rdf:resource = ('&ldh;XHTML', '&ldh;Object')]/rdf:value" mode="bs2:FormControl">
<xsl:next-match>
<xsl:with-param name="label" select="ac:property-label(.)"/>
<xsl:with-param name="required" select="true()"/>
</xsl:next-match>
</xsl:template>
-->

<xsl:template match="*[rdf:type/@rdf:resource = '&ldh;XHTML']/rdf:value/xhtml:*" mode="bs2:FormControlTypeLabel" priority="1"/>

<!-- VIEW -->
Expand Down Expand Up @@ -1111,7 +1101,7 @@ exclude-result-prefixes="#all"
</xsl:template>

<!-- appends new XHTML block to the content list -->
<xsl:template match="div[contains-token(@class, 'row-fluid')]//button[contains-token(@class, 'add-constructor')][@data-for-class = '&ldh;XHTML']" mode="ixsl:onclick" priority="2"> <!-- prioritize over form.xsl -->
<xsl:template match="div[contains-token(@class, 'row-fluid')]//button[contains-token(@class, 'add-constructor')][@data-for-class = '&ldh;XHTMLAS']" mode="ixsl:onclick" priority="2"> <!-- prioritize over form.xsl -->
<xsl:variable name="container" select="ancestor::div[contains-token(@class, 'row-fluid')]" as="element()"/>
<!-- TO-DO: reuse identical constructor from form.xsl -->
<xsl:variable name="constructor" as="document-node()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ WHERE
<xsl:with-param name="about" select="()"/> <!-- don't set @about on the container until after the resource is saved -->
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="action" select="ldh:href($ldt:base, ac:absolute-path(ldh:base-uri(.)), map{}, $doc-uri)" as="xs:anyURI"/>
<xsl:with-param name="classes" select="$classes"/>
<xsl:with-param name="classes" select="$classes"/> <!-- TO-DO: unused? -->
<xsl:with-param name="type-metadata" select="$type-metadata" tunnel="yes"/>
<xsl:with-param name="property-metadata" select="$property-metadata" tunnel="yes"/>
<xsl:with-param name="constraints" select="$constraints" tunnel="yes"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,6 @@ exclude-result-prefixes="#all"
<xsl:message>
$type-shapes: <xsl:copy-of select="serialize($type-shapes)"/>
</xsl:message>
<xsl:message>
Property-level $constructor: <xsl:copy-of select="serialize($constructor)"/>
</xsl:message>

<div>
<xsl:if test="$class">
Expand Down Expand Up @@ -768,8 +765,7 @@ exclude-result-prefixes="#all"
<xsl:param name="constructor" as="document-node()?"/>
<xsl:param name="object-metadata" as="document-node()?" tunnel="yes"/>
<xsl:param name="forClass" select="if ($constructor) then distinct-values(key('resources', key('resources-by-type', ../../rdf:type/@rdf:resource, $constructor)/*[concat(namespace-uri(), local-name()) = current()/../concat(namespace-uri(), local-name())]/@rdf:nodeID, $constructor)/rdf:type/@rdf:resource[not(. = '&rdfs;Class')]) else ()" as="xs:anyURI*"/>
<xsl:message><xsl:value-of select="."/> bs2:FormControl exists($constructor): <xsl:value-of select="exists($constructor)"/> $forClass: <xsl:value-of select="$forClass"/></xsl:message>


<xsl:choose>
<xsl:when test="$type = 'hidden'">
<xsl:apply-templates select="." mode="xhtml:Input">
Expand Down

0 comments on commit 2b20da4

Please sign in to comment.