342 lines
15 KiB
Plaintext
342 lines
15 KiB
Plaintext
<% if params[:is_frontend_view] == "true" %>
|
|
<% OrbitHelper.render_css_in_head(["basic/icon","lib/orbit_bar/orbit-bar-mobile"]) %>
|
|
<% 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-mobile" %>
|
|
<%= stylesheet_link_tag "lib/orbit_bar/orbit-bar" %>
|
|
<% end %>
|
|
<div id="orbit-bar">
|
|
<% if current_user.nil? %>
|
|
<input type="checkbox" id="open-orbit-login">
|
|
<label for="open-orbit-login" class="cover"></label>
|
|
<div class="login-window">
|
|
<div class="login-header">
|
|
<label 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>
|
|
<input class="input" id="user_user_id" name="user_name" placeholder="<%= t("users.user_id") %>" size="30" type="text">
|
|
</div>
|
|
<div class="prepend input-group">
|
|
<span class="add input-group-addon"><i class="icon-lock"></i></span>
|
|
<input class="input" id="user_password" name="password" placeholder="<%= t(: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>
|
|
<div class="login-sign-up-btn"><a href="/users/new">Sign up now</a></div>
|
|
<% end %>
|
|
</div>
|
|
|
|
</div>
|
|
<% end %>
|
|
<input type="checkbox" id="open-orbit-nav">
|
|
<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>
|
|
<span class="orbit-bar-logo">
|
|
<img src="<%= current_site.default_image.url.nil? ? '/assets/orbit-logo.png' : current_site.default_image.url %>" alt="Orbit Bar Logo" />
|
|
</span>
|
|
<% 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 %>">
|
|
<%= text_field_tag 'q', '', {:type => "search", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => ''} %>
|
|
</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-&" />
|
|
<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 %>'>
|
|
<%= text_field_tag 'q', '', {:type => "search", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => ''} %>
|
|
</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 %>
|
|
<span id="language"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span>
|
|
<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" style="float:left;"><%= current_user.member_profile.name.nil? ? current_user.user_name : current_user.member_profile.name %></span>
|
|
<span style="vertical-align: -webkit-baseline-middle;"><a href="/logout" style="color:white;"><i style="vertical-align:middle;font-style: inherit;"><%= t(:logout) %></i><i class="icons-logout" style="vertical-align:middle;"></i></a></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>
|
|
<% else %>
|
|
<li>
|
|
<a id="accesskey_login" class="sr-only" accesskey="L" href="/<%= "#{locale.to_s}" %>/accesskey" title="Login">:::</a>
|
|
<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>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
|
|
|
|
<ul class="orbit-bar-mobile-sign-language">
|
|
<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 %>
|
|
<span id="language" class="mobile-button"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span>
|
|
<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" class="mobile-button"><i class="icons-user"></i><span><%= current_user.member_profile.name.nil? ? current_user.user_name : current_user.member_profile.name %></span></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>
|
|
<% else %>
|
|
<li>
|
|
<a id="accesskey_login" class="sr-only" accesskey="L" href="/<%= "#{locale.to_s}" %>/accesskey" title="Login">:::</a>
|
|
<label for="open-orbit-login">
|
|
<i class="icons-login"></i>
|
|
</label>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$("#open-orbit-login").on("change",function(){
|
|
if($(this).is(":checked")){
|
|
$("#user_user_id").focus();
|
|
}
|
|
})
|
|
$(".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>
|
|
|
|
|
|
<!-- ika modify -->
|
|
<script type="text/javascript">
|
|
// reset orbit-nav check
|
|
$( "#open-orbit-nav" ).prop( "checked", false );
|
|
|
|
|
|
$('.orbit-bar-mobile-sign-language .mobile-button').click(function(){
|
|
$('.orbit-bar-mobile-sign-language .mobile-button').not($(this)).removeClass('toggled');
|
|
$('.orbit-bar-mobile-sign-language .mobile-button').not($(this)).siblings('ul').removeClass('show');
|
|
// $('.orbit-bar-menu').hide();
|
|
// $('.orbit-bar-search-sign-language').hide();
|
|
$( "#open-orbit-nav" ).prop( "checked", false );
|
|
$('.sidebar2').removeClass('menu-toggle');
|
|
$(this).toggleClass('toggled');
|
|
$(this).siblings('ul').toggleClass('show');
|
|
});
|
|
|
|
$('#open-orbit-nav').click(function(){
|
|
$( "#dashboards #open-orbit-nav" ).prop( "checked", false );
|
|
$( "#users #open-orbit-nav" ).prop( "checked", false );
|
|
$( "#sideset #open-orbit-nav" ).prop( "checked", false );
|
|
|
|
$('.orbit-bar-mobile-sign-language .mobile-button').removeClass('toggled');
|
|
$('.orbit-bar-mobile-sign-language li ul').removeClass('show');
|
|
$('#dashboards .orbit-bar-menu').hide();
|
|
$('#dashboards .orbit-bar-search-sign-language').hide();
|
|
|
|
$('body').toggleClass('noScroll');
|
|
//show menu
|
|
$('.sidebar2').toggleClass('menu-toggle');
|
|
})
|
|
|
|
$('.sub-nav-block h4').click(function(){
|
|
$('.sub-nav-block h4').not($(this)).siblings($('.nav-list')).slideUp();
|
|
$(this).siblings($('.nav-list')).slideDown();
|
|
})
|
|
</script>
|
|
|