patch_file/updatefiles/accessibility/orbit_bar/index.html.erb

348 lines
16 KiB
Plaintext

<% if params[:is_frontend_view] == "true" %>
<% OrbitHelper.render_css_in_head(["basic/icon","lib/orbit_bar/orbit-bar"]) %>
<% else %>
<%= stylesheet_link_tag "basic/icon" %>
<%= stylesheet_link_tag "lib/orbit_bar/orbit-bar" %>
<% end %>
<div id="orbit-bar">
<% if current_user.nil? %>
<label for="open-orbit-login" style="display:none;">Open login</label>
<input type="checkbox" title="open login" id="open-orbit-login">
<label for="open-orbit-login" class="cover"></label>
<div class="login-window">
<div class="login-header">
<label tabindex="0" for="open-orbit-login" class="close">close</label>
<h3><%= t(:login_orbit) %></h3>
</div>
<div class="login-body">
<%= form_tag "/sessions?locale=#{locale.to_s}", method: "post", :class => "container" do |f| %>
<div class="prepend input-group">
<span class="add input-group-addon"><i class="icon-user"></i></span>
<label for="user_user_id" style="display:none;">Username</label>
<input class="input" id="user_user_id" title="username" name="user_name" placeholder="<%= t("users.user_id") %>" size="30" title="username" type="text">
</div>
<div class="prepend input-group">
<span class="add input-group-addon"><i class="icon-lock"></i></span>
<label for="user_password" style="display:none;">Password</label>
<input class="input" id="user_password" name="password" placeholder="<%= t(:password) %>" title="password" size="30" type="password">
</div>
<div class="login-submit-wrap">
<div class="submit">
<button class="login-btn" type="submit"><%= t(:login) %></button>
</div>
<% if current_site.google_oauth_enabled %>
<div class="google-login">
<a class="login-btn" href="/auth/google_oauth2">
<i class="fa fa-google-plus"></i> Sign in
</a>
</div>
<% end %>
</div>
<% if !current_site.sign_up_roles.empty? %>
<div class="login-sign-up-btn"><a href="/users/new" rel="nofollow">Sign up now</a></div>
<% end %>
<% end %>
</div>
</div>
<% end %>
<input type="checkbox" id="open-orbit-nav" title="orbitbar">
<div class="orbit-bar-inner">
<label for="open-orbit-nav">
<i class="icons-list-2"></i>
</label>
<h2 class="orbit-bar-title">
<a href="/"><%= current_site.mobile_orbit_bar_title.nil? || current_site.mobile_orbit_bar_title == "" ? "Orbit" : current_site.mobile_orbit_bar_title %></a>
</h2>
<ul class="orbit-bar-menu">
<li>
<a class="orbit-bar-logo" href="#" title='<%= current_user.nil? ? ((I18n.locale.to_s =="zh_tw") ? "請登入以管理網站,按下開啟登入視窗" : "please login to manage web,click to open login window") : ((I18n.locale.to_s =="zh_tw") ? "按下關閉網站管理選單" : "click to close the menu for web manager") %>'>
<img src="<%= current_site.default_image.url.nil? ? '/assets/orbit-logo.png' : current_site.default_image.url %>" alt="Orbit Bar Logo" />
</a>
<% if !current_user.nil? %>
<ul>
<li>
<a href="/<%= locale.to_s %>/admin/dashboards">
<i class="icons-gauge"></i> <%= t(:dashboard_) %>
</a>
</li>
<li>
<a href="/<%= locale.to_s %>/admin/members?at=thumbnail">
<i class="icons-users"></i> <%= t(:community_) %>
</a>
</li>
<% if current_user.is_admin? %>
<li class="divider"></li>
<li>
<a href="/<%= locale.to_s %>/admin/sites" tabindex="-1">
<i class="icons-cog"></i> <%= t(:settings) %>
</a>
</li>
<% end %>
</ul>
<% end %>
</li>
<li>
<a href="/" class="orbit-bar-home">
<i class="icons-house"></i>
</a>
</li>
<% if !current_user.nil? && current_user.is_admin? && TicketStatus.unread.count > 0 %>
<li>
<a href="/admin/sites" class="orbit-bar-notification">
<i class="icons-mail"></i>
</a>
</li>
<% end %>
</ul>
<ul class="orbit-bar-search-sign-language">
<%
google_search_cx = current_site.search['sitesearch'] rescue nil
is_google_seach_cx = google_search_cx =~ /^[0-9]+\:[0-9A-Za-z]+$/
if !google_search_cx.blank? and is_google_seach_cx
%>
<li>
<form id="search" method="get" action="https://www.google.com/cse" target="_blank">
<input type="hidden" name="cx" value="<%= google_search_cx %>">
<label style="display:none;" for="q">Google Search</label>
<%= text_field_tag 'q', '', {:type => "search", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => '', :title => "search"} %>
</form>
</li>
<%
else
if !google_search_cx.blank? and !is_google_seach_cx
search_domain = google_search_cx
else
search_domain = request.host_with_port
end
%>
<li>
<form id="search" method="get" action="https://www.google.com/custom" target="_blank">
<input type="hidden" name="client" value="pub-&amp" />
<input type="hidden" name="ie" id="ie" value="utf-8" />
<input type="hidden" name="oe" id="oe" value="utf-8" />
<input type="hidden" name="cof" id="cof" value="AH:center;AWFID:03de271f1940eea3;" />
<input type='hidden' name='domains' value='<%= search_domain %>'>
<input type='hidden' name='sitesearch' value='<%= search_domain %>'>
<label style="display:none;" for="q">Google Search</label>
<%= text_field_tag 'q', '', {:type => "search", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => '', :title => "search"} %>
</form>
</li>
<% end %>
<li>
<% if current_site.enable_language_options %>
<% if @site_in_use_locales.count > 1 || current_site.enable_zh_cn %>
<% zh_cn_added = 0 %>
<% locale = session[:zh_cn] ? :zh_cn : I18n.locale %>
<a id="languagebutton" href="#" title='<%= (I18n.locale.to_s =="zh_tw") ? "按下關閉語言選單" : "click to close language menu" %>'><span id="language"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span></a>
<ul>
<% @site_in_use_locales.each do |l| %>
<%
case l
when :en
accesskey = "e"
when :zh_tw
accesskey = "t"
end
%>
<% if l.to_s == I18n.locale.to_s and !session['zh_cn'] %>
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
<%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %>
</li>
<% else %>
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
<a accesskey="<%= accesskey %>" href="<%= switch_language(l) %>"><%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %></a>
</li>
<% end %>
<% if current_site.enable_zh_cn and zh_cn_added == 0 and !request.path.include?("/admin/") %>
<% zh_cn_added = 1 %>
<% accesskey = "s" %>
<% if locale == :zh_cn %>
<li class="active">
<%= t(:zh_cn, :locale => :zh_tw) %>
</li>
<% else %>
<li>
<a accesskey="<%= accesskey %>" href="<%= switch_language(:zh_cn) %>"><%= t(:zh_cn, :locale => :zh_tw) %></a>
</li>
<% end %>
<% end %>
<% end %>
</ul>
<% end %>
<% end %>
</li>
<% if !current_user.nil? %>
<li>
<span id="user"><%= current_user.member_profile.name.nil? ? current_user.user_name : current_user.member_profile.name %></span>
<ul>
<li><%= link_to content_tag(:i, nil, class: 'icons-tools') + ' ' + t("users.change_passwd"),admin_member_edit_passwd_path(current_user.member_profile.to_param), tabindex: '-1' %></li>
<li><%= link_to content_tag(:i, nil, class: 'icons-vcard') + ' ' + t("users.user_basic_data"),admin_member_path(current_user.member_profile.to_param), tabindex: '-1' %></li>
<% if current_user.is_admin? && params[:is_frontend_view] == "true" %>
<li>
<% if params[:editmode] == "on" %>
<a tabindex="-1" href="<%= request.fullpath.split("?").first %>" style="color:red;"><i class="icons-bolt"></i>Edit Mode Off</a>
<% else %>
<a tabindex="-1" href="<%= request.fullpath + "#{(request.query_parameters.empty? ? "?" : "&")}editmode=on" %>"><i class="icons-bolt"></i>Edit Mode On</a>
<% end %>
</li>
<% end %>
<li>
<a href="/logout"><i class="icons-logout"></i><%= t(:logout) %></a>
</li>
</ul>
</li>
<li style="line-height:2.5em;"> <a href="/logout" style="color:white;font-size:0.8em"><%= t(:logout) %><i class="icons-logout"></i></a></li>
<% else %>
<li style="margin-right:-1em;">
<a id="accesskey_login" class="sr-only" accesskey="L" href="#" title="Login">:::</a>
<a id="loginbutton" href="#" title='<%= (I18n.locale.to_s =="zh_tw") ? "按下開啟登入視窗" : "click to open login window" %>'>
<label for="open-orbit-login">
<i style="font-style: inherit;font-size: 0.8rem;width: 30px;text-align: right;vertical-align: middle;"><%= t(:login) %></i>
<i class="icons-login" style="font-size: 1.4em;width: 30px;text-align: left;vertical-align: middle;"></i>
</label>
</a>
</li>
<% end %>
</ul>
</div>
</div>
<style>
@media (max-width: 540px) {#orbit-bar ul.orbit-bar-search-sign-language > li + li{width:33.3333%;}}
</style>
<% if current_user.nil?%>
<script>$('.orbit-bar-logo').off('click').on('click',function(){$("#open-orbit-login").click()});</script>
<% else %>
<script>
var opentitle = '<%= (I18n.locale.to_s =="zh_tw") ? "按下開啟網站管理選單" : "click to open the menu for web manager" %>'
var closetitle = '<%= (I18n.locale.to_s =="zh_tw") ? "按下關閉網站管理選單" : "click to close the menu for web manager" %>'
$('.orbit-bar-logo').off('click').on('click',function(){
if ($(this).parent().find('>ul').hasClass('show')) {
$(this).parent().find('>ul').removeClass('show');
$(this).attr('title',opentitle);
} else {
$(this).parent().parent().find('>li>ul').removeClass('show');
$(this).parent().find('>ul').addClass('show');
$(this).attr('title',closetitle);
}});
$('.orbit-bar-logo').parent().parent().find('>li>a').parent().addClass('showlist');
$('.orbit-bar-logo').parent().parent().find('>li>').focus(function(e) {
e.stopPropagation();
$(this).parent().focus();
if ($(this).parent().find('>ul').hasClass('show')) {
} else {
$(this).parent().parent().find('>li>ul').removeClass('show');
$(this).parent().find('>ul').addClass('show');
}
});
/* 逆向tab離開$('.orbit-bar-logo')時,會將其下層ul收起 start */
$('*').focus(function(e) {
e.stopPropagation();
if(!$(this).parent().hasClass('showlist') && !$(this).parent().parent().parent().hasClass('showlist') ){
$('.orbit-bar-logo').parent().parent().find('>li>ul').removeClass('show');
}
});
/* 逆向tab離開$('.orbit-bar-logo')時,會將其下層ul收起 end */
$('.orbit-bar-logo').focus(function(){
if ($(this).parent().find('>ul').hasClass('show')) {
$(this).attr('title',closetitle);
} else {
$(this).attr('title',opentitle);
}
});
</script>
<%end%>
<script type="text/javascript">
var opentitle = '<%= (I18n.locale.to_s =="zh_tw") ? "按下開啟語言選單" : "click to open language menu" %>'
var closetitle = '<%= (I18n.locale.to_s =="zh_tw") ? "按下關閉語言選單" : "click to close language menu" %>'
$('#languagebutton').off('click').on('click',function(){
if ($(this).parent().find('>ul').hasClass('show')) {
$(this).parent().find('>ul').removeClass('show');
$(this).attr('title',opentitle);
} else {
$(this).parent().parent().find('>li>ul').removeClass('show');
$(this).parent().find('>ul').addClass('show');
$(this).attr('title',closetitle);
}});
$('#languagebutton').parent().parent().find('>li>a').parent().addClass('showli');
$('#languagebutton').parent().parent().find('>li>').focus(function(e) {
e.stopPropagation();
$(this).parent().focus();
if ($(this).parent().find('>ul').hasClass('show')) {
} else {
$(this).parent().parent().find('>li>ul').removeClass('show');
$(this).parent().find('>ul').addClass('show');
}
});
/* 逆向tab離開$('#languagebutton')時,會將其下層ul收起 start */
$('*').focus(function(e) {
e.stopPropagation();
if(!$(this).parent().hasClass('showli') && !$(this).parent().parent().parent().hasClass('showli') ){
$('#languagebutton').parent().parent().find('>li>ul').removeClass('show');
}
});
/* 逆向tab離開$('#languagebutton')時,會將其下層ul收起 end */
$('#languagebutton').focus(function(){
if ($(this).parent().find('>ul').hasClass('show')) {
$(this).attr('title',closetitle);
} else {
$(this).attr('title',opentitle);
}
});
/* when tab key choose close,press enter to close login window start */
function closelabel(e){
var keynum;
if(window.event) // IE
{
keynum = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera/chrome
{
keynum = e.which
}
if( keynum == 13 ){
$("#open-orbit-login").click();
};
}
$('label.close').attr('onkeydown','closelabel(event)');
/* when tab key choose close,press enter to close login window end */
$('#loginbutton >label').off('click').on('click',function(){$("#open-orbit-login").click()});
$('#loginbutton').off('click').on('click',function(){$("#open-orbit-login").click()});
$("#open-orbit-login").on("change",function(){
if($(this).is(":checked")){
/* press esc to close login window start */
$(window).off('keydown').on('keydown',function(event){
var e = event;
var keynum;
if(window.event) // IE
{
keynum = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera/chrome
{
keynum = e.which
}
if( keynum == 27 ){
$("#open-orbit-login").click();
};
});
$("#user_user_id").focus(); //when open login window,focus on the username
}else
$(window).off('keydown');
/* press esc to close login window end */
})
$(".login-body form").on("submit",function(){
$(this).append("<input type='hidden' name='referer_url' value='<%= request.original_url %>'/>");
})
<%
for_js = @site_in_use_locales.map{|l| l.to_s}
for_js << "zh_cn" if current_site.enable_zh_cn
%>
var I18n = {
get locale(){ return "<%= (session[:locale] == 'zh_tw' ? (session[:zh_cn] ? 'zh_cn' : 'zh_tw' ) : session[:locale]) %>"},
get validLocales(){return <%= for_js.to_json.html_safe %>},
set locale(v){return false},
set validLocales(v){return false}
};
</script>