From a967a86a1dbf8794287f13caccadfee9d63f950b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 14:24:50 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6500?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 12 ++++++++++++ .../projects/invite_members_by_mail.html.erb | 18 +++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3c34aa549..1793eb39c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index ce7ea2aa1..bb98b3356 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -79,19 +79,23 @@ <% end %> <%# 邀请用户的状态 %> <% unless @inviter_lists.blank? %> -
+
+ <% if @inviters_count > 0 %> 已邀请的用户
<% @inviter_lists.each do |inviter_list| %> - <%= inviter_list.user.name %>
+ <%= inviter_list.user.name unless inviter_list.user.nil? %>
<% end %> -
+ <% end %> +
+ <% unless @waiters_count == 0 %> 等待加入项目的用户
<% @inviter_lists.each do |inviter_list| %> - <% unless inviter_list.user.member_of?(@project) %> - <%= inviter_list.user.name %>
- <% end %> + <% unless inviter_list.user.member_of?(@project) %> + <%= inviter_list.user.name unless inviter_list.user.nil? %>
+ <% end %> <% end %> -
+ <% end %> +
<% end %> From 54abe5d85820c3d6c8f991804563c3f1ca6589e8 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 14:51:36 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=9A=84=E6=88=90=E5=91=98=E5=88=99=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/invite_members_by_mail.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index bb98b3356..7b3a4c552 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -87,7 +87,7 @@ <% end %> <% end %>
- <% unless @waiters_count == 0 %> + <% unless @waiters_count.nil? %> 等待加入项目的用户
<% @inviter_lists.each do |inviter_list| %> <% unless inviter_list.user.member_of?(@project) %> From a148c49fa9ba5a44a948342d1578d854b2608bc0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:02:22 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E6=BF=80=E6=B4=BB=E8=B4=A6=E5=8F=B7=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_invite_in_project.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb index 6dbfcbda6..51b189f37 100644 --- a/app/views/mailer/send_invite_in_project.html.erb +++ b/app/views/mailer/send_invite_in_project.html.erb @@ -4,9 +4,9 @@
  • <%= l(:mail_issue_content)%> -

    <%= @subject %>

    -

    <%= link_to @project_url, @project_url%>

    -

    点击链接后,将自动为您注册账号

    +

    <%= @subject %>

    +

    点击链接激活账号,系统会依据给出的密码和账号自动登录Trustie平台。

    +

    <%= link_to @project_url, @project_url%>

    您的账号为:<%= @email %>

    密码为: <%= @password %>

    From 8adb00fccb70e5f865fd3f6f78c3ae1a38cd1b55 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:26:14 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E9=82=AE=E4=BB=B6=E4=B8=AD=E6=A0=B7=E5=BC=8F=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/message_posted.html.erb | 2 +- app/views/mailer/send_invite_in_project.html.erb | 2 +- app/views/mailer/wiki_content_added.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index dbe41976a..2be4e486e 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -23,7 +23,7 @@
  • <%= l(:mail_issue_content)%> - <%= @message.content %> + <%= @message.content.html_safe? %>
  • diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb index 51b189f37..ec559732f 100644 --- a/app/views/mailer/send_invite_in_project.html.erb +++ b/app/views/mailer/send_invite_in_project.html.erb @@ -5,7 +5,7 @@
  • <%= l(:mail_issue_content)%>

    <%= @subject %>

    -

    点击链接激活账号,系统会依据给出的密码和账号自动登录Trustie平台。

    +

    点击下面的链接即可激活账号,系统会根据给出的密码和账号自动登录Trustie平台。

    <%= link_to @project_url, @project_url%>

    您的账号为:<%= @email %>

    密码为: <%= @password %>

    diff --git a/app/views/mailer/wiki_content_added.html.erb b/app/views/mailer/wiki_content_added.html.erb index 8c83f62c8..c4f6929a8 100644 --- a/app/views/mailer/wiki_content_added.html.erb +++ b/app/views/mailer/wiki_content_added.html.erb @@ -1,3 +1,3 @@

    <%= 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 %>
    -<%=h @wiki_content.comments %>

    +<%=h @wiki_content.comments.html_safe? %>

    From bef1917c4efff2eb6837a0adc6668b0ec7008e0c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:32:19 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/message_posted.html.erb | 2 +- app/views/mailer/wiki_content_added.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index 2be4e486e..c55f4b000 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -23,7 +23,7 @@
  • <%= l(:mail_issue_content)%> - <%= @message.content.html_safe? %> + <%= @message.content.html_safe %>
  • diff --git a/app/views/mailer/wiki_content_added.html.erb b/app/views/mailer/wiki_content_added.html.erb index c4f6929a8..244597a1b 100644 --- a/app/views/mailer/wiki_content_added.html.erb +++ b/app/views/mailer/wiki_content_added.html.erb @@ -1,3 +1,3 @@

    <%= 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 %>
    -<%=h @wiki_content.comments.html_safe? %>

    +<%=h @wiki_content.comments.html_safe %>

    From c62d468ed3d1c8970eaedc16014e1f9c798e3862 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:54:56 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=96=B0=E9=97=BB=E5=92=8C=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_for_user_activities.html.erb | 2 +- config/locales/projects/zh.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 81a65442f..da8b4c8c3 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -262,7 +262,7 @@ <% unless @project_news.first.nil? %>

      - <%= l(:label_course_news) %> + <%= l(:label_project_news) %> (<%= @project_news.count %>)

      <% @project_news.each do |project_new|%> diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 78f608a80..e01e2992c 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -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: 展开更多信息 From 79893c4917548bb0b1f3dc09a888fa00479e2033 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 16:57:09 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=A0=B9=E6=8D=AE=E9=AA=8C=E8=AF=81=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E7=9B=B8=E5=BA=94=E7=A9=BA=E9=97=B4focus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b629530f0..4c0cae670 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -470,7 +470,15 @@ $(function(){ //老师提交 新建/修改 作业 function submit_homework(id) { - if(regex_homework_name()&®ex_evaluation_num()) + if(!regex_homework_name()) + { + $("#homework_name").focus(); + } + else if(!regex_evaluation_num()) + { + $("#evaluation_num").focus(); + } + else { homework_description_editor.sync(); $("#"+id).submit(); From c85fd9f7b8c2c81fc5282c33740dd3d7f600bdd2 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 17:17:35 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B0=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=A8=A1=E5=9D=97=E7=9A=84=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 7 ++--- .../mailer/send_for_user_activities.html.erb | 27 ++----------------- .../mailer/send_for_user_activities.text.erb | 24 ++--------------- 3 files changed, 8 insertions(+), 50 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 087fb6d73..1325ef613 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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}" #有内容才发,没有不发 diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index da8b4c8c3..e1712a15d 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 %> + @course_journal_messages.first|| @course_messages.first %>

      <%= l(:label_course_overview)%>

      <% unless @course_news.first.nil? %> @@ -39,7 +39,7 @@ <% end %> - <% if !@bids.first.nil? || !@homeworks.first.nil? %> + <% if !@bids.first.nil? %>

        <%= l(:label_homework_overview) %>(<%= @bids.count %>)

        <% unless @bids.first.nil?%> @@ -65,29 +65,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), - :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] - - <%= 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;"%> - <%= l(:label_course_submit_homework) %> - - <%= 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;" - %> - <%= format_time(homework.created_at) %> -
      • - <% end %> - <% end %>
      diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 59735225d..2a2382301 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -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 %>