tree: crumbtrail and back/forward work
This commit is contained in:
parent
e9e4b1a73b
commit
4cf3c9878f
2 changed files with 38 additions and 3 deletions
|
|
@ -226,7 +226,13 @@ sub www_getTreeData {
|
|||
$assetInfo->{ totalAssets } = $p->getRowCount;
|
||||
$assetInfo->{ sort } = $session->form->get( 'orderByColumn' );
|
||||
$assetInfo->{ dir } = lc $session->form->get( 'orderByDirection' );
|
||||
$assetInfo->{ currentAsset } = { title => $asset->getTitle, helpers => $asset->getHelpers };
|
||||
$assetInfo->{ currentAsset } = {
|
||||
assetId => $asset->getId,
|
||||
url => $asset->getUrl,
|
||||
title => $asset->getTitle,
|
||||
icon => $asset->getIcon("small"),
|
||||
helpers => $asset->getHelpers,
|
||||
};
|
||||
|
||||
$assetInfo->{ crumbtrail } = [];
|
||||
for my $asset ( @{ $asset->getLineage( ['ancestors'], { returnObjects => 1 } ) } ) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ WebGUI.Admin.prototype.gotoAsset
|
|||
}
|
||||
else if ( this.currentTab == "tree" ) {
|
||||
// Make tree request
|
||||
this.tree.goto( this.currentAssetDef.url );
|
||||
this.tree.goto( url );
|
||||
this.viewDirty = 1;
|
||||
}
|
||||
};
|
||||
|
|
@ -453,7 +453,9 @@ WebGUI.Admin.Tree
|
|||
{ key: 'childCount' }
|
||||
],
|
||||
metaFields: {
|
||||
totalRecords: "totalAssets" // Access to value in the server response
|
||||
totalRecords: "totalAssets", // Access to value in the server response
|
||||
crumbtrail : "crumbtrail",
|
||||
currentAsset : "currentAsset"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -731,6 +733,7 @@ WebGUI.Admin.Tree.prototype.formatTitle
|
|||
|
||||
WebGUI.Admin.Tree.prototype.goto
|
||||
= function ( assetUrl ) {
|
||||
// TODO: Show loading screen
|
||||
var callback = {
|
||||
success : this.onDataReturnInitializeTable,
|
||||
failure : this.onDataReturnInitializeTable,
|
||||
|
|
@ -756,6 +759,32 @@ WebGUI.Admin.Tree.prototype.onDataReturnInitializeTable
|
|||
= function ( sRequest, oResponse, oPayload ) {
|
||||
this.dataTable.onDataReturnInitializeTable.call( this.dataTable, sRequest, oResponse, oPayload );
|
||||
|
||||
// Rebuild the crumbtrail
|
||||
var crumb = oResponse.meta.crumbtrail;
|
||||
var elCrumb = document.getElementById( "treeCrumbtrail" );
|
||||
elCrumb.innerHTML = '';
|
||||
for ( var i = 0; i < crumb.length; i++ ) {
|
||||
var item = crumb[i];
|
||||
var elItem = document.createElement( "span" );
|
||||
elItem.className = "clickable";
|
||||
YAHOO.util.Event.addListener( elItem, "click", function(){ this.goto( item.url ) }, this, true );
|
||||
elItem.appendChild( document.createTextNode( item.title ) );
|
||||
|
||||
elCrumb.appendChild( elItem );
|
||||
elCrumb.appendChild( document.createTextNode( " > " ) );
|
||||
}
|
||||
|
||||
// Final crumb item has a menu
|
||||
var elItem = document.createElement( "span" );
|
||||
elItem.className = "clickable";
|
||||
YAHOO.util.Event.addListener( elItem, "click", function(){ alert( "TOADO" ) }, this, true );
|
||||
elItem.appendChild( document.createTextNode( oResponse.meta.currentAsset.title ) );
|
||||
elCrumb.appendChild( elItem );
|
||||
|
||||
// TODO: Update current asset
|
||||
window.admin.navigate( oResponse.meta.currentAsset );
|
||||
|
||||
// TODO Hide loading screen
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue