new static files.
Signed-off-by: rscnt <rascnt@gmail.com>
This commit is contained in:
		
					parent
					
						
							
								5da7cfab99
							
						
					
				
			
			
				commit
				
					
						bb68c32ba5
					
				
			
		
					 772 changed files with 71557 additions and 0 deletions
				
			
		
							
								
								
									
										7
									
								
								static/admin_enhancer/css/related-widget-wrapper.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								static/admin_enhancer/css/related-widget-wrapper.css
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| .related-widget-wrapper-link { | ||||
| 	opacity: 0.3; | ||||
| } | ||||
| 
 | ||||
| .related-widget-wrapper-link:link { | ||||
| 	opacity: 1; | ||||
| } | ||||
							
								
								
									
										55
									
								
								static/admin_enhancer/js/related-widget-wrapper.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								static/admin_enhancer/js/related-widget-wrapper.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| django.jQuery(document).ready(function($){ | ||||
|      | ||||
|     window.dismissChangeRelatedPopup = function(win, objId, newRepr) { | ||||
|         objId = html_unescape(objId); | ||||
|         newRepr = html_unescape(newRepr); | ||||
|         var id = windowname_to_id(win.name).replace(/^edit_/, ''), | ||||
|             selects = $(interpolate('#%s, #%s_from, #%s_to', [id, id, id])); | ||||
|         selects.find('option').each(function(){ | ||||
|             if (this.value == objId) this.innerHTML = newRepr; | ||||
|         }); | ||||
|         win.close(); | ||||
|     }; | ||||
|      | ||||
|     if (!dismissAddAnotherPopup.original) { | ||||
|         var originalDismissAddAnotherPopup = dismissAddAnotherPopup; | ||||
|         dismissAddAnotherPopup = function(win, newId, newRepr) { | ||||
|             originalDismissAddAnotherPopup(win, newId, newRepr); | ||||
|             newId = html_unescape(newId); | ||||
|             newRepr = html_unescape(newRepr); | ||||
|             $('#' + windowname_to_id(win.name)).trigger('change'); | ||||
|         }; | ||||
|         dismissAddAnotherPopup.original = originalDismissAddAnotherPopup; | ||||
|     } | ||||
|      | ||||
|     window.dismissDeleteRelatedPopup = function(win, objId) { | ||||
|         objId = html_unescape(objId); | ||||
|         var id = windowname_to_id(win.name).replace(/^delete_/, ''), | ||||
|             selects = $(interpolate('#%s, #%s_from, #%s_to', [id, id, id])); | ||||
|         selects.find('option').each(function(){ | ||||
|             if (this.value == objId) $(this).remove(); | ||||
|         }).trigger('change'); | ||||
|         win.close(); | ||||
|     }; | ||||
|      | ||||
| 	var relatedWidgetCSSSelector = '.related-widget-wrapper-change-link, .related-widget-wrapper-delete-link', | ||||
|   		hrefTemplateAttr = 'data-href-template'; | ||||
|    | ||||
|     $('#container').delegate('.related-widget-wrapper', 'change', function(event){ | ||||
|         var siblings = $(this).nextAll(relatedWidgetCSSSelector), | ||||
|             value = event.target.value; | ||||
|         if (!siblings.length) return; | ||||
|         if (value) { | ||||
| 	       siblings.each(function(){ | ||||
| 		      var elm = $(this); | ||||
| 		      elm.attr('href', elm.attr(hrefTemplateAttr).replace('__pk__', value)); | ||||
| 	       }); | ||||
|         } else siblings.removeAttr('href'); | ||||
|     }); | ||||
| 
 | ||||
| 	$('#container').delegate('.related-widget-wrapper-link', 'click', function(event){ | ||||
|     	if (this.href) { | ||||
|     		return showAddAnotherPopup(this); | ||||
|     	} else return false; | ||||
|     }); | ||||
| }); | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue