Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/delibero.git

Shorter names. Minor optimizations.

Author Dave Jarvis <email>
Date 2014-12-29 17:46:57 GMT-0800
Commit 7b62842232f111501a19a00395f18e3cc52db919
Parent 813021a
xml/css/tags.css
@import url( "css/support.css" );
+div#container {
+ border-left: 2px solid #DDD;
+ border-right: 2px solid #DDD;
+ border-top-left-radius: 0.4em 0.4em;
+ border-top-right-radius: 0.4em 0.4em;
+ border-bottom-left-radius: 0.4em 0.4em;
+ border-bottom-right-radius: 0.4em 0.4em;
+}
+
/**
*
/* Setting a list container class to "collapsed" will hide the column. */
-ul.column.collapsed {
+ul.column.collapse {
display: none;
}
ul.column > li.parent::after {
- content: "▶";
+ content: "›";
float: right;
+ font-weight: bold;
}
/* Ensure all selected nodes in the hierarchy are easily seen. */
-ul.column > li.selection {
+ul.column > li.selected {
background-color: #08C;
color: white;
div.breadcrumb > span::after {
- content: " ▸";
+ content: " ›";
}
xml/js/tags.js
return this.each( function() {
var $columns = $(this);
- $columns.before( $("<div>").addClass( "breadcrumb" ) );
- $columns.after( $("<div>").addClass( "toolbar" ) );
+ $columns.before( $("<div/>").addClass( "breadcrumb" ) );
+ $columns.after( $("<div/>").addClass( "toolbar" ) );
unnest( $columns );
collapse();
// Expand the requested child node on click.
$columns.find( "li" ).on( "click", function() {
collapse();
- $(".selection").removeClass( "selection" );
+ $(".selected").removeClass( "selected" );
- var $descendants = $(this).data( "descendants" );
+ var $child = $(this).data( "child" );
- if( $descendants !== undefined ) {
- $descendants.removeClass( "collapsed" );
- $descendants.children().removeClass( "selection" );
+ if( $child !== undefined ) {
+ $child.removeClass( "collapse" ).children().removeClass( "selected" );
}
var $ancestor = $(this);
// Reveal (uncollapse) all ancestors to the clicked item.
while( $ancestor !== undefined ) {
- $ancestor.addClass( "selection" ).parent().removeClass( "collapsed" );
+ $ancestor.addClass( "selected" ).parent().removeClass( "collapse" );
$ancestor = $ancestor.data( "ancestor" );
}
// Add the breadcrumb trail.
- $("li.selection").each( function( _, crumb ) {
- $breadcrumb.append( "<span>" + $(crumb).text() + "</span>" );
+ $("li.selected").each( function( _, crumb ) {
+ $("<span/>").text( $(crumb).text() ).appendTo( $breadcrumb );
});
}
$node.children().each( function( _, el ) {
- var $descendants = $(this).children();
+ var $child = $(this).children();
var $ancestor = $(this).parent().parent();
// Retain item hierarchy (because it is lost after flattening).
if( $ancestor.length && ($(this).data( "ancestor" ) === undefined) ) {
+ // Use addBack to reset all selection chains.
$(this).siblings().addBack().data( "ancestor", $ancestor );
}
- if( $descendants.length > 0 ) {
- queue.push( $descendants );
- $(this).data( "descendants", $descendants ).addClass( "parent" );
+ if( $child.length > 0 ) {
+ queue.push( $child );
+ $(this).data( "child", $child ).addClass( "parent" );
}
// Causes item siblings to have a flattened DOM lineage.
- $(this).parent().detach().appendTo( $columns ).addClass( "column" );
+ $(this).parent().appendTo( $columns ).addClass( "column" );
});
}
}
/** Hide all columns, except the first. */
function collapse() {
- $(".column:gt(0)").addClass( "collapsed" );
+ $(".column:gt(0)").addClass( "collapse" );
}
})(jQuery);
xml/tags.xsl
<!-- Override the match="*" from the common template by forcing priority. -->
<xsl:template match="taglist" priority="1">
- <div class="columns">
- <ul>
- <xsl:apply-templates mode="tag"/>
- </ul>
+ <div id="container">
+ <div class="columns">
+ <ul>
+ <xsl:apply-templates mode="tag"/>
+ </ul>
+ </div>
</div>
<div class="description">
Delta 36 lines added, 24 lines removed, 12-line increase