Add disable for main title

This commit is contained in:
Christophe Vilayphiou 2012-07-26 15:37:29 +08:00
parent db9c4c0e10
commit 38804bd118
6 changed files with 37 additions and 20 deletions

View File

@ -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

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>

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 %>

View File

@ -33,6 +33,8 @@ en:
nccu: NCCU
nccu_c:
nccu_ldap_uid: NCCU LDAP Account
off_upcase: "OFF"
on_upcase: "ON"
or_lower: or
password: Password
register: Register

View File

@ -30,6 +30,8 @@ zh_tw:
nccu_ldap_uid: iNCCU帳號
no_: "No"
nothing:
off_upcase: "OFF"
on_upcase: "ON"
or_lower:
password: 密碼
register: 註冊

View File

@ -117,9 +117,9 @@ Orbit::Application.routes.draw do
get 'mail_setting'
get 'site_info'
get 'sitemap'
get 'sitemap_toggle', :on => :member
get 'system_info'
get 'ui_theme'
put 'sitemap_toggle', :on => :member
end
resources :snippets
resources :tags