
$.extend( $.boom, {
	/** @lends $.boom */
	
	/**
	Link manager
	@class
	*/
	links : {
		
		/** @function */
		picker: function( opts ) {
			
			opts = ( opts ) ? opts : {};
			
			var link_manager_url =
				( opts.page_rid && typeof opts.page_rid != 'undefined' ) ?
				'/cms/chunk/insert_url/' + opts.page_rid : 
				'/cms/chunk/insert_url';
			
			var default_opts = {
				title: 'Edit link',
				url: link_manager_url,
				onLoad: function(){
					var self = this;
					$.boom.util.page_tree( this.find( '.boom-tree' ) )
						.progress( function( page ) {
							link = page;
							
							complete.resolve( page );

							$.boom.dialog.destroy( self );
						});
				},
				buttons: {
					'✕': function(){
						complete.reject();

						$.boom.dialog.destroy( this );
						
						return false;
					},
					'✔': function(){
						
						if ( link.rid == -1 ) {
							var link_text = $( '#boom-chunk-linkset-addlink-external-url' ).val();
							link.url = link_text;
							link.title = link_text;
						}
						
						complete.resolve( link );

						$.boom.dialog.destroy( this );
						
						return false;
					}
				},
				link : {
					title: '',
					rid: -1,
					url: ''
				}
			};
			
			opts = $.extend( default_opts, opts );
			
			var link = opts.link;
			var complete = new $.Deferred();
			
			$.boom.dialog.open( opts );
			
			return complete;
		}
	}
});
@@ -167,24 +167,64 @@
 s : %7B%7D;%0A%09%09%09%0A
+%09%09%09var complete = new $.Deferred();%0A%09%09%09%0A
 %09%09%09var link_
@@ -456,16 +456,40 @@
 er_url,%0A
+%09%09%09%09deferred: complete,%0A
 %09%09%09%09onLo
@@ -743,147 +743,16 @@
 %09%09%09%09
-buttons: %7B%0A%09%09%09%09%09'%E2%9C%95': function()%7B%0A%09%09%09%09%09%09complete.reject();%0A%0A%09%09%09%09%09%09$.boom.dialog.destroy( this );%0A%09%09%09%09%09%09%0A%09%09%09%09%09%09return false;%0A%09%09%09%09%09%7D,%0A%09%09%09%09%09'%E2%9C%94'
+callback
 : fu
@@ -762,27 +762,25 @@
 ion()%7B%0A%09%09%09%09%09
-%09%0A%09
+%0A
 %09%09%09%09%09if ( li
@@ -792,25 +792,24 @@
 d == -1 ) %7B%0A
-%09
 %09%09%09%09%09%09var li
@@ -875,25 +875,24 @@
 al();%0A%09%09%09%09%09%09
-%09
 link.url = l
@@ -897,25 +897,24 @@
  link_text;%0A
-%09
 %09%09%09%09%09%09link.t
@@ -927,25 +927,24 @@
  link_text;%0A
-%09
 %09%09%09%09%09%7D%0A%09%09%09%09%09
@@ -939,27 +939,25 @@
 %09%09%09%09%09%7D%0A%09%09%09%09%09
-%09%0A%09
+%0A
 %09%09%09%09%09complet
@@ -978,80 +978,8 @@
 k );
-%0A%0A%09%09%09%09%09%09$.boom.dialog.destroy( this );%0A%09%09%09%09%09%09%0A%09%09%09%09%09%09return false;%0A%09%09%09%09%09%7D
 %0A%09%09%09
@@ -1129,44 +1129,8 @@
 nk;%0A
-%09%09%09var complete = new $.Deferred();%0A
 %09%09%09%0A

remove custom okay/cancel buttons from the links dialog