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 = Item.find(params[:id])
@item.sitemap_enabled = !@item.sitemap_enabled @item.sitemap_enabled = !@item.sitemap_enabled
@item.save @item.save
render :nothing => true
end end
def system_info def system_info

View File

@ -1,11 +1,11 @@
<div class="map-block"> <div class="map-block">
<h4><%= sitemap_block.i18n_variable[I18n.locale] %></h4> <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> <ul>
<% sitemap_block.children.each do |child| %> <% sitemap_block.children.each do |child| %>
<li class="clear"> <li class="clear <%= 'disabled' if !child.sitemap_enabled %>">
<%= child.i18n_variable[I18n.locale] %> <%= child.i18n_variable[I18n.locale] %>
<button id="<%= child.id %>" class="onoff pull-right"> <button id="<%= child.id %>" class="onoff pull-right">
<%= child.sitemap_enabled ? t('on_cap') : t('off_cap') %> <%= child.sitemap_enabled ? t('on_upcase') : t('off_upcase') %>
</button> </button>
</li> </li>
<% end if sitemap_block.children %> <% end if sitemap_block.children %>

View File

@ -17,14 +17,26 @@
isAnimated: true isAnimated: true
}); });
}); });
$(document).on('click', '.onoff', function () { $(document).on('click', 'li .onoff', function () {
$(this).parents("li").toggleClass("disabled"); $(this).parents("li").toggleClass("disabled");
if($(this).parents("li").attr("class").indexOf("disabled") > 0){ if($(this).parents("li").attr("class").indexOf("disabled") > 0){
$(this).text('OFF') $(this).text("<%= t('off_upcase') %>")
} else { } else {
$(this).text('ON') $(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') %>")
} }
$.getScript('admin_sites_path' + '/' + $(this).attr('id') + '/sitemap_toggle');
}); });
</script> </script>
<% end %> <% end %>

View File

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

View File

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

View File

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