导航条下拉菜单. [Version] alpha v0.1

This commit is contained in:
yanxd 2014-01-20 20:25:27 +08:00
parent d357541bb8
commit d202c84b44
5 changed files with 84 additions and 3 deletions

View File

@ -5,10 +5,48 @@
<div id="account">
<%= render_menu :account_menu -%>
</div>
<%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
<% if User.current.logged? -%>
<div id="loggedas">
<ul style="padding:0 0; margin:0 0;display:inline;">
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;" class="loggedas_li">
<%=link_to_user(User.current)%>
<ul class="sub_menu">
<% if User.current.user_extensions && [0,1].include?(User.current.user_extensions.identity) -%>
<li><%=link_to l(:label_my_course), user_courses_user_path(User.current), target:'my_path' %></li>
<% end -%>
<li><%=link_to l(:label_my_projects), user_projects_user_path(User.current), target:'my_path' %></li>
<li><%=link_to l(:label_user_edit), my_account_path, target:'my_path' %></li>
</ul>
</li>
</ul>
</div>
<% end -%>
<%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
</div>
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 0px;margin-top: -10px;"></div>
<div style="clear:left;"></div>
<script type="text/javascript">
function setMessageCount () {
var mes = $('#account .my-message')
mes.html(mes.html()+'('+<%=User.current.count_new_jour.to_s%>+")")
}
function addSlipMenu () {
var loggedas = $('#loggedas')
var sub_menu = $('.sub_menu')
loggedas.mouseenter(function(event) {
sub_menu.show();
});
sub_menu.mouseleave(function(event) {
sub_menu.hide();
});
}
$(document).ready(function () {
setMessageCount();
addSlipMenu();
});
</script>

View File

@ -541,6 +541,7 @@ en:
label_home: Home
label_my_page: My page
label_my_account: My account
label_my_message: My messages
label_my_projects: My projects
label_my_page_block: My page block
label_administration: Administration

View File

@ -567,6 +567,7 @@ zh:
#end
label_my_page: 我的工作台
label_my_account: 我的帐号
label_my_message: 留言
label_my_projects: 我的项目
label_my_page_block: 我的工作台模块
label_administration: 管理

View File

@ -261,6 +261,7 @@ Redmine::MenuManager.map :account_menu do |menu|
menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? }
menu.push :register, :register_path, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
# menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
menu.push :my_message, { :controller => 'users', :action => 'user_newfeedback', id: User.current.id }, :if => Proc.new { User.current.logged? }
menu.push :logout, :signout_path, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? }
end
########fq

View File

@ -2184,4 +2184,44 @@ ul.messages-for-user-reply li {
float: left;
margin: 0;
padding: 0;
}
#loggedas ul{
width:115px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
#loggedas li {
border-bottom: 1px solid #129DAD;
color: white;
list-style: none ;
width: 90%;
padding: 6px 0px;
margin-left: 5%;
}
#loggedas li span{
cursor: pointer;
}
#loggedas ul:first-child {
border-top: 1px solid #12A7B8;
}
#loggedas li.last_child {
}
#loggedas .sub_menu {
box-shadow: 2px 2px 6px #b0b0b0 ;
display: none;
background: #13AEBF 0 0 no-repeat;
left: 78.5%;
padding-bottom: 5px;
position: absolute;
top: 40px;
font-size: 1.1em;
margin: 0px;
padding: 0px 0px;
text-align: center;
z-index: 1;
}
#loggedas .sub_menu a{
margin: 0px;
}