Add disable for main title

This commit is contained in:
Christophe Vilayphiou committed 2012-07-27 19:13:39 +08:00
1 parent db9c4c0e10
commit 38804bd118
6 files changed
+37 -20

No files matched your search

@@ -35,6 +35,7 @@ class Admin::SitesController < ApplicationController
@item = Item.find(params[:id])
@item.sitemap_enabled = !@item.sitemap_enabled
@item.save
render :nothing => true
end
def system_info
+11 -11
View File
@@ -1,13 +1,13 @@
<div class="map-block">
<h4><%= sitemap_block.i18n_variable[I18n.locale] %></h4>
<ul>
<% sitemap_block.children.each do |child| %>
<li class="clear">
<%= child.i18n_variable[I18n.locale] %>
<button id="<%= child.id %>" class="onoff pull-right">
<%= child.sitemap_enabled ? t('on_cap') : t('off_cap') %>
</button>
</li>
<% end if sitemap_block.children %>
</ul>
<h4><%= sitemap_block.i18n_variable[I18n.locale] %><button class="onoff pull-right"><%= sitemap_block.sitemap_enabled ? t('on_upcase') : t('off_upcase') %></button></h4>
<ul>
<% sitemap_block.children.each do |child| %>
<li class="clear <%= 'disabled' if !child.sitemap_enabled %>">
<%= child.i18n_variable[I18n.locale] %>
<button id="<%= child.id %>" class="onoff pull-right">
<%= child.sitemap_enabled ? t('on_upcase') : t('off_upcase') %>
</button>
</li>
<% end if sitemap_block.children %>
</ul>
</div>
+20 -8
View File
@@ -17,14 +17,26 @@
isAnimated: true
});
});
$(document).on('click', '.onoff', function () {
$(this).parents("li").toggleClass("disabled");
if($(this).parents("li").attr("class").indexOf("disabled") > 0){
$(this).text('OFF')
} else {
$(this).text('ON')
}
$.getScript('admin_sites_path' + '/' + $(this).attr('id') + '/sitemap_toggle');
$(document).on('click', 'li .onoff', function () {
$(this).parents("li").toggleClass("disabled");
if($(this).parents("li").attr("class").indexOf("disabled") > 0){
$(this).text("<%= t('off_upcase') %>")
} else {
$(this).text("<%= t('on_upcase') %>")
}
$.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle');
});
$(document).on('click', 'h4 .onoff', function () {
$(this).parents(".map-block").toggleClass("disabled");
if($(this).parents("h4").parents("div").attr("class").indexOf("disabled") > 0){
$(this).text("<%= t('off_upcase') %>")
$(this).parents(".map-block").find('li').addClass('disabled')
$(this).parents(".map-block").find('button').text("<%= t('off_upcase') %>")
} else {
$(this).text("<%= t('on_upcase') %>")
$(this).parents(".map-block").find('li').removeClass('disabled')
$(this).parents(".map-block").find('button').text("<%= t('on_upcase') %>")
}
});
</script>
<% end %>