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