Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

This commit is contained in:
ouyangxuhua 2015-09-08 17:32:00 +08:00
commit 71f8fca68b
4 changed files with 39 additions and 8 deletions

View File

@ -146,6 +146,8 @@ class UsersController < ApplicationController
@message_alls << message_all.message @message_alls << message_all.message
end end
end end
when 'invite_info'
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?" , "AppliedProject", @user).order("created_at desc")
when 'homework' when 'homework'
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
when 'course_message' when 'course_message'

View File

@ -3,6 +3,19 @@ class AppliedProject < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
after_create :send_appliled_message
def send_appliled_message
# if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
self.project.members.each do |m|
if m.roles.first.to_s.include?("Manager")
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false)
end
end
# end
end
#删除用户申请 #删除用户申请
def self.deleteappiled(userid, projectid) def self.deleteappiled(userid, projectid)
@ -11,5 +24,4 @@ class AppliedProject < ActiveRecord::Base
applied.destroy applied.destroy
end end
end end
end end

View File

@ -3,6 +3,8 @@
<%if @select_tab%> <%if @select_tab%>
<%if @select_tab == "modules"%> <%if @select_tab == "modules"%>
project_setting(2); project_setting(2);
<% elsif @select_tab == "members"%>
project_setting(3);
<% elsif @select_tab == "versions"%> <% elsif @select_tab == "versions"%>
project_setting(4); project_setting(4);
$("#pro_st_edit_ban").toggle(); $("#pro_st_edit_ban").toggle();

View File

@ -134,6 +134,21 @@
<% end %> <% end %>
<!--项目消息--> <!--项目消息-->
<% if ma.class == ForgeMessage %> <% if ma.class == ForgeMessage %>
<% if ma.forge_message_type == "AppliedProject" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.user), :width => "30", :height => "30"), user_path(ma.forge_message.user) %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.forge_message.user, user_path(ma.forge_message.user), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">申请加入项目:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.project, settings_project_path(:id => ma.project, :tab => "members"), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.project}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.forge_message_type == "Issue" %> <% if ma.forge_message_type == "Issue" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">