Dave Jarvis' Repositories

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

Started update tags feature.

Author Dave Jarvis <email>
Date 2014-12-31 19:05:02 GMT-0800
Commit c7ff679f2915fb1a956582a3da184d520d1a071a
Parent b99bf5d
xml/js/columns.js
$.fn.millerColumns = function( options ) {
var defaults = {
- selection: function( $item ) {},
+ current: function( $item ) {},
breadcrumb: breadcrumb,
animation: animation,
settings.animation.call( this, $columns, $(this) );
settings.breadcrumb.call( this );
- settings.selection.call( this, $(this) );
+ settings.current.call( this, $(this) );
// Don't allow the underlying DIV to receive the click event.
$(".column > .selected").removeClass( "selected" );
breadcrumb();
+ settings.current( undefined );
}
keypress = function( event ) {
+ // Was an attempt made to move the currently selected item (the cursor)?
var moved = false;
var $child = current().data( "child" );
- if( $child !== undefined ) {
- $child.children().first().click();
- }
- else {
- moveD();
- }
+ ($child === undefined) ? moveD() : $child.children().first().click();
}
})(jQuery);
xml/js/tags.js
$(document).ready( function() {
$.getScript( "js/columns.js", function() {
+ var $current;
+
$("div.columns").millerColumns({
- selection: function( $item ) {
- console.log( $item.attr( "id" ) );
+ current: function( $item ) {
+ $current = $item;
+ }
+ });
+
+ $("#new").on( "click", function( event ) {
+ event.preventDefault();
+
+ if( $current !== undefined ) {
+ console.log( "new child of: " + $current.attr( "id" ) );
+ }
+ else {
+ console.log( "new root sibling" );
+ }
+
+ return false;
+ });
+
+ $("#edit").on( "click", function( event ) {
+ event.preventDefault();
+
+ if( $current !== undefined ) {
+ console.log( "edit: " + $current.attr( "id" ) );
+ }
+
+ return false;
+ });
+
+ $("#del").on( "click", function( event ) {
+ event.preventDefault();
+
+ if( $current !== undefined ) {
+ console.log( "delete: " + $current.attr( "id" ) );
+ }
+
+ return false;
+ });
+
+ $("#flag").on( "click", function( event ) {
+ event.preventDefault();
+
+ if( $current !== undefined ) {
+ console.log( "flag: " + $current.attr( "id" ) );
}
+
+ return false;
});
});
xml/tags.xsl
</div>
<div class="toolbar">
- <a href="do.xhtml?action=tag&amp;command=new">new</a> |
- <a href="do.xhtml?action=tag&amp;command=edit">edit</a> |
- <a href="do.xhtml?action=tag&amp;command=delete">delete</a> |
- <a href="do.xhtml?action=tag&amp;command=flag">flag</a>
+ <a id="new" href="do.xhtml?action=tag&amp;command=new">new</a> |
+ <a id="edit" href="do.xhtml?action=tag&amp;command=edit">edit</a> |
+ <a id="del" href="do.xhtml?action=tag&amp;command=delete">delete</a> |
+ <a id="flag" href="do.xhtml?action=tag&amp;command=flag">flag</a>
</div>
</div>
Delta 56 lines added, 14 lines removed, 42-line increase