Fixed Site Preferences Language
This commit is contained in:
		
							parent
							
								
									e42cf8720e
								
							
						
					
					
						commit
						cf89ed108a
					
				|  | @ -7,7 +7,6 @@ class Site | ||||||
|    |    | ||||||
|   field :in_use_locales, :type => Array |   field :in_use_locales, :type => Array | ||||||
|   field :valid_locales, :type => Array |   field :valid_locales, :type => Array | ||||||
|   field :enable_locales, :type => Array |  | ||||||
|    |    | ||||||
|   field :roaming_id |   field :roaming_id | ||||||
|   field :private_key, :type => Binary |   field :private_key, :type => Binary | ||||||
|  |  | ||||||
|  | @ -154,9 +154,6 @@ | ||||||
|                   <div class="control-group"> |                   <div class="control-group"> | ||||||
|                     <label class="control-label muted">Enable Language</label> |                     <label class="control-label muted">Enable Language</label> | ||||||
|                     <div class="controls"> |                     <div class="controls"> | ||||||
|                     <% @site.in_use_locales.each do |locale|%> |  | ||||||
|                         <%= locale %> |  | ||||||
|                     <% end %> |  | ||||||
|                      <% @site_valid_locales.each do |valid_locale| %> |                      <% @site_valid_locales.each do |valid_locale| %> | ||||||
|                       <%= check_box_tag "site[in_use_locales][]", valid_locale, @site.in_use_locales.include?(valid_locale), :class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(valid_locale)}" } %> |                       <%= check_box_tag "site[in_use_locales][]", valid_locale, @site.in_use_locales.include?(valid_locale), :class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(valid_locale)}" } %> | ||||||
| 					            <% end %> | 					            <% end %> | ||||||
|  | @ -242,13 +239,15 @@ | ||||||
|           </fieldset> |           </fieldset> | ||||||
| <%end%> | <%end%> | ||||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||||
|  | var locales = <%= @site.in_use_locales.to_json.html_safe %>; | ||||||
|   $(document).ready(function(){ |   $(document).ready(function(){ | ||||||
|     $( ".in_use_locales" ).each( function(){ |     $( ".in_use_locales" ).each( function(){ | ||||||
|       if( $( this ).val() != "" ){ |       $( this ).parent( "div.togglebox" ).addClass( "disabled" ); | ||||||
|  |       var val = $( this ).val(); | ||||||
|  |       if( locales.filter(function(a){ return a == val }).length == 1){ | ||||||
|         $( this ).parent( "div.togglebox" ).removeClass( "disabled" ); |         $( this ).parent( "div.togglebox" ).removeClass( "disabled" ); | ||||||
| 
 |  | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|   }) |   }) | ||||||
| 
 | delete locales; | ||||||
| </script> | </script> | ||||||
		Loading…
	
		Reference in New Issue