mirror of
				https://github.com/SectorLabs/django-localized-fields.git
				synced 2025-10-31 10:48:56 +03:00 
			
		
		
		
	Merge pull request #46 from MELScience/fix-admin-widget-inline
fix admin widget work with inline formsets
This commit is contained in:
		| @@ -32,7 +32,7 @@ | |||||||
|     opacity: 1; |     opacity: 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| .localized-fields-widget.tabs .localized-fields-widget.tab a { | .localized-fields-widget.tabs .localized-fields-widget.tab label { | ||||||
|     padding: 5px 10px; |     padding: 5px 10px; | ||||||
|     display: inline-block; |     display: inline-block; | ||||||
|     text-decoration: none; |     text-decoration: none; | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| (function($) { | (function($) { | ||||||
|     var syncTabs = function(lang) { |     var syncTabs = function(lang) { | ||||||
|         $('.localized-fields-widget.tab a:contains("'+lang+'")').each(function(){ |         $('.localized-fields-widget.tab label:contains("'+lang+'")').each(function(){ | ||||||
|             $(this).parents('.localized-fields-widget[role="tabs"]').find('.localized-fields-widget.tab').removeClass('active'); |             $(this).parents('.localized-fields-widget[role="tabs"]').find('.localized-fields-widget.tab').removeClass('active'); | ||||||
|             $(this).parents('.localized-fields-widget.tab').addClass('active'); |             $(this).parents('.localized-fields-widget.tab').addClass('active'); | ||||||
|             $(this).parents('.localized-fields-widget[role="tabs"]').children('.localized-fields-widget [role="tabpanel"]').hide(); |             $(this).parents('.localized-fields-widget[role="tabs"]').children('.localized-fields-widget [role="tabpanel"]').hide(); | ||||||
|             $($(this).attr('href')).show(); |             $('#'+$(this).attr('for')).show(); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -13,7 +13,7 @@ | |||||||
|         // set first tab as active |         // set first tab as active | ||||||
|         $('.localized-fields-widget[role="tabs"]').each(function () { |         $('.localized-fields-widget[role="tabs"]').each(function () { | ||||||
|             $(this).find('.localized-fields-widget.tab:first').addClass('active'); |             $(this).find('.localized-fields-widget.tab:first').addClass('active'); | ||||||
|             $($(this).find('.localized-fields-widget.tab:first a').attr('href')).show(); |             $('#'+$(this).find('.localized-fields-widget.tab:first label').attr('for')).show(); | ||||||
|         }); |         }); | ||||||
|         // try set active last selected tab |         // try set active last selected tab | ||||||
|         if (window.sessionStorage) { |         if (window.sessionStorage) { | ||||||
| @@ -23,7 +23,7 @@ | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $('.localized-fields-widget.tab a').click(function(event) { |         $('.localized-fields-widget.tab label').click(function(event) { | ||||||
|             event.preventDefault(); |             event.preventDefault(); | ||||||
|             syncTabs(this.innerText); |             syncTabs(this.innerText); | ||||||
|             if (window.sessionStorage) { |             if (window.sessionStorage) { | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|     <ul class="localized-fields-widget tabs"> |     <ul class="localized-fields-widget tabs"> | ||||||
|     {% for widget in widget.subwidgets %} |     {% for widget in widget.subwidgets %} | ||||||
|         <li class="localized-fields-widget tab"> |         <li class="localized-fields-widget tab"> | ||||||
|             <a href="#{{ widget_id }}_{{ widget.lang_code }}">{{ widget.lang_name|capfirst }}</a> |             <label for="{{ widget_id }}_{{ widget.lang_code }}">{{ widget.lang_name|capfirst }}</label> | ||||||
|         </li> |         </li> | ||||||
|     {% endfor %} |     {% endfor %} | ||||||
|     </ul> |     </ul> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user