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

486 lines
24 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)+' ' +((current_site.title.nil? && current_site.title.blank? && current_site.mobile_orbit_bar_title.nil? && current_site.mobile_orbit_bar_title.blank?) ? "Orbit" : [current_site.mobile_orbit_bar_title,current_site.title].select{|title| !title.nil? && !title.blank?}.first) %></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" <%=((current_site.orbit_bar_background_color.blank? rescue true) ? nil : "style=background-color:#{current_site.orbit_bar_background_color};")%>>
<label for="open-orbit-nav" <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_text_color};border-color:#{current_site.orbit_bar_text_color};")%>>
<i class="icons-list-2"></i>
</label>
<h2 class="orbit-bar-title">
<a href="/" <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_text_color};")%>><%= (current_site.title.nil? && current_site.title.blank? && current_site.mobile_orbit_bar_title.nil? && current_site.mobile_orbit_bar_title.blank?) ? "Orbit" : [current_site.mobile_orbit_bar_title,current_site.title].select{|title| !title.nil? && !title.blank?}.first %></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 class="sub_orbit_bar">
<li>
<a href="/<%= locale.to_s %>/admin/dashboards" class="sub_orbit_bar_text">
<i class="icons-gauge"></i> <%= t(:dashboard_) %>
</a>
</li>
<li>
<a href="/<%= locale.to_s %>/admin/members?at=thumbnail" class="sub_orbit_bar_text">
<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" class="sub_orbit_bar_text">
<i class="icons-cog"></i> <%= t(:settings) %>
</a>
</li>
<% end %>
</ul>
<% end %>
</li>
<li>
<a href="/" class="orbit-bar-home" <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_text_color};")%>>
<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" <%=((current_site.orbit_bar_background_color.blank? rescue true) ? nil : "style=background-color:#{current_site.orbit_bar_background_color};")%>>
<style>
@media screen and (min-width:539px){
.orbit-bar-search-sign-language{
max-height:100%;
}
}
</style>
<%
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 style="background-color:transparent;">
<form id="search" method="get" action="https://www.google.com/custom" target="_blank" <%=((current_site.orbit_bar_background_color.blank? rescue true) ? nil : "style=border:0;")%>>
<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 style="background-color:transparent;" <%= current_user.nil? ? 'class=mobile_login_bar' : nil %>>
<% 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" <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_text_color};")%>><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span></a>
<ul <%=((current_site.orbit_bar_submenu_background_color.blank? rescue true) ? nil : "style=background-color:#{current_site.orbit_bar_submenu_background_color};")%>>
<% @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" : "" %>" <%=(current_site.orbit_bar_submenu_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_submenu_text_color}!important;"%>>
<%= 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) %>" <%=(current_site.orbit_bar_submenu_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_submenu_text_color}!important;"%>><%= 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) %>" <%=(current_site.orbit_bar_submenu_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_submenu_text_color}!important;"%>><%= t(:zh_cn, :locale => :zh_tw) %></a>
</li>
<% end %>
<% end %>
<% end %>
</ul>
<% end %>
<% end %>
</li>
<% if !current_user.nil? %>
<li style="background-color:transparent;")>
<span id="user" <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_text_color};")%>><%= current_user.member_profile.name.nil? ? current_user.user_name : current_user.member_profile.name %></span>
<ul <%=((current_site.orbit_bar_submenu_background_color.blank? rescue true) ? nil : "style=background-color:#{current_site.orbit_bar_submenu_background_color};")%>>
<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' , style: ((current_site.orbit_bar_submenu_text_color.blank? rescue true) ? nil : "color:#{current_site.orbit_bar_submenu_text_color};") %></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' , style: ((current_site.orbit_bar_submenu_text_color.blank? rescue true) ? nil : "color:#{current_site.orbit_bar_submenu_text_color};") %></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" %>" <%=(current_site.orbit_bar_submenu_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_submenu_text_color};"%>><i class="icons-bolt"></i>Edit Mode On</a>
<% end %>
</li>
<% end %>
<li>
<a href="/logout" <%=(current_site.orbit_bar_submenu_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_submenu_text_color};"%>><i class="icons-logout"></i><%= t(:logout) %></a>
</li>
</ul>
</li>
<li style='line-height:2.5em;background-color:transparent;'> <a href="/logout" style="color:white;font-size:0.8em"><span <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_text_color};")%>><%= t(:logout) %></span><i class="icons-logout" <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : " style=color:#{current_site.orbit_bar_text_color};")%>></i></a></li>
<% else %>
<li style="margin-right:-1em;" class="mobile_login_bar">
<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" <%=((current_site.orbit_bar_text_color.blank? rescue true) ? nil : "style=color:#{current_site.orbit_bar_text_color};")%>>
<i style="font-style: inherit;font-size: 0.8rem;width: 2.875em;text-align: right;vertical-align: middle;"><%= t(:login) %></i>
<i class="icons-login" style="font-size: 1.4em;width: 1.875em;text-align: left;vertical-align: middle;"></i>
</label>
</a>
</li>
<% end %>
</ul>
</div>
</div>
<% if(current_site.is_hidden_orbit_bar && !current_site.orbit_bar_background_color.blank? rescue false) %>
<div class="orbitbar-line" style="background-color:<%=current_site.orbit_bar_background_color%>;height: 0.3em;position: fixed;z-index: 1000;width: 100%;top: 0;"></div>
<% end %>
<style>
@media (max-width: 538px) {#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>
<% if current_site.is_hidden_orbit_bar %>
<style>
.orbit-bar--active {
margin-top: 2.5em !important;
}
.orbit-bar--active .orbit-bar-toggle-icon {
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
-webkit-transform-origin: center 0.5625em;
transform-origin: center 0.5625em;
}
.has-orbit-bar .orbit-bar-inner {
margin-top: -2.5em;
}
.has-orbit-bar .orbit-bar-inner {
-webkit-transition: <%=current_site.orbit_bar_animation_time.blank? ? '0.3s' : current_site.orbit_bar_animation_time rescue '0.3s' %> all ease-in;
transition: <%=current_site.orbit_bar_animation_time.blank? ? '0.3s' : current_site.orbit_bar_animation_time rescue '0.3s' %> all ease-in;
}
.orbit-bar--active .orbit-bar-inner {
margin-top: 0;
}
body {
-webkit-transition: <%=current_site.orbit_bar_animation_time.blank? ? '0.3s' : current_site.orbit_bar_animation_time rescue '0.3s' %> margin ease-in;
transition: <%=current_site.orbit_bar_animation_time.blank? ? '0.3s' : current_site.orbit_bar_animation_time rescue '0.3s' %> margin ease-in;
margin-top: 0 !important;
}
.has-orbit-bar .orbit-bar-toggle:hover {
background-color: <%=current_site.orbit_bar_background_color.blank? ? '#144893' : current_site.orbit_bar_background_color rescue '#144893' %>;
opacity: 1;
}
.has-orbit-bar .orbit-bar-toggle {
-webkit-transition: <%=current_site.orbit_bar_animation_time.blank? ? '0.3s' : current_site.orbit_bar_animation_time rescue '0.3s' %> all ease-in;
transition: <%=current_site.orbit_bar_animation_time.blank? ? '0.3s' : current_site.orbit_bar_animation_time rescue '0.3s' %> all ease-in;
position: absolute;
top: 0;
right: 0;
cursor: pointer;
color: <%=current_site.orbit_bar_text_color.blank? ? '#fff' : current_site.orbit_bar_text_color rescue '#fff' %>;
padding: 0.3125em 0.625em;
background-color: <%=current_site.orbit_bar_background_color.blank? ? '#144893' : current_site.orbit_bar_background_color rescue '#144893' %>;
opacity: 0.5;
}
.orbit-bar--active .orbit-bar-toggle {
opacity: 1;
top: 2.5em;
}
</style>
<% if !(OrbitHelper.request || request).env["REQUEST_URI"].include?('admin') %>
<script>
var barState = window.localStorage.getItem('barState');
function extendBar() {
var $bar = $('#orbit-bar');
var activeCls = 'orbit-bar--active';
var noAnimationCls = 'orbit-bar--no-animation';
var openState = 'open';
var closeState = 'close';
var $body = $(document.body);
function createToggle() {
var $el = $('<div class="orbit-bar-toggle"><i class="orbit-bar-toggle-icon fa fa-chevron-down"></i></div>');
$el.on('click', function(e) {
e.preventDefault();
$body.removeClass(noAnimationCls);
if (!$body.hasClass(activeCls)) {
$body.addClass(activeCls);
window.localStorage.setItem('barState', openState);
} else {
$body.removeClass(activeCls);
window.localStorage.setItem('barState', closeState);
}
$('.orbitbar-line').slideToggle();
});
$bar.prepend($el);
}
$body.addClass('has-orbit-bar');
$bar.find('.orbit-bar-inner').show();
// check bar state from localstorage
if (barState) {
if (barState === openState) {
$body.addClass(activeCls);
$body.addClass(noAnimationCls);
} else {
$body.removeClass(activeCls);
}
}
createToggle();
};
$(document).ready(function(){
if($('body').attr('id') != 'sideset')
extendBar();
})
</script>
<% end %>
<% end %>
<style>
@media screen and (min-width:539px){
<% if(!current_site.orbit_bar_submenu_background_color.blank? rescue false)%>
.sub_orbit_bar{
background-color:<%=current_site.orbit_bar_submenu_background_color %>!important;
}
.orbit-bar-menu{
background-color:transparent!important;
}
<%end%>
<% if(!current_site.orbit_bar_submenu_text_color.blank? rescue false)%>
.sub_orbit_bar_text{
color:<%=current_site.orbit_bar_submenu_text_color%>!important;
}
<%end%>
}
@media screen and (max-width:538px){
<% if(!current_site.orbit_bar_background_color.blank? rescue false)%>
.sub_orbit_bar{
background-color:<%=current_site.orbit_bar_background_color%>!important;
}
.orbit-bar-menu{
background-color:<%=current_site.orbit_bar_background_color%>!important;
}
<%end%>
<% if(!current_site.orbit_bar_text_color.blank? rescue false)%>
.sub_orbit_bar_text{
color:<%=current_site.orbit_bar_text_color%>!important;
}
<%end%>
.mobile_login_bar{
width: 50%!important;
}
}
</style>