所有消息显示功能
This commit is contained in:
parent
510613f9a4
commit
2c865069d3
|
@ -28,6 +28,7 @@ class UsersController < ApplicationController
|
|||
# menu_item :requirement_focus, :only => :watch_bids
|
||||
menu_item :requirement_focus, :only => :watch_contests
|
||||
menu_item :user_newfeedback, :only => :user_newfeedback
|
||||
menu_item :user_messages, :only => :user_messages
|
||||
|
||||
|
||||
#Ended by young
|
||||
|
@ -40,14 +41,14 @@ class UsersController < ApplicationController
|
|||
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index,
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist]
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages]
|
||||
#edit has been deleted by huang, 2013-9-23
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist]
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
|
@ -95,6 +96,15 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 用户消息
|
||||
def user_messages
|
||||
#@user_messges = User.current.forge_messages
|
||||
respond_to do |format|
|
||||
format.html{render :layout=>'base_users_new'}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def user_projects_index
|
||||
if User.current.admin?
|
||||
memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
<!--<li><a href="javascript:void(0);">我的主页</a></li>-->
|
||||
</ul>
|
||||
</li><!---level1 end--->
|
||||
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
|
||||
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
|
||||
{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user},
|
||||
{:class => 'my-message'} if User.current.logged?%>
|
||||
</li>
|
||||
<!--<li ><a href="javascript:void(0);">退出</a></li>-->
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
<div class="top_new">
|
||||
<span class=" top_newcourses_bg fl"></span>
|
||||
|
||||
新建课程
|
||||
|
||||
<div class="cl"></div>
|
||||
|
||||
|
||||
<div id="TopUser" class="fr">
|
||||
<div id="menu">
|
||||
<ul class="menu">
|
||||
|
||||
<li id="current_message_li">
|
||||
<%= link_to "#{l(:label_forge_message)}<span class='pic_triangle'></span>".html_safe %>
|
||||
<ul id="message_sub_menu" style="right: 0px;display: none;left: 10px;">
|
||||
<% if @show_course == 1 %>
|
||||
<% user_course = get_user_course User.current%>
|
||||
<% unless user_course.empty? %>
|
||||
<li id="my_courses_message_li">
|
||||
<%=link_to l(:label_course_message), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
|
||||
<ul id="my_courses_message_ul">
|
||||
<% user_course.reverse.each do |course| %>
|
||||
<li title="<%=course.name%>">
|
||||
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% unless User.current.projects.empty? %>
|
||||
<li id="my_projects_message_li">
|
||||
<%= "#{l(:label_project_message)}"+"("+User.current.count_new_issue_assign_to.count.to_s+")" %>
|
||||
<ul id="my_projects_message_ul" >
|
||||
<% User.current.count_new_issue_assign_to.reverse.each do |issue_assign| %>
|
||||
<li title="<%= issue_assign.forge_message %>">
|
||||
<%= link_to issue_assign.forge_message, {:controller => 'issues', :action => 'show',id: issue_assign.forge_message_id, host: Setting.host_name }, target:"_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% User.current.issue_status_update.reverse.each do |issue_update| %>
|
||||
<li title="<%= issue_update.forge_message %>">
|
||||
<%= link_to issue_update.forge_message.issue, {:controller => 'issues', :action => 'show',id: issue_update.forge_message_id, host: Setting.host_name }, target:"_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%=link_to "...", {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--topuser_nav end-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function setMessageCount () {
|
||||
var mes = $('#loggedas .my-message');
|
||||
mes.html(mes.html()+ '(' + <%=User.current.count_new_jour.to_s%> + ")");
|
||||
}
|
||||
|
||||
//消息提醒
|
||||
function MessageAddSlipMenu () {
|
||||
var loggedas = $('#current_message_li a:first');
|
||||
var sub_menu = $('#message_sub_menu');
|
||||
loggedas.mouseenter(function() {
|
||||
sub_menu.show();
|
||||
$('#my_projects_message_ul').hide();
|
||||
$('#my_courses_message_ul').hide();
|
||||
});
|
||||
sub_menu.mouseleave(function() {
|
||||
sub_menu.hide();
|
||||
$('#my_projects_message_ul').hide();
|
||||
$('#my_courses_message_ul').hide();
|
||||
});
|
||||
}
|
||||
|
||||
function MessageAddProjectSlipMenu () {
|
||||
var loggedas = $('#my_projects_message_li');
|
||||
var project_sub_menu = $('#my_projects_message_ul');
|
||||
var course_sub_menu = $('#my_courses_message_ul');
|
||||
loggedas.mouseenter(function() {
|
||||
course_sub_menu.hide();
|
||||
project_sub_menu.show();
|
||||
});
|
||||
loggedas.mouseleave(function() {
|
||||
project_sub_menu.hide();
|
||||
course_sub_menu.hide();
|
||||
});
|
||||
}
|
||||
function MessageAddCourseSlipMenu () {
|
||||
var loggedas = $('#my_courses_message_li');
|
||||
var project_sub_menu = $('#my_projects_message_ul');
|
||||
var course_sub_menu = $('#my_courses_message_ul');
|
||||
loggedas.mouseenter(function() {
|
||||
project_sub_menu.hide();
|
||||
course_sub_menu.show();
|
||||
});
|
||||
loggedas.mouseleave(function() {
|
||||
course_sub_menu.hide();
|
||||
project_sub_menu.hide();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
MessageAddSlipMenu();
|
||||
MessageAddProjectSlipMenu ();
|
||||
MessageAddCourseSlipMenu();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -322,6 +322,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
|
||||
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
|
||||
match 'watch_projects', :to => 'users#watch_projects', :via => :get
|
||||
|
||||
# added by bai
|
||||
match 'show_score', :to => 'users#show_score', :via => :get
|
||||
match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post]
|
||||
|
@ -349,6 +350,7 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
|
||||
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
|
||||
match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get
|
||||
|
||||
#end
|
||||
match 'my/account', :via => [:get, :post]
|
||||
|
|
Loading…
Reference in New Issue