From 0c19199be93f9ac2d6afd9350061f15eb5914838 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 4 Jun 2015 17:25:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E5=A4=A9=E5=8F=91=E9=80=81=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 8 +-- app/views/mailer/news_added.html.erb | 2 +- .../mailer/send_for_user_activities.html.erb | 69 +++++++++++++------ config/locales/projects/zh.yml | 3 +- 4 files changed, 54 insertions(+), 28 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 6df73225f..087fb6d73 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -139,6 +139,7 @@ class Mailer < ActionMailer::Base end end end + # 查询user在课程中发布的通知,项目中发的新闻 @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.course_id in (#{course_ids}) @@ -151,18 +152,13 @@ class Mailer < ActionMailer::Base jour_type='Course' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") @user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') - - # 查询user新建贴吧或发布帖子 @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @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,@homeworks,@course_messages,@project_messages,@course_news,@project_news, - @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| - !o.empty? - } + @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 mail :to => user.mail,:subject => subject if has_content diff --git a/app/views/mailer/news_added.html.erb b/app/views/mailer/news_added.html.erb index f214b8293..316ab9d2c 100644 --- a/app/views/mailer/news_added.html.erb +++ b/app/views/mailer/news_added.html.erb @@ -23,7 +23,7 @@
  • <%= l(:mail_issue_content)%> - <%= @news.description.html_safe %> + <%= @news.description.html_safe %>
  • diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 1ea977e89..81a65442f 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -3,7 +3,7 @@ <%= @subject %> <% if @attachments.first || @course_news.first || @bids.first || - @homeworks.first || @course_journal_messages.first|| @course_messages.first %> + @homeworks.first || @course_journal_messages.first|| @course_messages.first %>

    <%= l(:label_course_overview)%>

    <% unless @course_news.first.nil? %> @@ -35,11 +35,12 @@ <% end %>
    - + <% end %> + + <% if !@bids.first.nil? || !@homeworks.first.nil? %> <% end %> + <% unless @course_journal_messages.first.nil? %> <% end %> + <% unless @course_messages.first.nil? %> + <% end %> + <% unless @attachments.first.nil? %> <% end %> -
    + <% end %> + + + <% if @issues.first || @project_messages.first %>
    @@ -207,16 +205,13 @@
  • [ - <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value), :class=> "wmail_column", :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> ] - <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name", :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_project_issue) %> - <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value), :class => 'wmail_info', :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" @@ -229,6 +224,7 @@ <% end %> + <% unless @project_messages.first.nil? %>

      @@ -261,9 +257,42 @@

    <% end %> -
  • -<% end %> + + <% unless @project_news.first.nil? %> + + <% end %> + + +<% end %> + + <% unless @user_journal_messages.first.nil? %>

    <%= l(:label_activities) %>

    diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 8ca078084..78f608a80 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -85,7 +85,8 @@ zh: project_module_documents: 文档 label_roadmap: 里程碑 #版本路线图 project_module_dts: DTS测试工具 - label_project_tool_response: 用户反馈 + label_project_tool_response: 用户反馈 + label_course_news: 项目新闻 label_project_overview: "项目简介" label_expend_information: 展开更多信息