右上角菜单增加二级菜单

This commit is contained in:
nwb 2014-07-07 13:41:44 +08:00
parent 633c4278d8
commit bc179fbc39
4 changed files with 109 additions and 7 deletions

View File

@ -256,8 +256,8 @@ module CoursesHelper
people
end
# 截至到2014-03-17 这个是最终的判断课程是否过期的方法
def course_endTime_timeout? project
end_time_str = Course.find_by_extra(project.try(:extra)).try(:endup_time)
def course_endTime_timeout? course
end_time_str = course.try(:endup_time)
begin
cTime = Time.parse(end_time_str.to_s)
rescue TypeError,ArgumentError

View File

@ -29,7 +29,7 @@ class Journal < ActiveRecord::Base
# end
attr_accessor :indice
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.inProjectIndex}#{status}: #{o.issue.subject}" },
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" },
:description =>:notes,
:author => :user,
:group => :issue,

View File

@ -41,10 +41,25 @@
<%=link_to_user(User.current)%>
<ul class="sub_menu">
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<li><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %></li>
<li id="course_loggedas_li"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li><%= link_to course.name, course_path(course) %></li>
<% end %>
<% end %>
</ul>
</li>
<% end -%>
<li><%=link_to l(:label_my_projects),{:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %></li>
<li><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%></li>
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<ul class="project_sub_menu">
<% User.current.projects.each do |project| %>
<li><%= link_to project.name, project_path(project) %></li>
<% end %>
</ul>
</li>
<li><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
</ul>
</li>
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
@ -77,11 +92,40 @@
});
}
function addProjectSlipMenu () {
var loggedas = $('#project_loggedas_li')
var project_sub_menu = $('.project_sub_menu')
var course_sub_menu = $('.course_sub_menu')
loggedas.mouseenter(function(event) {
course_sub_menu.hide();
project_sub_menu.show();
});
project_sub_menu.mouseleave(function(event) {
project_sub_menu.hide();
});
}
function addCourseSlipMenu () {
var loggedas = $('#course_loggedas_li')
var project_sub_menu = $('.project_sub_menu')
var course_sub_menu = $('.course_sub_menu')
loggedas.mouseenter(function(event) {
project_sub_menu.hide();
course_sub_menu.show();
});
course_sub_menu.mouseleave(function(event) {
course_sub_menu.hide();
});
}
$(document).ready(function () {
addSlipMenu();
addProjectSlipMenu ();
addCourseSlipMenu();
});
jQuery(document).ready(function($) {
$('.sub_menu').find("a").attr('target', '_blank');
$('.project_sub_menu').find("a").attr('target', '_blank');
$('.course_sub_menu').find("a").attr('target', '_blank');
});
</script>

View File

@ -2158,8 +2158,66 @@ ul.messages-for-user-reply li {
#loggedas .sub_menu a{
margin: 0px;
}
.sub_menu li{
width: 90%;
width: 90%;
}
#project_loggedas_li .project_sub_menu {
box-shadow: 2px 2px 6px #b0b0b0 ;
display: none;
background: #13AEBF 0 0 no-repeat;
left: 115px;
padding-bottom: 5px;
position: absolute;
top: 40px;
font-size: 1.1em;
margin: 0px auto;
padding: 0px 0px;
text-align: left;
z-index: 1;
}
#project_loggedas_li .project_sub_menu a{
margin: 0px;
}
#project_loggedas_li li {
border-bottom: 1px solid #129DAD;
color: white;
list-style: none ;
padding: 6px 0px;
margin-left: 5%;
font-size: 0.8em;
width: 90%;
line-height: 15px;
}
#course_loggedas_li .course_sub_menu {
box-shadow: 2px 2px 6px #b0b0b0 ;
display: none;
background: #13AEBF 0 0 no-repeat;
left: 115px;
padding-bottom: 5px;
position: absolute;
top: 0px;
font-size: 1.1em;
margin: 0px auto;
padding: 0px 0px;
text-align: left;
z-index: 1;
}
#course_loggedas_li .course_sub_menu a{
margin: 0px;
}
#course_loggedas_li li {
border-bottom: 1px solid #129DAD;
color: white;
list-style: none ;
padding: 6px 0px;
margin-left: 5%;
font-size: 0.8em;
width: 90%;
line-height: 15px;
}
/*gcm*/