mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 19:30:07 +00:00 
			
		
		
		
	added optional close button to sub-panels...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									635a220308
								
							
						
					
					
						commit
						db8ac24565
					
				| @ -192,8 +192,8 @@ function removePanel(panel){ | ||||
| // 		panel is dragged out or when the panel is dragged...
 | ||||
| function makePanel(title, parent, open, keep_empty, close_button){ | ||||
| 	title = title == null || title.trim() == '' ? ' ' : title | ||||
| 	close_button = close_button == null ? true : false | ||||
| 	parent = parent == null ? $(PANEL_ROOT) : parent | ||||
| 	close_button = close_button == null ? true : close_button | ||||
| 
 | ||||
| 	// the outer panel...
 | ||||
| 	var panel = $('<details/>') | ||||
| @ -384,9 +384,10 @@ function makeSidePanel(side, parent, autohide){ | ||||
| 
 | ||||
| // NOTE: if parent is not given this will create a new panel...
 | ||||
| // NOTE: title must be unique...
 | ||||
| function makeSubPanel(title, content, parent, open, content_resizable){ | ||||
| function makeSubPanel(title, content, parent, open, content_resizable, close_button){ | ||||
| 	title = title == null || title.trim() == '' ? ' ' : title | ||||
| 	parent = parent == null ? makePanel() : parent | ||||
| 	close_button = close_button == null ? false : close_button | ||||
| 
 | ||||
| 	open = open == null ? true : open | ||||
| 	content_resizable = content_resizable == null  | ||||
| @ -402,7 +403,16 @@ function makeSubPanel(title, content, parent, open, content_resizable){ | ||||
| 		.attr('id', title) | ||||
| 		.addClass('sub-panel noScroll') | ||||
| 		.prop('open', open) | ||||
| 		.append($('<summary>'+title+'</summary>') | ||||
| 		.append((close_button | ||||
| 			? $('<summary>'+title+'</summary>') | ||||
| 				.append($('<span/>') | ||||
| 					.addClass('close-button') | ||||
| 					.click(function(){ | ||||
| 						removePanel(panel) | ||||
| 						return false | ||||
| 					}) | ||||
| 					.html('×')) | ||||
| 			: $('<summary>'+title+'</summary>')) | ||||
| 			// XXX also do this on enter...
 | ||||
| 			// XXX
 | ||||
| 			.click(function(){ | ||||
| @ -467,7 +477,6 @@ function makePanelController(title, content_builder, panel_setup, content_resiza | ||||
| 
 | ||||
| 		// 2) if no panel exists, create it
 | ||||
| 		// 		- content_builder() must return panel content
 | ||||
| 		// XXX need to get saved coordinates...
 | ||||
| 		if(panel.length == 0){ | ||||
| 			panel = makeSubPanel(title, content_builder(), parent, open, content_resizable) | ||||
| 				.attr('id', title) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user