上传项目资源添加到邮件按天发送

This commit is contained in:
huang 2015-06-16 14:57:35 +08:00
parent f3f0a9847f
commit e1b059b3d2
5 changed files with 55 additions and 3 deletions

View File

@ -127,6 +127,11 @@ class Mailer < ActionMailer::Base
end
end
# 项目附件
@project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a
where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by a.created_on desc")
# user 提交的作业
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
@ -194,7 +199,7 @@ class Mailer < ActionMailer::Base
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments,
has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments,@project_attachments,
@course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发

View File

@ -382,6 +382,37 @@
</ul><!-- 项目新闻回复end -->
<% end %>
<!-- 项目上传资源 -->
<% unless @project_attachments.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:label_project_mail_attachments) %>
</span>
<% @project_attachments.each do |project_attachment|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value), :class => "wmail_name",
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_mail_upload) %></span>
<%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value),
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_attachment.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!-- 项目上传资源 end-->
<% end %>
<!--项目留言-->
<% unless @project_journal_messages.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">

View File

@ -168,6 +168,18 @@
<!-- 项目新闻回复end -->
<% end %>
<!-- 项目上传资源 -->
<% unless @project_attachments.first.nil? %>
<%= l(:label_project_mail_attachments) %>
<% @project_attachments.each do |project_attachment|%>
▪[<%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value) %>]
<%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value) %>
<%= l(:label_project_mail_upload) %>
<%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value) %>
<%= format_time(project_attachment.created_on) %>
<% end %> <!-- 项目上传资源 end-->
<% end %>
<!--项目留言-->
<% unless @project_journal_messages.first.nil? %>
<%= l(:label_project_mail_feedback) %>

View File

@ -41,7 +41,9 @@ en:
lable_sure_exit_project: "Are you sure exit from the projcet"
label_member: "Members"
project_module_attachments: "Resources"
project_module_attachments: "Resources"
label_project_mail_attachments: Project Resources
label_project_mail_upload: had uploaded project resources
label_invite: Invitation
label_invite_new_user: "Send email to invite new user"

View File

@ -62,7 +62,9 @@ zh:
label_development_team: 开发模式
label_member: 成员
project_module_attachments: 资源
project_module_attachments: 资源
label_project_mail_attachments: 项目资源
label_project_mail_upload: 上传了资源
label_invite: 邀请