From 62c663d6993692ea47de9fd2e7c452bf5cde5e5c Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 30 Oct 2013 17:26:31 +0800 Subject: [PATCH] Fix for togglebox and menu_enabled_for --- .../javascripts/basic/orbit_js_1.0.1.js | 74 ++++++++++--------- app/assets/stylesheets/lib/togglebox.css | 4 +- app/views/admin/sites/_sitemap_block.html.erb | 8 +- app/views/admin/sites/preference.html.erb | 16 ++-- lib/tasks/new_ui.rake | 2 +- 5 files changed, 53 insertions(+), 51 deletions(-) diff --git a/app/assets/javascripts/basic/orbit_js_1.0.1.js b/app/assets/javascripts/basic/orbit_js_1.0.1.js index ace3de4b..9626619b 100644 --- a/app/assets/javascripts/basic/orbit_js_1.0.1.js +++ b/app/assets/javascripts/basic/orbit_js_1.0.1.js @@ -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'); + // }; + // }); }, }); }; diff --git a/app/assets/stylesheets/lib/togglebox.css b/app/assets/stylesheets/lib/togglebox.css index 04249ea3..865b746f 100644 --- a/app/assets/stylesheets/lib/togglebox.css +++ b/app/assets/stylesheets/lib/togglebox.css @@ -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, diff --git a/app/views/admin/sites/_sitemap_block.html.erb b/app/views/admin/sites/_sitemap_block.html.erb index 7e76a737..fabbfe6f 100644 --- a/app/views/admin/sites/_sitemap_block.html.erb +++ b/app/views/admin/sites/_sitemap_block.html.erb @@ -1,13 +1,13 @@ -
  • +
  • - + <%= 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"} %> <%= sitemap_block_counter + 1 %> <%= sitemap_block.title_translations[temp_locale] %>