This commit is contained in:
alan 2015-03-07 11:35:49 +08:00
commit 5c1a6f7754
4 changed files with 20 additions and 11 deletions

View File

@ -442,16 +442,24 @@ class UsersController < ApplicationController
watcher.push(User.current)
activity = Activity.where(where_condition).where('user_id in (?)', watcher).order('id desc')
else
activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
activity = activity.reject { |e|
!User.current.admin? &&
(((e.act_type == "Issue") && !e.act.project.visible?(User.current)) ||
(e.act_type == "Bid" && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) ||
(e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) ||
(e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) ||
(e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course)))))
}
end
@activity_count = activity.count
@activity_pages = Paginator.new @activity_count, pre_count, params['page']
@activity = activity.slice(@activity_pages.offset,@activity_pages.per_page )
@activity = @activity.reject { |e|
((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
}
@activity = activity.slice(@activity_pages.offset,@activity_pages.per_page)
# @activity = @activity.reject { |e|
# ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
# ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
# ((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
# }
@state = 0
end

View File

@ -9,9 +9,8 @@
</script>
<div id="add-message" class="add_frame" style="display:none;">
<% if User.current.logged? %>
s
<div class="add_frame_header">
<%= l(:label_message_new) %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_message_new) %></h2>
</div>
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form', :locals => {:f => f} %>

View File

@ -127,11 +127,13 @@
</div><!--项目信息 end-->
<div class="subNavBox">
<% if User.current.member_of?(@project) %>
<div class="subNav currentDd currentDt subNav_jiantou">邀请</div>
<ul class="navContent " style="display:block; padding-left: 0px; margin-top:0px;">
<li><%= link_to "发送邮件邀请新用户", :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
<li><%= link_to "邀请Trustie注册用户", :controller=>"projects", :action=>"invite_members", :id => @project %></li>
</ul>
<% end %>
<div class="subNav">
<%= link_to "动态", {:controller => 'projects', :action => 'show', :id => @project.id}, :style => "color:#3CA5C6" %>
</div>

View File

@ -67,7 +67,7 @@ a:hover.subnav_green{ background:#14ad5a;}
.lg-foot:hover{ color:#787b7e;}
/*右侧内容--动态*/
.project_r_h{ height:40px; background:#eaeaea;}
.project_r_h{ height:40px; background:#eaeaea; margin-bottom: 5px;}
.project_h2{ background:#64bdd9; color:#fff; height:30px; width:90px; text-align:center; font-weight:normal; padding-top:3px; font-size:16px; padding-top:9px;}
.project_r_box{ border:1px solid #e2e1e1; width:670px; margin-top:10px;}
.project_h3 { color:#646464; font-size:14px; padding:0 10px; border-bottom:1px solid #e2e1e1;}