Merge branch 'dev_hjq' into szzh

This commit is contained in:
sw 2015-06-05 17:17:56 +08:00
commit 3b954dfd16
9 changed files with 38 additions and 64 deletions

View File

@ -365,6 +365,18 @@ class ProjectsController < ApplicationController
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all
unless @inviter_lists.blank?
@inviter_lists.each do|inviter_list|
@inviters = []
@waiters = []
@inviters << inviter_list.user
@inviters_count = @inviters.size
unless inviter_list.user.member_of?(@project)
@waiters << inviter_list.user
@waiters_count = @waiters.size
end
end
end
@is_zhuce = false
respond_to do |format|
format.html

View File

@ -115,14 +115,15 @@ class Mailer < ActionMailer::Base
count = courses.count
count = count - 1
for i in 0..count do
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
@bids += bids if bids.count > 0
@attachments += attachments if attachments.count > 0
end
end
# user 提交的作业
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where
@ -157,7 +158,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,@homeworks,@course_messages,@project_messages,@course_news,@project_news,
has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发

View File

@ -23,7 +23,7 @@
</li>
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<%= @message.content %>
<%= @message.content.html_safe %>
</span>
</li>

View File

@ -3,7 +3,7 @@
<%= @subject %>
</h4>
<% if @attachments.first || @course_news.first || @bids.first ||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
@course_journal_messages.first|| @course_messages.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
<% unless @course_news.first.nil? %>
@ -39,7 +39,7 @@
<% end %>
<!--课程作业-->
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
<% if !@bids.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
<% unless @bids.first.nil?%>
@ -65,29 +65,6 @@
</li>
<% end %>
<% end %>
<% unless @homeworks.first.nil? %>
<% @homeworks.each do |homework| %>
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to homework.user, user_activities_url(homework.user,: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;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_submit_homework) %></span>
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,: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;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_at) %></span>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul><!--作业动态 end-->
@ -262,7 +239,7 @@
<% unless @project_news.first.nil? %>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_news) %>
<%= l(:label_project_news) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_news.count %>)</span>
</h4>
<% @project_news.each do |project_new|%>

View File

@ -1,6 +1,6 @@
<%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first ||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
@course_journal_messages.first|| @course_messages.first %>
<%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %>
<%= l(:label_course_news) %>
@ -27,7 +27,7 @@
<% end %>
<% end %>
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
<% if !@bids.first.nil? %>
<%= l(:label_homework_overview) %><%= @bids.count %>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
@ -51,26 +51,6 @@
<% end %>
<% end %>
<% unless @homeworks.first.nil? %>
<% @homeworks.each do |homework| %>
▪[
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value)
%>
]
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value)
%>
<%= l(:label_course_submit_homework) %>
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value)
%>
<%= format_time(homework.created_at) %>
<% end %>
<% end %>
<!--作业动态 end-->

View File

@ -4,9 +4,9 @@
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<p><%= @subject %> </p>
<p> <%= link_to @project_url, @project_url%></p>
<p>点击链接后,将自动为您注册账号</p>
<p><%= @subject %> </p>
<p style="color: #15BCCF ">点击下面的链接即可激活账号系统会根据给出的密码和账号自动登录Trustie平台。</p>
<p> <%= link_to @project_url, @project_url%></p>
<p>您的账号为:<%= @email %></p>
<p>密码为: <%= @password %></p>

View File

@ -1,3 +1,3 @@
<p><%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
:author => h(@wiki_content.author)).html_safe %><br />
<em><%=h @wiki_content.comments %></em></p>
<em><%=h @wiki_content.comments.html_safe %></em></p>

View File

@ -79,19 +79,23 @@
<% end %>
<%# 邀请用户的状态 %>
<% unless @inviter_lists.blank? %>
<div>
<div>
<% if @inviters_count > 0 %>
<span class="status_inviter">已邀请的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<%= inviter_list.user.name %><br/>
<%= inviter_list.user.name unless inviter_list.user.nil? %><br/>
<% end %>
</br>
<% end %>
</br>
<% unless @waiters_count.nil? %>
<span class="status_inviter">等待加入项目的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<% unless inviter_list.user.member_of?(@project) %>
<%= inviter_list.user.name %><br/>
<% end %>
<% unless inviter_list.user.member_of?(@project) %>
<%= inviter_list.user.name unless inviter_list.user.nil? %><br/>
<% end %>
<% end %>
</div>
<% end %>
</div>
<% end %>
</div>

View File

@ -86,7 +86,7 @@ zh:
label_roadmap: 里程碑 #版本路线图
project_module_dts: DTS测试工具
label_project_tool_response: 用户反馈
label_course_news: 项目新闻
label_project_news: 项目新闻
label_project_overview: "项目简介"
label_expend_information: 展开更多信息