Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2016-09-14 15:24:02 +08:00
commit 89de36ec65
18 changed files with 72 additions and 33 deletions

View File

@ -345,7 +345,11 @@ module ApplicationHelper
def link_to_isuue_user(user, options={})
if user.is_a?(User)
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) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.name}</option>)
(element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.show_name}</option>)
end
unless groups.empty?
s << %(<optgroup label="#{h(l(:label_group_plural))}">#{groups}</optgroup>)

View File

@ -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

View File

@ -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

View File

@ -9,8 +9,9 @@
<span class="postAttSize">(
<%= number_to_human_size attachment.filesize %>)
</span>
<span class="author" title="<%= attachment.author%>">
<%= 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 %>
<span class="author" title="<%= user_name %>">
<%= link_to h(truncate(user_name, length: 15, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
<%= format_time(attachment.created_on) %>
</span>
</div>

View File

@ -11,7 +11,8 @@
<%#= link_to forum.name.gsub(/(\r\n|\s+)/,'<br/>'), forum_path(forum),:class=>"f16 linkBlue" %>
</div>
<div class="postDes"><%= textAreailizable forum.description%></div>
<div class="postCreater">创建者:<a href="<%= user_path( forum.creator)%>" class="linkGrey2" target="_blank"><%= forum.creator.name %></a></div>
<% user_name = forum.creator.show_name.empty? ? forum.creator.name : forum.creator.show_name %>
<div class="postCreater">创建者:<a href="<%= user_path( forum.creator)%>" class="linkGrey2" target="_blank"><%= user_name %></a></div>
<div class="postDate">创建时间:<%= format_date(forum.created_at) %></div>
</div>
<div class="postStatics">

View File

@ -27,7 +27,7 @@
</div>
<% author = topic.last_reply.try(:author)%>
<% if author%>
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.name%></a></div>
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.show_name%></a></div>
<div class="postDetailDate"><%= format_date(topic.last_reply.created_at)%></div>
<% end%>
<span class=" fr " style="color: #888888; font-size: 12px;">更新时间:<%= format_date(topic.updated_at)%></span>

View File

@ -20,7 +20,7 @@
<span class='<%= "#{get_issue_priority(@issue.priority_id)[0]} " %>'><%= get_issue_priority(@issue.priority_id)[1] %></span></p>
<br>
<div class="cl"></div>
由<%=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 %>
</div>
<!--talk_txt end-->

View File

@ -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 %>
<!--编辑的整个属性-->

View File

@ -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 %>");

View File

@ -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',

View File

@ -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 %>

View File

@ -187,7 +187,8 @@
</div>
<div class="fl">
<div class="f16 fontBlue mb10" style="word-break: break-all; word-wrap:break-word;white-space:pre-wrap;"><%= @forum.name%></div>
<div class="fontGrey2 mb8">吧主:<a href="<%= user_path(@forum.creator)%>" class="linkBlue"><%= @forum.creator.name%></a></div>
<% user_name = @forum.creator.show_name.empty? ? @forum.creator.name : @forum.creator.show_name %>
<div class="fontGrey2 mb8">吧主:<a href="<%= user_path(@forum.creator)%>" class="linkBlue"><%= user_name %></a></div>
<div class="fontGrey3">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @forum.memo_count %></a> 帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%=@forum.topic_count%></a></div>
</div>
<div class="cl"></div>

View File

@ -58,7 +58,7 @@
<div class="cl"></div>
<div class="postDetailCreater">
<%= link_to @memo.author.name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%></div>
<%= link_to @memo.author.show_name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%></div>
<div class="postDetailDate mb5"><%= format_date( @memo.created_at)%></div>
<div class="cl"></div>
<div class="homepagePostIntro memo-content" id="activity_description_<%= @memo.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
@ -100,6 +100,8 @@
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
postContent = postContent.gsub(/<script>*/, "<script>");
postContent = postContent.gsub(/<html>*/, "<html>");
$(this).html(postContent);
});
autoUrl('activity_description_<%= reply.id %>');

View File

@ -44,6 +44,7 @@
<% if allow_pull_request(@project) > 0 && allow_show_pull_request(@project) > 0 %>
<div class="subNav">
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<%= link_to "(#{pull_request_count(@project)})", project_pull_requests_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% if User.current.member_of?(@project) %>
<%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %>
<% end %>

View File

@ -62,7 +62,7 @@
<li>
<p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p" style="width:130px;">
<%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:100px; display:inline-block;" %>
<%= link_to activity.try(:assigned_to).show_name, user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:100px; display:inline-block;" %>
<a href="javascript:void(0)" class="pic_edit2 ml5" style="vertical-align:top;"></a></span>
<%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project),
{ :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0},

View File

@ -25,7 +25,8 @@
<%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %>
</div>
<div class="orgIntro"><%= org.description %></div>
<div class="postCreater">创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %></div>
<% user_name = User.find(org.creator_id).show_name.empty? ? User.find(org.creator_id) : User.find(org.creator_id).show_name %>
<div class="postCreater">创建者:<%= link_to user_name, user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %></div>
<div class="postDate fl mr40">创建时间:<%= format_activity_day(org.created_at) %> <%= format_time(org.created_at, false) %></div>
<div class="postCreater">您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %></div>
</div>

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160907061917) do
ActiveRecord::Schema.define(:version => 20160907080621) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -56,8 +56,8 @@ ActiveRecord::Schema.define(:version => 20160907061917) do
t.integer "user_id"
t.integer "applied_id"
t.string "applied_type"
t.integer "viewed", :default => 0
t.integer "status", :default => 0
t.integer "viewed"
t.integer "status"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "name"
@ -173,6 +173,7 @@ ActiveRecord::Schema.define(:version => 20160907061917) do
t.integer "quotes"
t.integer "is_publish", :default => 1
t.date "publish_time"
t.boolean "init_file", :default => false
end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
@ -318,6 +319,8 @@ ActiveRecord::Schema.define(:version => 20160907061917) do
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"

View File

@ -549,7 +549,7 @@ a:hover.upload_btn_grey{background:#8a8a8a;}
.merge-discussion-input textarea {width:720px; height:80px; font-size:13px; line-height:16px; color:#484848; padding:5px;}
/*新版项目列表新增*/
.new_project_title{ font-size:16px; color:#333; max-width:560px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.new_project_title{ font-size:16px; color:#333; max-width:480px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.icons_project_list{ width:8px; height:8px; border:2px solid #fff; background:#3b94d6;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;-webkit-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);-moz-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5); }
.icons_project_favorite {background: url(/images/syllabus/sy_icons_star.png) 0px 0px no-repeat; width:20px; height:20px; display:block; float:left;}
.icons_project_star{background: url(/images/syllabus/sy_icons_star.png) 0px -27px no-repeat; width:20px; height:20px; display:block; float:left;}