From ec4a3b321c792c049b19f0f90a6cd5406e8870b7 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 8 Mar 2016 11:26:55 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=8C=E4=B8=8B=E8=BD=BD=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=BC=95=E7=94=A8=E6=AC=A1=E6=95=B0=E4=B8=8D=E6=B8=85?= =?UTF-8?q?=E9=9B=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index cf4e6a8e9..b878a14ac 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -251,7 +251,7 @@ class AttachmentsController < ApplicationController @history.version = @old_history.nil? ? 1 : @old_history.version + 1 @history.save #历史记录保存完毕 #将最新保存的记录 数据替换到 需要修改的文件记录 - @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads") + @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes") @old_attachment.save #删除当前记录 @attachment.delete From 4442d286ce301a3fa1b02160133a83a6ea1613e5 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 8 Mar 2016 15:20:38 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=BF=9E=E6=8E=A5=E6=94=B9=E6=88=90https://w?= =?UTF-8?q?ww.=E2=80=A6=E2=80=A6=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 10 ++++++++++ .../organizations/_org_activities.html.erb | 2 +- .../organizations/_org_course_create.html.erb | 6 +++--- .../_org_course_homework.html.erb | 12 ++++++------ .../organizations/_org_course_message.html.erb | 14 +++++++------- .../organizations/_org_course_news.html.erb | 14 +++++++------- .../organizations/_org_course_poll.html.erb | 6 +++--- .../organizations/_org_project_issue.html.erb | 18 +++++++++--------- .../_org_subfield_message.html.erb | 14 +++++++------- .../organizations/_org_subfield_news.html.erb | 14 +++++++------- .../organizations/_project_create.html.erb | 6 +++--- .../organizations/_project_message.html.erb | 14 +++++++------- .../organizations/_show_org_document.html.erb | 10 +++++----- app/views/users/_show_detail_info.html.erb | 2 +- 14 files changed, 76 insertions(+), 66 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bf7a5fdf9..71e19375f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2895,3 +2895,13 @@ int main(int argc, char** argv){ end end end + +def user_url_in_org(user_id) + if Rails.env.development? + return "http://localhost:3000/users/" + user_id.to_s + elsif Rails.env.test? + return "https://www.test.forge.net/users/" + user_id.to_s + else + return "https://www.trustie.net/users/" + user_id.to_s + end +end diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 20b98ffa0..c5ec9cd4a 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -50,7 +50,7 @@ <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(act.user_id)} %>
-
<%= link_to User.find(act.user_id), user_path(act.user_id) %>  创建了 <%= Organization.find(act.org_act_id).name %> +
创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %>
diff --git a/app/views/organizations/_org_course_create.html.erb b/app/views/organizations/_org_course_create.html.erb index dc1e0ee81..3e22f33e1 100644 --- a/app/views/organizations/_org_course_create.html.erb +++ b/app/views/organizations/_org_course_create.html.erb @@ -1,15 +1,15 @@
- <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_path(activity.tea_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_url_in_org(activity.tea_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %>
<% if activity.try(:teacher).try(:realname) == ' ' %> - <%= link_to activity.try(:teacher), user_path(activity.tea_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:teacher), user_url_in_org(activity.tea_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:teacher).try(:realname), user_path(activity.tea_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:teacher).try(:realname), user_url_in_org(activity.tea_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.name.to_s+" | 课程", course_path(activity.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 0e056c972..0dd9fb725 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -2,15 +2,15 @@
- <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_url_in_org(activity.user_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
<% if activity.try(:user).try(:realname) == ' ' %> - <%= link_to activity.try(:user), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
@@ -303,14 +303,14 @@ <% replies_all_i = replies_all_i + 1 %>
  • - <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_url_in_org(comment.user_id), :alt => "用户头像" %>
    <% if comment.try(:user).try(:realname) == ' ' %> - <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> + <%= link_to comment.try(:user), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %> <% else %> - <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> + <%= link_to comment.try(:user).try(:realname), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index 7eee53d02..99229634e 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -1,15 +1,15 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
    <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%> @@ -105,14 +105,14 @@ <% replies_all_i=replies_all_i+1 %>
  • - <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
    <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> @@ -136,7 +136,7 @@ <% if !activity.locked? && authorize_for_course('messages', 'reply') %>
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
    <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index 665f5c1ae..ecdf728f8 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -1,15 +1,15 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
    <% if @ctivity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
    @@ -74,14 +74,14 @@ <% replies_all_i = replies_all_i + 1 %>
  • - <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
    <% if comment.try(:author).try(:realname) == ' ' %> - <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %> <% else %> - <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> @@ -103,7 +103,7 @@ <% end %>
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
    <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb index 7e09e2215..c124e829f 100644 --- a/app/views/organizations/_org_course_poll.html.erb +++ b/app/views/organizations/_org_course_poll.html.erb @@ -5,15 +5,15 @@
    - <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_url_in_org(activity.user_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
    <% if activity.try(:user).try(:realname) == ' ' %> - <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue ml15" %> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 2495e0044..855a8053c 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -1,15 +1,15 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
    <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
    @@ -23,9 +23,9 @@
    指派给   <% unless activity.assigned_to_id.nil? %> <% if activity.try(:assigned_to).try(:realname) == ' ' %> - <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:assigned_to), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:assigned_to).try(:realname), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %> <% end %> <% end %>
    @@ -85,14 +85,14 @@ <% replies_all_i=replies_all_i + 1 %>
  • - <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_url_in_org(reply.user_id), :alt => "用户头像" %>
    <% if reply.try(:user).try(:realname) == ' ' %> - <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:user), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %> <% else %> - <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> @@ -120,7 +120,7 @@ <% end %>
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
    <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%> diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 55f03a367..aa2493c5f 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -1,15 +1,15 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
    <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%> @@ -110,14 +110,14 @@ <% replies_all_i=replies_all_i+1 %>
  • - <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
    <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> @@ -139,7 +139,7 @@ <% end %>
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
    <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb index 891ad14a7..edbdfa16b 100644 --- a/app/views/organizations/_org_subfield_news.html.erb +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -1,15 +1,15 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
    <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %>
    @@ -94,14 +94,14 @@ <% replies_all_i = replies_all_i + 1 %>
  • - <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
    <% if comment.try(:author).try(:realname) == ' ' %> - <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %> <% else %> - <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> @@ -123,7 +123,7 @@ <% end %>
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
    <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index b68b7ceeb..e13f4128b 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -3,15 +3,15 @@
    - <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %>
    <% if user.try(:realname) == ' ' %> - <%= link_to user, user_path(user), :class => "newsBlue mr15" %> + <%= link_to user, user_url_in_org(user), :class => "newsBlue mr15" %> <% else %> - <%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %> + <%= link_to user.try(:realname), user_url_in_org(user), :class => "newsBlue mr15" %> <% end %> TO <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index 6cc3f5740..3b459f366 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -1,15 +1,15 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
    <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> @@ -85,14 +85,14 @@ <% replies_all_i=replies_all_i+1 %>
  • - <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
    <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> @@ -114,7 +114,7 @@ <% end %>
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
    <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index da458636a..2584e4209 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -1,12 +1,12 @@
    - <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %> + <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %> <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %>
    - <%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %> + <%= link_to User.find(document.creator_id), user_url_in_org(document.creator.id), :class => "newsBlue mr15" %> TO  <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> | <%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %> @@ -87,10 +87,10 @@ <% comments_for_doc.each do |comment| %> <% reply_id += 1 %>
  • -
    <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_path(comment.creator_id) %>
    +
    <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_id) %>
    - <%= link_to User.find(comment.creator_id), user_path(comment.creator_id), :class => "newsBlue mr10 f14" %> + <%= link_to User.find(comment.creator_id), user_url_in_org(comment.creator_id), :class => "newsBlue mr10 f14" %> <%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %> <% if comment.creator_id.to_i == User.current.id.to_i %> @@ -111,7 +111,7 @@
    - <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %> + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current) %>
    diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index 9de431336..f2a2faeb3 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -1,6 +1,6 @@
    - <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像", :target => '_blank' %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像", :target => '_blank' %> <%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
    From 6e21229b4c09396867f704dc9f03df35d056ccfb Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 8 Mar 2016 15:22:56 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 71e19375f..c19c44935 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2900,7 +2900,7 @@ def user_url_in_org(user_id) if Rails.env.development? return "http://localhost:3000/users/" + user_id.to_s elsif Rails.env.test? - return "https://www.test.forge.net/users/" + user_id.to_s + return "https://www.test.forge.trustie.net/users/" + user_id.to_s else return "https://www.trustie.net/users/" + user_id.to_s end From f469e51202d7ab698d6492f13e26d57c4ddd217c Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 8 Mar 2016 17:38:38 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=A8=A1=E5=9D=97/?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E3=80=81=E4=BD=9C=E4=B8=9A=E3=80=81=E7=95=99?= =?UTF-8?q?=E8=A8=80=E3=80=81=E5=8F=91=E5=B8=96=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E7=BB=9F=E8=AE=A1=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E9=80=92=E5=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 15 +---- app/helpers/application_helper.rb | 88 +++++++++++++++++++------ app/models/attachment.rb | 9 ++- app/models/comment.rb | 8 +++ app/models/journals_for_message.rb | 14 +++- app/models/message.rb | 14 +++- app/models/news.rb | 10 ++- app/views/layouts/base_courses.html.erb | 4 +- db/schema.rb | 1 - 9 files changed, 121 insertions(+), 42 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index a40b24fe2..8fab53206 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -555,7 +555,8 @@ class FilesController < ApplicationController end end # 更新课程英雄榜得分 - update_contributor_score(@course, attachments[:files].first) + course_member_score(@course.id, attachments[:files].first.author_id, "Attachment") + # end # end # TODO: 临时用 nyan sort_init 'created_on', 'desc' @@ -628,18 +629,6 @@ class FilesController < ApplicationController end end - def update_contributor_score(course, file ) - course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first - if course_contributor_score.nil? - CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5) - else - score = course_contributor_score.resource_num + 5 - total_score = course_contributor_score.total_score + 5 - course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score) - end - end - def get_project_tag_name_by_type_nmuber type case type when "1" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 22890fd9a..b7a2e3bd8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -117,56 +117,102 @@ module ApplicationHelper when "HomeworkCommon" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1 , :total_score => 1) + :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1) else score = course_contributor_score.homework_journal_num + 1 - total_score = course_contributor_score.total_score + 1 - course_contributor_score.update_attributes(:homework_journal_num => score, :total_score => total_score) + course_contributor_score.update_attributes(:homework_journal_num => score) end - when "JournalForMessage" + # 课程留言 + when "Course" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0, :total_score => 1) + :news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0) else score = course_contributor_score.journal_num + 1 - total_score = course_contributor_score.total_score + 1 - course_contributor_score.update_attributes(:journal_num => score, :total_score => total_score) + course_contributor_score.update_attributes(:journal_num => score) end when "Message" if course_contributor_score.nil? - CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0, - :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 2) + CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 1, :message_reply_num => 0, + :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) else - score = course_contributor_score.message_num + 2 - total_score = course_contributor_score.total_score + 2 - course_contributor_score.update_attributes(:message_num => score, :total_score => total_score) + score = course_contributor_score.message_num + 1 + course_contributor_score.update_attributes(:message_num => score) end when "MessageReply" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1, - :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) + :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) else score = course_contributor_score.message_reply_num + 1 - total_score = course_contributor_score.total_score + 1 - course_contributor_score.update_attributes(:message_reply_num => score, :total_score => total_score) + course_contributor_score.update_attributes(:message_reply_num => score) end when "NewReply" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) + :news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) else score = course_contributor_score.news_reply_num + 1 - total_score = course_contributor_score.total_score + 1 - course_contributor_score.update_attributes(:news_reply_num => score, :total_score => total_score) + course_contributor_score.update_attributes(:news_reply_num => score) end when "News" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) + :news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) else score = course_contributor_score.news_num + 1 - total_score = course_contributor_score.total_score + 1 - course_contributor_score.update_attributes(:news_num => score, :total_score => total_score) + course_contributor_score.update_attributes(:news_num => score) + end + when "Attachment" + if course_contributor_score.nil? + CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, + :news_reply_num => 0, :news_num => 0, :resource_num => 1, :journal_num => 0, :journal_reply_num => 0) + else + score = course_contributor_score.resource_num + 1 + course_contributor_score.update_attributes(:resource_num => score) + end + end + end + + # 删除某条记录相应减少课程统计数 + def down_course_score_num (course_id,user_id,type) + course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first + case type + when "HomeworkCommon" + unless course_contributor_score.nil? + score = course_contributor_score.homework_journal_num - 1 + course_contributor_score.update_attribute(:homework_journal_num, score < 0 ? 0 : score) + end + # 课程留言 + when "Course" + unless course_contributor_score.nil? + score = course_contributor_score.journal_num - 1 + course_contributor_score.update_attribute(:journal_num, score < 0 ? 0 : score) + end + when "Message" + unless course_contributor_score.nil? + score = course_contributor_score.message_num - 1 + course_contributor_score.update_attribute(:message_num, score < 0 ? 0 : score) + end + when "MessageReply" + unless course_contributor_score.nil? + score = course_contributor_score.message_reply_num - 1 + course_contributor_score.update_attribute(:message_reply_num, score < 0 ? 0 : score) + end + when "NewReply" + unless course_contributor_score.nil? + score = course_contributor_score.news_reply_num - 1 + course_contributor_score.update_attribute(:news_reply_num, score < 0 ? 0 : score) + end + when "News" + unless course_contributor_score.nil? + score = course_contributor_score.news_num - 1 + course_contributor_score.update_attribute(:news_num, score < 0 ? 0 : score) + end + when "Attachment" + unless course_contributor_score.nil? + score = course_contributor_score.resource_num - 1 + course_contributor_score.update_attribute(:resource_num, score < 0 ? 0 : score) end end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 82f648ad9..9f0c2c559 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -43,6 +43,7 @@ class Attachment < ActiveRecord::Base #elasticsearch include Elasticsearch::Model + include ApplicationHelper #elasticsearch kaminari init Kaminari::Hooks.init Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari @@ -92,7 +93,7 @@ class Attachment < ActiveRecord::Base after_save :act_as_course_activity after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index - after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count + after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score # add by nwb # 获取所有可公开的资源文件列表 @@ -655,6 +656,12 @@ class Attachment < ActiveRecord::Base self.container.project_score.update_attribute(:attach_num, attach_count < 0 ? 0 : attach_count) end end + + def down_course_score + if self.container_type == "Course" + down_course_score_num(self.container_id, self.author_id, "Attachment") + end + end end # Delete the previous articles index in Elasticsearch diff --git a/app/models/comment.rb b/app/models/comment.rb index 4d7af1d73..b87203a50 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -36,6 +36,7 @@ class Comment < ActiveRecord::Base validates_presence_of :commented, :author, :comments safe_attributes 'comments' after_create :send_mail, :act_as_system_message, :act_as_student_score + after_destroy :down_course_score def act_as_system_message if self.commented.course @@ -86,4 +87,11 @@ class Comment < ActiveRecord::Base end end + # 课程新闻数减少 + def down_course_score + if self.commented.course + down_course_score_num(self.commented.course.id, self.author_id, "NewReply") + end + end + end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 7990979e4..dae779b65 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -73,7 +73,7 @@ class JournalsForMessage < ActiveRecord::Base #after_update :update_activity after_destroy :reset_counters! after_save :be_user_score - after_destroy :down_user_score + after_destroy :down_user_score, :down_course_score # default_scope { where('m_parent_id IS NULL') } @@ -184,6 +184,7 @@ class JournalsForMessage < ActiveRecord::Base end end end + # 更新用户分数 -by zjc def down_user_score #删除了留言回复 @@ -286,10 +287,19 @@ class JournalsForMessage < ActiveRecord::Base # 课程成员得分(活跃度) def act_as_student_score if self.jour_type == "Course" - course_member_score(self.jour_id, self.user_id, "JournalForMessage") + course_member_score(self.jour_id, self.user_id, "Course") elsif self.jour_type == "HomeworkCommon" course_member_score(self.jour.course_id, self.user_id, "HomeworkCommon") end end + # 删除操作的时候相应扣掉回复数 + def down_course_score + if self.jour_type == "Course" + down_course_score_num(self.jour_id, self.user_id, "Course") + elsif self.jour_type == "HomeworkCommon" + down_course_score_num(self.jour.course_id, self.user_id, "HomeworkCommon") + end + end + end diff --git a/app/models/message.rb b/app/models/message.rb index 44f2d2c80..0ddc6f8e0 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -79,7 +79,7 @@ class Message < ActiveRecord::Base after_create :add_author_as_watcher, :reset_counters!, :add_boards_count after_update :update_messages_board, :update_activity - after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count + after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message #before_save :be_user_score @@ -354,6 +354,18 @@ class Message < ActiveRecord::Base end end + # 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数 + def down_course_score + if self.course + if self.parent_id.nil? # 发帖 + down_course_score_num(self.course.id, self.author_id, "Message") + else + # 回帖 + down_course_score_num(self.course.id, self.author_id, "MessageReply") + end + end + end + def delete_org_activities OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all end diff --git a/app/models/news.rb b/app/models/news.rb index 028b6d737..6746d90cd 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -61,7 +61,7 @@ class News < ActiveRecord::Base after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score after_update :update_activity - after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities + after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score scope :visible, lambda {|*args| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) @@ -195,10 +195,18 @@ class News < ActiveRecord::Base OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all end + # 新增新闻统计数增加 def act_as_student_score if self.course course_member_score(self.course.id, self.author_id, "News") end end + # 删除新闻统计数减少 + def down_course_score + if self.course + down_course_score_num(self.course.id, self.author_id, "News") + end + end + end \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 2a44f2980..90c90e48d 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -163,8 +163,8 @@ + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 + contributor_score.news_num.to_i * 1 %> <% unless total_score ==0 %> -
  • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %> -

    <%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %>

    +
  • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %> +

    <%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %>

    <%=total_score %>

    diff --git a/db/schema.rb b/db/schema.rb index 76dd8e19c..a7ffc23b1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1387,7 +1387,6 @@ ActiveRecord::Schema.define(:version => 20160304234903) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 - t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" end From 99be187d544e1a4e3f979288e66490c4a5594550 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 9 Mar 2016 11:30:28 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=20=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=A2=84=E8=A7=88=E7=9A=84=E6=96=87=E4=BB=B6=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E7=9B=B4=E6=8E=A5=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index f7845d6f1..e49c5a696 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -431,7 +431,10 @@ update def entry entry_and_raw(false) - render :layout => 'base_projects' + @content = @repository.cat(@path, @rev) + if is_entry_text_data?(@content, @path) + render :layout => 'base_projects' + end end def entry_and_raw(is_raw) @@ -443,9 +446,7 @@ update @content = @repository.cat(@path, @rev) (show_error_not_found; return) unless @content - if is_raw || - (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || - ! is_entry_text_data?(@content, @path) + if is_raw || (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path) # Force the download send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) } send_type = Redmine::MimeType.of(@path) From 84d7049add1674395323513b172e744f34e57909 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 9 Mar 2016 13:17:37 +0800 Subject: [PATCH 06/10] =?UTF-8?q?fork=E5=BC=B9=E5=87=BA=E6=96=B0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E8=A7=A3=E5=86=B3=E9=97=B4=E6=8E=A5=E6=80=A7?= =?UTF-8?q?500=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/controllers/repositories_controller.rb | 2 +- app/views/repositories/show.html.erb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b650afe1b..3d5030c29 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -406,6 +406,7 @@ class ProjectsController < ApplicationController end flash.now[:error] = html if !html.to_s.blank? end + # for:设置默认分支 scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first @repository = Repository.factory(scm) @repository.is_default = @project.repository.nil? diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e49c5a696..9bb6055ee 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -140,7 +140,7 @@ class RepositoriesController < ApplicationController attrs = {:parent_id => project.parent_id}.reject {|k,v| v.nil?} redirect_to new_project_url(attrs, :course => '0') else - redirect_to settings_project_url(project) + redirect_to project_path(project) end } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) } diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 76d5745df..51918d2d7 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -27,7 +27,7 @@ <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> <% if User.current.id != @project.user_id %> -
    <%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %> +
    <%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %> <%= @project.forked_count.to_i %>
    <% end %> From b4800585e7b82ba514dbbaa2b1a93440780c7100 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 9 Mar 2016 15:24:02 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=B6=88=E6=81=AF=20?= =?UTF-8?q?=E4=BF=A1=E6=81=AF500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_at_message.html.erb | 2 +- app/views/users/_user_message_course.html.erb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/users/_user_at_message.html.erb b/app/views/users/_user_at_message.html.erb index f174e8513..c4a257358 100644 --- a/app/views/users/_user_at_message.html.erb +++ b/app/views/users/_user_at_message.html.erb @@ -5,7 +5,7 @@ <%= ma.author.login %>提到了你:
  • - <%= link_to ma.subject.html_safe, ma.url, + <%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course, :parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id), :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
  • diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 9f7b90ee4..ff91375c8 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -246,7 +246,8 @@ <% if ma.course_message_type == "Message" %>