Fixed Site Preferences Language

This commit is contained in:
saurabhbhatia 2013-10-21 17:46:29 +08:00
parent e42cf8720e
commit cf89ed108a
2 changed files with 5 additions and 7 deletions

View File

@ -7,7 +7,6 @@ class Site
field :in_use_locales, :type => Array
field :valid_locales, :type => Array
field :enable_locales, :type => Array
field :roaming_id
field :private_key, :type => Binary

View File

@ -154,9 +154,6 @@
<div class="control-group">
<label class="control-label muted">Enable Language</label>
<div class="controls">
<% @site.in_use_locales.each do |locale|%>
<%= locale %>
<% end %>
<% @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)}" } %>
<% end %>
@ -242,13 +239,15 @@
</fieldset>
<%end%>
<script type="text/javascript">
var locales = <%= @site.in_use_locales.to_json.html_safe %>;
$(document).ready(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" );
}
})
})
delete locales;
</script>