Fix for togglebox and menu_enabled_for
This commit is contained in:
parent
dfd0b5c1fb
commit
62c663d699
|
@ -65,36 +65,38 @@ if($.support.touch) {
|
|||
$checked.each(function(i) {
|
||||
if($(this).attr('type') == "checkbox") {
|
||||
if($(this).data().disabled) {
|
||||
$(this).parent('.togglebox').addClass('disabled').closest('li').addClass('disabled');
|
||||
console.log("d")
|
||||
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
|
||||
if($(this).prop('checked')) {
|
||||
$(this).parent('.togglebox').removeClass('disabled').closest('li').removeClass('disabled');
|
||||
$(this).parent('.togglebox').removeClass('disable').closest('li').removeClass('disabled');
|
||||
};
|
||||
} else {
|
||||
console.log($(this))
|
||||
if($(this).prop('checked')) {
|
||||
$(this).parent('.togglebox').addClass('disabled').closest('li').addClass('disabled');
|
||||
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
|
||||
};
|
||||
}
|
||||
$(this).on({
|
||||
change: function() {
|
||||
$(this).parent('.togglebox').toggleClass('disabled');
|
||||
$(this).parent('.togglebox').toggleClass('disable');
|
||||
$(this).closest('tr').toggleClass('disable');
|
||||
}
|
||||
});
|
||||
};
|
||||
if($(this).attr('type') == "radio") {
|
||||
if(!$(this).prop('checked')) {
|
||||
$(this).parent('.togglebox').addClass('disabled').closest('li').addClass('disabled');
|
||||
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
|
||||
$(this).closest('tr').addClass('disable');
|
||||
};
|
||||
$(this).on({
|
||||
change: function() {
|
||||
$checked.not($(".toggle-check[type='checkbox']")).each(function(i) {
|
||||
if(!$(this).parent('.togglebox').hasClass('disabled')) {
|
||||
$(this).parent('.togglebox').toggleClass('disabled');
|
||||
if(!$(this).parent('.togglebox').hasClass('disable')) {
|
||||
$(this).parent('.togglebox').toggleClass('disable');
|
||||
$(this).closest('tr').toggleClass('disable');
|
||||
};
|
||||
});
|
||||
$(this).parent('.togglebox').toggleClass('disabled')
|
||||
$(this).parent('.togglebox').toggleClass('disable')
|
||||
$(this).closest('tr').toggleClass('disable');
|
||||
}
|
||||
});
|
||||
|
@ -110,7 +112,7 @@ if($.support.touch) {
|
|||
.find('li')
|
||||
.addClass('disabled')
|
||||
.find('h6 .togglebox')
|
||||
.addClass('disabled')
|
||||
.addClass('disable')
|
||||
.find('input[type="checkbox"]')
|
||||
.prop('checked', true)
|
||||
.attr('checked', 'checked');
|
||||
|
@ -121,37 +123,37 @@ if($.support.touch) {
|
|||
.find('li')
|
||||
.removeClass('disabled')
|
||||
.find('h6 .togglebox')
|
||||
.removeClass('disabled')
|
||||
.removeClass('disable')
|
||||
.find('input[type="checkbox"]')
|
||||
.prop('checked', false)
|
||||
.removeAttr('checked');
|
||||
};
|
||||
$('.toggle-check').each(function(i) {
|
||||
var len = $(this).closest('ul').children('li').length,
|
||||
checLen = $(this).closest('ul').children('li').find('input[checked]').length,
|
||||
checLen = checLen - $(this).closest('ul').children('li').find('ul').find('input[checked]').length;
|
||||
if(len == checLen) {
|
||||
$(this).closest('ul')
|
||||
.parent('li')
|
||||
.addClass('disabled')
|
||||
.children('h6')
|
||||
.find('.togglebox')
|
||||
.addClass('disabled')
|
||||
.find('input[type="checkbox"]')
|
||||
.prop('checked', true)
|
||||
.attr('checked', 'checked');
|
||||
} else {
|
||||
$(this).closest('ul')
|
||||
.parent('li')
|
||||
.removeClass('disabled')
|
||||
.children('h6')
|
||||
.find('.togglebox')
|
||||
.removeClass('disabled')
|
||||
.find('input[type="checkbox"]')
|
||||
.prop('checked', false)
|
||||
.removeAttr('checked');
|
||||
};
|
||||
});
|
||||
// $('.toggle-check').each(function(i) {
|
||||
// var len = $(this).closest('ul').children('li').length,
|
||||
// checLen = $(this).closest('ul').children('li').find('input[checked]').length,
|
||||
// checLen = checLen - $(this).closest('ul').children('li').find('ul').find('input[checked]').length;
|
||||
// if(len == checLen) {
|
||||
// $(this).closest('ul')
|
||||
// .parent('li')
|
||||
// .addClass('disabled')
|
||||
// .children('h6')
|
||||
// .find('.togglebox')
|
||||
// .addClass('disable')
|
||||
// .find('input[type="checkbox"]')
|
||||
// .prop('checked', true)
|
||||
// .attr('checked', 'checked');
|
||||
// } else {
|
||||
// $(this).closest('ul')
|
||||
// .parent('li')
|
||||
// .removeClass('disabled')
|
||||
// .children('h6')
|
||||
// .find('.togglebox')
|
||||
// .removeClass('disable')
|
||||
// .find('input[type="checkbox"]')
|
||||
// .prop('checked', false)
|
||||
// .removeAttr('checked');
|
||||
// };
|
||||
// });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -66,10 +66,10 @@
|
|||
background-image: linear-gradient(to bottom, #fafafa, #efefef);
|
||||
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fafafa', endColorstr='#efefef', GradientType=0);
|
||||
}
|
||||
.toggle-control .togglebox.disabled {
|
||||
.toggle-control .togglebox.disable {
|
||||
background-color: #999b93;
|
||||
}
|
||||
.toggle-control .togglebox.disabled label {
|
||||
.toggle-control .togglebox.disable label {
|
||||
left: -19px;
|
||||
}
|
||||
.toggle-control .togglebox label:before,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<li class="map-block <%= 'disabled' if !sitemap_block.show_in_sitemap_for(temp_locale) %>">
|
||||
<li class="map-block">
|
||||
<h6>
|
||||
<input type="checkbox" id="<%= sitemap_block.id %>" class="toggle-check onoff" temp_locale="<%= temp_locale %>" data-deploy="right">
|
||||
<%= check_box_tag nil, nil, !sitemap_block.show_in_sitemap_for(temp_locale), id: sitemap_block.id, class: "toggle-check onoff", "temp_locale" => temp_locale, data: {deploy: "right"} %>
|
||||
<span><%= sitemap_block_counter + 1 %> <%= sitemap_block.title_translations[temp_locale] %></span>
|
||||
</h6>
|
||||
<ul>
|
||||
<% sitemap_block.children.each_with_index do |child, i| %>
|
||||
<li class="<%= 'disabled' if !child.show_in_sitemap_for(temp_locale) %>">
|
||||
<li>
|
||||
<h6>
|
||||
<input type="checkbox" id="<%= child.id %>" class="toggle-check onoff" temp_locale="<%= temp_locale %>" data-deploy="right">
|
||||
<%= check_box_tag nil, nil, !child.show_in_sitemap_for(temp_locale), id: child.id, class: "toggle-check onoff", "temp_locale" => temp_locale, data: {deploy: "right"} %>
|
||||
<span><%= "#{sitemap_block_counter + 1}-#{i + 1}" %> <%= child.title_translations[temp_locale] %></span>
|
||||
</h6>
|
||||
</li>
|
||||
|
|
|
@ -95,13 +95,13 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t 'mail.tls' %></label>
|
||||
<div class="controls">
|
||||
<%= f.check_box :tls, :checked => (@site['site_settings']['tls'].eql?('1') rescue false),:class=>"toggle-check" %>
|
||||
<%= f.check_box :tls, :checked => (@site['site_settings']['tls'].eql?('1') rescue false),:class=>"toggle-check", :data=> { disabled: true } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t 'mail.enable_starttls_auto' %></label>
|
||||
<div class="controls">
|
||||
<%= f.check_box 'enable_starttls_auto', :checked => (@site['site_settings']['enable_starttls_auto'].eql?('1') rescue false), :class=>"toggle-check" %>
|
||||
<%= f.check_box 'enable_starttls_auto', :checked => (@site['site_settings']['enable_starttls_auto'].eql?('1') rescue false), :class=>"toggle-check", :data=> { disabled: true } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -114,21 +114,21 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label muted"><%= I18n.t('site.frontend_open')%></label>
|
||||
<div class="controls">
|
||||
<%= f.check_box :frontend_open , :class=>"toggle-check"%>
|
||||
<%= f.check_box :frontend_open , :class=>"toggle-check", :data=> { disabled: true } %>
|
||||
<span class="help-block">If Checked, the frontend will be open for all users.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= I18n.t('site.backend_openness_on') %></label>
|
||||
<div class="controls">
|
||||
<%= f.check_box :backend_openness_on , :class=>"toggle-check" %>
|
||||
<%= f.check_box :backend_openness_on , :class=>"toggle-check", :data=> { disabled: true } %>
|
||||
<span class="help-block">All users can visit backend pages</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= I18n.t('site.enable_personal_desktop')%></label>
|
||||
<div class="controls">
|
||||
<%= f.check_box :desktop_closed , :class=>"toggle-check" %>
|
||||
<%= f.check_box :desktop_closed , :class=>"toggle-check", :data=> { disabled: true } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -147,7 +147,7 @@
|
|||
<label class="control-label muted">Enable User Language Detection
|
||||
</label>
|
||||
<div class="controls">
|
||||
<%= f.check_box :enable_language_detection, :class => "toggle-check" %>
|
||||
<%= f.check_box :enable_language_detection, :class => "toggle-check", data: {disabled: true} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -155,7 +155,7 @@
|
|||
<label class="control-label muted">Enable Language</label>
|
||||
<div class="controls">
|
||||
<% @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)}", disabled: true } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -164,7 +164,7 @@
|
|||
<label class="control-label muted">Default Language</label>
|
||||
<div class="controls">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= radio_button_tag "site[default_locale]", locale, @locale == locale ,:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}" } %>
|
||||
<%= radio_button_tag "site[default_locale]", locale, @locale == locale ,:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -270,7 +270,7 @@ namespace :new_ui do
|
|||
item['menu_enabled_for'] = \
|
||||
if item['menu_enabled_for'].present?
|
||||
VALID_LOCALES.inject({}) do |enable, locale|
|
||||
enable[locale] = Array(item['menu_enabled_for']).include?(locale)
|
||||
enable[locale] = Array(item['menu_enabled_for']).include?(locale.to_s)
|
||||
enable
|
||||
end
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue