Skip to content

Commit 5a8b34c

Browse files
committed
Fixed template matches
1 parent 4d0cb94 commit 5a8b34c

4 files changed

Lines changed: 202 additions & 539 deletions

File tree

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

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,28 +151,31 @@ exclude-result-prefixes="#all"
151151

152152
<!-- show block controls -->
153153

154-
<xsl:template match="div[contains-token(@class, 'block')][key('elements-by-class', 'row-block-controls', .)][acl:mode() = '&acl;Write']" mode="ixsl:onmousemove"> <!-- TO-DO: better selector -->
155-
<xsl:variable name="dom-x" select="ixsl:get(ixsl:event(), 'clientX')" as="xs:double"/>
156-
<xsl:variable name="dom-y" select="ixsl:get(ixsl:event(), 'clientY')" as="xs:double"/>
157-
<xsl:variable name="rect" select="ixsl:call(., 'getBoundingClientRect', [])"/>
158-
<xsl:variable name="offset-x" select="$dom-x - ixsl:get($rect, 'x')" as="xs:double"/>
159-
<xsl:variable name="offset-y" select="$dom-y - ixsl:get($rect, 'y')" as="xs:double"/>
160-
<xsl:variable name="width" select="ixsl:get($rect, 'width')" as="xs:double"/>
161-
<xsl:variable name="offset-x-treshold" select="120" as="xs:double"/>
162-
<xsl:variable name="offset-y-treshold" select="20" as="xs:double"/>
163-
154+
<xsl:template match="div[contains-token(@class, 'block')][key('elements-by-class', 'row-block-controls', .)][acl:mode() = '&acl;Write']" mode="ixsl:onmousemove"> <!-- TO-DO: better selector -->
164155
<!-- there might be multiple .row-block-controls in a block if the main block is followed by blocks rendered from ldh:block -->
165156
<xsl:variable name="row-block-controls" select="key('elements-by-class', 'row-block-controls', .)[1]" as="element()"/>
166-
<xsl:variable name="btn-edit" select="key('elements-by-class', 'btn-edit', $row-block-controls)" as="element()"/>
167-
<!-- check that the mouse is on the top edge and show the block controls if they're not already shown -->
168-
<xsl:if test="$offset-x &gt;= $width - $offset-x-treshold and $offset-y &lt;= $offset-y-treshold and ixsl:style($row-block-controls)?z-index = '-1'">
169-
<ixsl:set-style name="z-index" select="'1'" object="$row-block-controls"/>
170-
<ixsl:set-style name="display" select="'block'" object="$btn-edit"/>
171-
</xsl:if>
172-
<!-- check that the mouse is outside the top edge and hide the block controls if they're not already hidden -->
173-
<xsl:if test="$offset-x &lt; $width - $offset-x-treshold and $offset-y &gt; $offset-y-treshold and ixsl:style($row-block-controls)?z-index = '1'">
174-
<ixsl:set-style name="z-index" select="'-1'" object="$row-block-controls"/>
175-
<ixsl:set-style name="display" select="'none'" object="$btn-edit"/>
157+
<xsl:variable name="btn-edit" select="key('elements-by-class', 'btn-edit', $row-block-controls)" as="element()?"/>
158+
159+
<xsl:if test="$btn-edit">
160+
<xsl:variable name="dom-x" select="ixsl:get(ixsl:event(), 'clientX')" as="xs:double"/>
161+
<xsl:variable name="dom-y" select="ixsl:get(ixsl:event(), 'clientY')" as="xs:double"/>
162+
<xsl:variable name="rect" select="ixsl:call(., 'getBoundingClientRect', [])"/>
163+
<xsl:variable name="offset-x" select="$dom-x - ixsl:get($rect, 'x')" as="xs:double"/>
164+
<xsl:variable name="offset-y" select="$dom-y - ixsl:get($rect, 'y')" as="xs:double"/>
165+
<xsl:variable name="width" select="ixsl:get($rect, 'width')" as="xs:double"/>
166+
<xsl:variable name="offset-x-treshold" select="120" as="xs:double"/>
167+
<xsl:variable name="offset-y-treshold" select="20" as="xs:double"/>
168+
169+
<!-- check that the mouse is on the top edge and show the block controls if they're not already shown -->
170+
<xsl:if test="$offset-x &gt;= $width - $offset-x-treshold and $offset-y &lt;= $offset-y-treshold and ixsl:style($row-block-controls)?z-index = '-1'">
171+
<ixsl:set-style name="z-index" select="'1'" object="$row-block-controls"/>
172+
<ixsl:set-style name="display" select="'block'" object="$btn-edit"/>
173+
</xsl:if>
174+
<!-- check that the mouse is outside the top edge and hide the block controls if they're not already hidden -->
175+
<xsl:if test="$offset-x &lt; $width - $offset-x-treshold and $offset-y &gt; $offset-y-treshold and ixsl:style($row-block-controls)?z-index = '1'">
176+
<ixsl:set-style name="z-index" select="'-1'" object="$row-block-controls"/>
177+
<ixsl:set-style name="display" select="'none'" object="$btn-edit"/>
178+
</xsl:if>
176179
</xsl:if>
177180
</xsl:template>
178181

0 commit comments

Comments
 (0)