From f4cad2897a4ccc6359f1b0955a936d6a63b6c5a3 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 24 Sep 2015 14:48:48 +0800 Subject: [PATCH 1/7] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=80=81=E5=B8=88?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E4=BD=9C=E5=93=81=E8=AF=84=E9=98=85=E5=92=8C?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E4=BD=9C=E5=93=81=E8=AF=84=E9=98=85=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=92=8C=E6=A0=B7=E5=BC=8F=202.=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=80=81=E5=B8=88=E5=85=B3=E9=97=AD=E4=BD=9C=E5=93=81=E8=AF=84?= =?UTF-8?q?=E9=98=85=E5=92=8C=E5=BC=80=E5=90=AF=E4=BD=9C=E5=93=81=E8=AF=84?= =?UTF-8?q?=E9=98=85=E7=9A=84tips=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 86 ++++++++++++-------------- 1 file changed, 41 insertions(+), 45 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index c7895efb7..8f64d6c29 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -224,61 +224,57 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> - - <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %> - - <% end %> + + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %> + + <% end %> <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %> <% end %> From 38ba47f8c8b799b88777d615fddd74515a379333 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Sep 2015 16:16:37 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E4=BF=AE=E6=94=B9=20=E4=BB=BB=E5=8A=A1=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E8=87=AA=E5=8A=A8=E5=BC=80=E5=90=AF?= =?UTF-8?q?/=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=20=E5=8C=BF=E8=AF=84=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 1 + .../20150924063215_add_reply_id_to_message.rb | 5 ++++ lib/tasks/homework_evaluation.rake | 28 +++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20150924063215_add_reply_id_to_message.rb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index f9b5b7d32..8d2cb63aa 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -160,6 +160,7 @@ class MessagesController < ApplicationController @reply.safe_attributes = params[:reply] @reply.content = @quote + @reply.content @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] + @reply.reply_id = @message.author @topic.children << @reply user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first user_activity.updated_at = Time.now diff --git a/db/migrate/20150924063215_add_reply_id_to_message.rb b/db/migrate/20150924063215_add_reply_id_to_message.rb new file mode 100644 index 000000000..b55449ad7 --- /dev/null +++ b/db/migrate/20150924063215_add_reply_id_to_message.rb @@ -0,0 +1,5 @@ +class AddReplyIdToMessage < ActiveRecord::Migration + def change + add_column :messages, :reply_id, :integer + end +end diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index af833448d..75166391d 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -25,9 +25,25 @@ namespace :homework_evaluation do end end homework_detail_manual.update_column('comment_status', 2) - # 匿评开启消息邮件通知 + # 匿评开启消息邮件通知,# 所有人 + course = homework_common.course + course.members.each do |m| + homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end + # 邮件通知 + Mailer.send_mail_anonymous_comment_close(homework_common).deliver else - #作业数小于2,启动失败 + #作业数小于2,启动失败, 只给老师发 + # status==4 发送失败 + # 匿评开启消息邮件通知,# 所有人 + course = homework_common.course + course.members.each do |m| + if m.user.allowed_to?(:as_teacher,course) + homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 4) + end + end + # 邮件通知 + # Mailer.send_mail_anonymous_comment_close(homework_common).deliver end end end @@ -47,7 +63,13 @@ namespace :homework_evaluation do student_work.save end homework_detail_manual.update_column('comment_status', 3) - # 匿评关闭消息邮件通知 + # 匿评关闭消息通知 给所有人发 + course = homework_common.course + course.members.each do |m| + homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) + end + # 邮件通知 + Mailer.send_mail_anonymous_comment_close(homework_common).deliver end end end From fcf34b5918152f4dcd99dbfa3ff01b8e502778e1 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Sep 2015 16:38:36 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=AD=E2=80=9C=E7=A7=81=E6=9C=89=E2=80=9D?= =?UTF-8?q?=20=E2=80=9C=E5=85=AC=E5=BC=80=E2=80=9D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 1 + app/models/message.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 414ef6d70..251c47d4c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -189,6 +189,7 @@ class ProjectsController < ApplicationController @project.organization_id = params[:organization_id] @project.user_id = User.current.id @project.project_new_type = params[:project_new_type] + params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0 if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin diff --git a/app/models/message.rb b/app/models/message.rb index 37129885f..2c46857f8 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -86,7 +86,7 @@ class Message < ActiveRecord::Base } - safe_attributes 'subject', 'content' + safe_attributes 'subject', 'content', 'reply_id' safe_attributes 'board_id','locked', 'sticky', :if => lambda {|message, user| if message.project From 25a604d7b8d49b9bf5f75d2559a786010c57823c Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Sep 2015 16:59:19 +0800 Subject: [PATCH 4/7] =?UTF-8?q?issue=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/show.html.erb | 118 ++++++++------------------------- db/schema.rb | 13 +++- 2 files changed, 38 insertions(+), 93 deletions(-) diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 2b706be7f..76467275d 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,4 +1,4 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg' %>

    <%= l(:label_issue_edit) %>

    @@ -12,7 +12,6 @@
    <%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %>
    -

    @@ -21,59 +20,32 @@


    - 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %> +

    <%= @issue.author %> + <%# if @issue.created_on != @issue.updated_on %> + 添加于 <%= format_time(@issue.created_on).html_safe %> + <%# else %> + <%#= format_time(@issue.updated_on).html_safe %> + <%# end %>

    - 'action_menu' %>
    - <% if @issue.description? || @issue.attachments.any? -%> -
    +
    + <% if @issue.description? || @issue.attachments.any? -%> <% if @issue.description? %> <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> <% end %> -
    - <% end -%> - - +
    + + + <%= link_to_attachment_project @issue, :thumbnails => true %>
    + <% end -%> <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> -
    -
    - - -<<<<<<< .mine - <%= render :partial => 'attributes_show' %> - - - - - - - - - - - - - - - - - - - - - - - - - - -======= +
    +
    +
    <%= issue_fields_rows do |rows| %>
      @@ -101,18 +73,7 @@ <% end %>
    ->>>>>>> .theirs - -<<<<<<< .mine - <%# 该应用是对issue主题内容的引用,对应:to => 'journals#new %> - - - - - -
    -=======
      <% unless @issue.disabled_core_fields.include?('start_date') %>
    •  开始  : 

      @@ -121,33 +82,6 @@
    • <% end %>
      ->>>>>>> .theirs -<<<<<<< .mine - - - - - - - - - - - - - - - - - - - - - - - - -======= <% unless @issue.disabled_core_fields.include?('estimated_hours') %>
    •  周期  : 

      <%= l_hours(@issue.estimated_hours) %> @@ -172,23 +106,28 @@ <% end %> <%#= render_custom_fields_rows(@issue) %> <%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> ->>>>>>> .theirs -
    - + + +
    + <%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %> +
    +
    - <% if @issue.editable? %>
    <%= render :partial => 'edit' %>

    - <%#--引用时不能修改,剥离出引用内容--%> + + + <%= l(:button_submit) %> <% end %> + <%#= submit_tag l(:button_submit) %> <%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%> @@ -199,7 +138,6 @@ <%= render :partial => 'changesets', :locals => {:changesets => @changesets} %> <% end %> -
    <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> diff --git a/db/schema.rb b/db/schema.rb index 40daded12..b364ed83e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150918134804) do +ActiveRecord::Schema.define(:version => 20150924063215) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -476,6 +476,13 @@ ActiveRecord::Schema.define(:version => 20150918134804) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -895,6 +902,7 @@ ActiveRecord::Schema.define(:version => 20150918134804) do t.datetime "updated_on", :null => false t.boolean "locked", :default => false t.integer "sticky", :default => 0 + t.integer "reply_id" end add_index "messages", ["author_id"], :name => "index_messages_on_author_id" @@ -912,7 +920,6 @@ ActiveRecord::Schema.define(:version => 20150918134804) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" - t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id" @@ -1324,7 +1331,7 @@ ActiveRecord::Schema.define(:version => 20150918134804) do t.datetime "updated_at", :null => false t.integer "late_penalty", :default => 0 t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 + t.integer "system_score" t.boolean "is_test", :default => false end From b66de0ee9fe938fc57b5b5904c549deb1d1123da Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Sep 2015 17:03:43 +0800 Subject: [PATCH 5/7] =?UTF-8?q?issue=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/show.html.erb | 111 ++++++++------------------------- 1 file changed, 26 insertions(+), 85 deletions(-) diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 76467275d..67867e2c6 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,4 +1,4 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>

    <%= l(:label_issue_edit) %>

    @@ -12,6 +12,7 @@
    <%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %>
    +

    @@ -20,114 +21,53 @@


    -

    <%= @issue.author %> - <%# if @issue.created_on != @issue.updated_on %> - 添加于 <%= format_time(@issue.created_on).html_safe %> - <%# else %> - <%#= format_time(@issue.updated_on).html_safe %> - <%# end %> + 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %>

    + 'action_menu' %>
    -
    - <% if @issue.description? || @issue.attachments.any? -%> + <% if @issue.description? || @issue.attachments.any? -%> +
    <% if @issue.description? %> <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> <% end %> -
    - + <% end -%> + +
    + + + <%= link_to_attachment_project @issue, :thumbnails => true %>
    <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> -
    -
    - -
    - <%= issue_fields_rows do |rows| %> -
      -
    •  状态  : 

      +
    +
    -

    <%= @issue.status.name %>

    - -
    - <% unless @issue.disabled_core_fields.include?('assigned_to_id') %> -
  •  指派给  : 

    - <%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %> -
  • - <% end %> -
    - -
      -
    •  优先级  : 

      - <%= @issue.priority.name %> -
    • -
      - <% unless @issue.disabled_core_fields.include?('done_ratio') %> -
    •  % 完成  : 

      - <%= @issue.done_ratio %>% -
    • - <% end %> -
      -
    + + <%= render :partial => 'attributes_show' %> + -
      - <% unless @issue.disabled_core_fields.include?('start_date') %> -
    •  开始  : 

      + <%# 该应用是对issue主题内容的引用,对应:to => 'journals#new %> + + +
      +
    -

    <%= format_date(@issue.start_date) %>

    - - <% end %> -
    - <% unless @issue.disabled_core_fields.include?('estimated_hours') %> -
  •  周期  : 

    - <%= l_hours(@issue.estimated_hours) %> -
  • - <% end %> -
    - -
      - <% unless @issue.disabled_core_fields.include?('due_date') %> -
    •  计划完成  : 

      - <%= format_date(@issue.due_date) ? format_date(@issue.due_date) : "--" %> -
    • - <% end %> -
      - <% unless @issue.disabled_core_fields.include?('fixed_version_id') %> -
    •  目标版本  : 

      - <%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %> -
    • - <% end %> -
      -
    - <% end %> - <%#= render_custom_fields_rows(@issue) %> - <%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> - - -
    - <%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %> -
    -
    + <% if @issue.editable? %>
    <%= render :partial => 'edit' %>

    - - - + <%#--引用时不能修改,剥离出引用内容--%> <%= l(:button_submit) %> <% end %> - <%#= submit_tag l(:button_submit) %> <%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%> @@ -138,6 +78,7 @@ <%= render :partial => 'changesets', :locals => {:changesets => @changesets} %> <% end %> +
    <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> From a3840ebad9fc6c6df03d3f07d95b485bcd6e2e3f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 24 Sep 2015 17:11:39 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=A4=B1=E8=B4=A5=E5=AF=B9=E5=BA=94=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 8f64d6c29..d536b6ed7 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -279,6 +279,34 @@ <% end %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %> +
      +
    • + <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %> +
    • +
    • + <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", + user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> + ">启动作业匿评失败 +
    • +
    • + <%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :onmouseover => "message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %> +
    • + +
    • <%= time_tag(ma.created_at).html_safe %>
    • +
    + <% end %> + <% if ma.course_message_type == "Poll" %>
    • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
    • From 1e8cb91ab43253f451960f9752ee1b34aefa0586 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Sep 2015 17:18:58 +0800 Subject: [PATCH 7/7] boards --- app/controllers/messages_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 8d2cb63aa..2c7df84cf 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -160,7 +160,7 @@ class MessagesController < ApplicationController @reply.safe_attributes = params[:reply] @reply.content = @quote + @reply.content @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] - @reply.reply_id = @message.author + # @reply.reply_id = params[:id] @topic.children << @reply user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first user_activity.updated_at = Time.now