From d61e1b1c5fad0bac7e41b768771b5d1bbc638ca7 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 18 Aug 2010 16:18:56 -0500 Subject: [PATCH] add showView method to open a url in the view tab --- www/extras/admin/admin.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 852448adb..0936c12d2 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -163,15 +163,7 @@ appendToUrl */ WebGUI.Admin.prototype.editAsset = function ( url ) { - // Show the view tab - this.tabBar.selectTab( 0 ); - this.currentTab = "view"; - - // Open the edit form - window.frames["view"].location.href = appendToUrl( url, "func=edit" ); - - // Mark undirty, as we'll clean it ourselves - this.viewDirty = 0; + this.showView( appendToUrl( url, "func=edit" ) ); }; /** @@ -191,6 +183,25 @@ WebGUI.Admin.prototype.gotoAsset } }; +/** + * showView ( [url] ) + * Open the view tab, optionally navigating to the given URL + */ +WebGUI.Admin.prototype.showView += function (url) { + // Show the view tab + this.tabBar.selectTab( 0 ); + this.currentTab = "view"; + + if ( url ) { + // Open the URL + window.frames["view"].location.href = url; + + // Mark undirty, as we'll clean it ourselves + this.viewDirty = 0; + } +}; + /** * makeEditAsset( url ) * Create a callback to edit an asset. Use when attaching to event listeners