diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 94b0b2c6e..b5b6c5bd0 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -345,7 +345,11 @@ module ApplicationHelper
def link_to_isuue_user(user, options={})
if user.is_a?(User)
- name = h(user.name(options[:format]))
+ if options[:format]
+ name = h(user.name(options[:format]))
+ else
+ name = h(user.show_name)
+ end
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p"
else
h(user.to_s)
@@ -921,6 +925,12 @@ module ApplicationHelper
s.html_safe
end
+ # 计算Pull Request的请求数目
+ def pull_request_count project
+ g = Gitlab.client
+ g.merge_requests(project.gpid).count
+ end
+
#项目成员列表复选框生成
def project_member_check_box_tags_ex name, principals
s = ''
@@ -978,7 +988,7 @@ module ApplicationHelper
groups = ''
collection.sort.each do |element|
selected_attribute = ' selected="selected"' if option_value_selected?(element, selected)
- (element.is_a?(Group) ? groups : s) << %()
+ (element.is_a?(Group) ? groups : s) << %()
end
unless groups.empty?
s << %()
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 71c50cd82..ceff7a0a0 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -54,6 +54,7 @@ module CoursesHelper
# searchTeacherAndAssistant(project).count
end
+ # 统计数目
def show_nav?(count)
count == 0 ? true : false
end
@@ -798,11 +799,12 @@ module CoursesHelper
link.html_safe
end
+ # 可以查看到资源库的资源
def visable_attachemnts_incourse course
return[] unless course
result = []
course.attachments.each do |attachment|
- if (attachment.is_public? && attachment.is_publish == 1) ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,course)|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
+ if attachment.is_public? && attachment.is_publish == 1 || User.current == attachment.author || User.current.allowed_to?(:as_teacher,course) || (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
result << attachment
end
end
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index b161e29e9..5a124849f 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -111,9 +111,9 @@ module IssuesHelper
def principals_options_for_isuue_list(project)
if User.current.member_of?(project)
- project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
+ project.members.includes(:user).order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
else
- project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
+ project.members.includes(:user).order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["指派给", 0])
end
end
diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb
index b37c80dad..b4c45b44c 100644
--- a/app/views/attachments/_activity_attach.html.erb
+++ b/app/views/attachments/_activity_attach.html.erb
@@ -9,8 +9,9 @@
(
<%= number_to_human_size attachment.filesize %>)
-
- <%= link_to h(truncate(attachment.author.name, length: 15, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
+ <% user_name = attachment.author.show_name.empty? ? attachment.author : attachment.author.show_name %>
+
+ <%= link_to h(truncate(user_name, length: 15, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
<%= format_time(attachment.created_on) %>
diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb
index ec9f4f7de..9a52fb410 100644
--- a/app/views/forums/_forum_list.html.erb
+++ b/app/views/forums/_forum_list.html.erb
@@ -11,7 +11,8 @@
<%#= link_to forum.name.gsub(/(\r\n|\s+)/,'
'), forum_path(forum),:class=>"f16 linkBlue" %>
<%= textAreailizable forum.description%>
-
+ <% user_name = forum.creator.show_name.empty? ? forum.creator.name : forum.creator.show_name %>
+
创建时间:<%= format_date(forum.created_at) %>
diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb
index 11b1403cd..c3b8b4dbe 100644
--- a/app/views/forums/_show_topics.html.erb
+++ b/app/views/forums/_show_topics.html.erb
@@ -27,7 +27,7 @@
<% author = topic.last_reply.try(:author)%>
<% if author%>
-
+
<%= format_date(topic.last_reply.created_at)%>
<% end%>
更新时间:<%= format_date(topic.updated_at)%>
diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb
index ac912a71c..9ae3dfc43 100644
--- a/app/views/issues/_detail.html.erb
+++ b/app/views/issues/_detail.html.erb
@@ -20,7 +20,7 @@
<%= get_issue_priority(@issue.priority_id)[1] %>
- 由<%=link_to @issue.author, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %>
+ 由<%=link_to @issue.author.show_name, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %>
diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb
index ccd37dc91..ea15af42e 100644
--- a/app/views/issues/_edit.html.erb
+++ b/app/views/issues/_edit.html.erb
@@ -3,7 +3,7 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<% end %>
-<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true, :remote => true} do |f| %>
+<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %>
<%= error_messages_for 'issue', 'time_entry' %>
<%= render :partial => 'conflict' if @conflict %>
diff --git a/app/views/issues/_jounal_refresh.js.erb b/app/views/issues/_jounal_refresh.js.erb
index db5a068bf..5ccbf69d2 100644
--- a/app/views/issues/_jounal_refresh.js.erb
+++ b/app/views/issues/_jounal_refresh.js.erb
@@ -1,3 +1,8 @@
+/* $("#reply_div_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
+$("#issue_detail_show").html('<%#= escape_javascript(render :partial => 'issues/detail') %>');
+$("#issue_edit_show").html('<%#= escape_javascript(render :partial => 'issues/edit') %>');
+$("#div_issue_attachment_<%#=@issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
+sd_create_editor_from_data(<%#= @issue.id %>, null, "100%", "<%#= @issue.class.name %>");*/
location.reload();
issue_desc_editor = KindEditor.create('#issue_description',
@@ -14,3 +19,5 @@ issue_desc_editor = KindEditor.create('#issue_description',
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
+// $(".homepagePostReplyBannerCount").html('<%#= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
+// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%","<%#= @issue.class.name %>");
\ No newline at end of file
diff --git a/app/views/issues/update.js.erb b/app/views/issues/update.js.erb
index 733066d38..bcf4c3077 100644
--- a/app/views/issues/update.js.erb
+++ b/app/views/issues/update.js.erb
@@ -1,4 +1,13 @@
<% if @saved %>
+/*$("#issue_detail").replaceWith('<%#= escape_javascript(render :partial => 'issues/detail') %>');
+$("#issue_edit").replaceWith('<%#= escape_javascript(render :partial => 'issues/edit') %>');
+
+$("#issue_detail").show();
+$("#issue_edit").hide();
+
+$("#reply_div_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
+sd_create_editor_from_data(<%#= @issue.id%>, null, "100%","<%#=@issue.class.name%>");
+$(".homepagePostReplyBannerCount").html('<%#= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');*/
location.reload();
//edit里的编辑器貌似显示不出来,所以手动js生成。
issue_desc_editor = KindEditor.create('#issue_description',
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 2c72e3e2e..84aa054e0 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -1,6 +1,7 @@
<%# course_model %>
-<%# course_file_num = visable_attachemnts_incourse(@course).count%>
-<% course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %>
+<%# course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %>
+
+<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% homework_num = visable_course_homework @course %>
diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb
index 021b281d9..b57feb5bd 100644
--- a/app/views/layouts/base_forums.html.erb
+++ b/app/views/layouts/base_forums.html.erb
@@ -187,7 +187,8 @@
<%= @forum.name%>
-
+ <% user_name = @forum.creator.show_name.empty? ? @forum.creator.name : @forum.creator.show_name %>
+
diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb
index d684b4297..7015d17e5 100644
--- a/app/views/memos/show.html.erb
+++ b/app/views/memos/show.html.erb
@@ -58,7 +58,7 @@
- <%= link_to @memo.author.name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%>
+ <%= link_to @memo.author.show_name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%>
<%= format_date( @memo.created_at)%>
@@ -90,7 +90,7 @@
<%= reply.author.name%><%= format_date(reply.created_at) %>
-
<%= h reply.content.html_safe%>
+
<%= h reply.content.html_safe %>