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

This commit is contained in:
cxt 2016-11-25 18:40:18 +08:00
commit ae7b8b2857
12 changed files with 71 additions and 33 deletions

View File

@ -32,7 +32,7 @@ class ProjectsController < ApplicationController
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
before_filter :file, :statistics #:watcherlist before_filter :file
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # 除非项目内人员,不可查看成员, TODO: 完了写报表里去
# before_filter :memberAccess, only: :member # before_filter :memberAccess, only: :member
@ -535,6 +535,23 @@ class ProjectsController < ApplicationController
end end
end end
def project_watcherlist
unless @project.nil?
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403
else
@users -= watched.watcher_users if @watched
end
@watchers = @project.watcher_users
@limit = 20
@is_remote = true
@watchers_count = @watchers.count
@watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1
@offset ||= @watcher_pages.offset
@watchers = paginateHelper @watchers, 20
end
end
# include CoursesHelper # include CoursesHelper
def member def member
# 消息"同意加入项目" # 消息"同意加入项目"
@ -603,7 +620,7 @@ class ProjectsController < ApplicationController
@limit = 20 @limit = 20
@is_remote = true @is_remote = true
@forked_count = @project.forked_count @forked_count = @forked_projects.count
@forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1 @forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1
@offset ||= @forked_pages.offset @offset ||= @forked_pages.offset
@forked_projects = paginateHelper @forked_projects, @limit @forked_projects = paginateHelper @forked_projects, @limit
@ -671,13 +688,7 @@ class ProjectsController < ApplicationController
end end
def statistics def statistics
@watchers = @project.watcher_users
@limit = 20
@is_remote = true
@watchers_count = @watchers.count
@watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1
@offset ||= @watcher_pages.offset
@watchers = paginateHelper @watchers, 20
end end
#end #end
@ -978,16 +989,6 @@ class ProjectsController < ApplicationController
true true
end end
def watcherlist
unless @project.nil?
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403
else
@users -= watched.watcher_users if @watched
end
end
end
#gcm #gcm
def desc_sort_course_by_avtivity(activity_count,projects) def desc_sort_course_by_avtivity(activity_count,projects)
return projects if activity_count.size<2 return projects if activity_count.size<2

View File

@ -2837,6 +2837,12 @@ module ApplicationHelper
tag_list tag_list
end end
# 获取项目fork成员数
def project_fork_count
@forked_projects = Project.where(:forked_from_project_id => @project.id)
@forked_count = @forked_projects.count
end
def get_org_subfield_tag_list org_subfield def get_org_subfield_tag_list org_subfield
all_attachments = org_subfield.attachments.select{|attachment| attachment.is_public? || all_attachments = org_subfield.attachments.select{|attachment| attachment.is_public? ||
(attachment.container_type == "OrgSubfield" && User.current.member_of_org?(org_subfield.organization))|| (attachment.container_type == "OrgSubfield" && User.current.member_of_org?(org_subfield.organization))||

View File

@ -2,12 +2,12 @@ module PullRequestsHelper
# 获取diff内容行号 # 获取diff内容行号
def diff_line_num content def diff_line_num content
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i result = content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
end end
# 处理内容 # 处理内容
def diff_content content def diff_content content
content.gsub!(/.*@@ -\d+,\d+ \+\d+,\d+ @@\n/m,'') result = content.gsub!(/.*@@.*@@\n/m,'')
end end
def get_user_name user_id def get_user_name user_id

View File

@ -9,6 +9,7 @@
<div class="pro_new_top clear mb10"> <div class="pro_new_top clear mb10">
<div class="fl pro_new_name ml15 clear"> <div class="fl pro_new_name ml15 clear">
<% unless @project.is_public? %><span class="icons_newpro_lock fl "></span><% end %> <% unless @project.is_public? %><span class="icons_newpro_lock fl "></span><% end %>
<%=link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
<%=link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %> <%=link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %>
</div> </div>

View File

@ -3,7 +3,7 @@
<!--关注项目--> <!--关注项目-->
<li class="mr5 fl"> <li class="mr5 fl">
<%= watcher_link_for_project(@project, User.current) %> <%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist", <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %> :id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li> </li>
<!--加入项目--> <!--加入项目-->
@ -21,11 +21,11 @@
<% if User.current.login? %> <% if User.current.login? %>
<li class="mr5 fl"> <li class="mr5 fl">
<%= watcher_link_for_project(@project, User.current) %> <%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist", <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %> :id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li> </li>
<li class="mr5 fl"> <li class="mr5 fl">
<a class="pro_new_topbtn_left fl "> 已加入</a> <a class="pro_new_topbtn_left fl " style="cursor:default;"> 已加入</a>
<!-- <a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>--> <!-- <a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>-->
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %> <%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %>
</li> </li>
@ -42,7 +42,7 @@
<!-- <a href="<%#= {:controller => 'repositories', :action => 'forked'} %>" class="pro_new_topbtn_left fl" target="_blank">Fork</a>--> <!-- <a href="<%#= {:controller => 'repositories', :action => 'forked'} %>" class="pro_new_topbtn_left fl" target="_blank">Fork</a>-->
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project), <%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),
:class=>"pro_new_topbtn_left fl", :remote => true %> :class=>"pro_new_topbtn_left fl", :remote => true %>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= @project.forked_count.to_i %></a> <a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
</li> </li>
<% else%> <% else%>
@ -52,7 +52,7 @@
<a href="javascript:void(0)" class="pro_new_grey_topbtn_left fl" > <a href="javascript:void(0)" class="pro_new_grey_topbtn_left fl" >
<span class='vl_fork'>Fork</span> <span class='vl_fork'>Fork</span>
</a> </a>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= @project.forked_count.to_i %></a> <a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
<% end %> <% end %>

View File

@ -3,7 +3,7 @@
<h2 class="clear"><%= @subPage_title %> <h2 class="clear"><%= @subPage_title %>
<% if is_project_manager?(User.current, @project) %> <% if is_project_manager?(User.current, @project) %>
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;"> <span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
<%=link_to "成员管理", {:controller => 'projects', :action => 'settings'}, :id => @project.id, :tab => 'members', :class => "sy_cblue", :style => "font-weight: normal;" %> <%=link_to "成员管理", settings_project_url(@project, :tab => 'members'), :id => @project.id, :class => "sy_cblue", :style => "font-weight: normal;" %>
</span> </span>
<% end %> <% end %>
</h2> </h2>

View File

@ -0,0 +1,29 @@
<div class="pro_new_info mb10">
<h2 class="clear">成员<span class="fr pro_new_font mr15" > 本页面展示关注了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户</span></h2>
<ul class="clear pro_new_users_box">
<% @watchers.each do |user| %>
<li class="clear">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像", :class => "pro_new_users fl mr5" %>
<div class="fl mt5 clear">
<%= link_to user.try(:show_name), user_path(user), :class => "pro_new_users mt5 fl" %>
<!-- <span class="ml5 mr5 mt5 fl"> / </span>
<%#= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %>-->
<br/>
<span class=" c_grey mt3 fl"><%=h time_tag(user.created_on) %></span>
</div>
</li>
<% end %>
</ul>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @watcher_pages, @watchers_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -780,6 +780,7 @@ RedmineApp::Application.routes.draw do
get 'settings(/:tab)', :action => 'settings', :as => 'settings' get 'settings(/:tab)', :action => 'settings', :as => 'settings'
#by young #by young
get 'member', :to => 'projects#member', :as => 'member' get 'member', :to => 'projects#member', :as => 'member'
match 'project_watcherlist', :to => 'projects#project_watcherlist', :as => 'project_watcherlist'
match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine' match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine'
match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine' match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine'
match 'member_forked', :to => 'projects#member_forked', :as => 'member_forked' match 'member_forked', :to => 'projects#member_forked', :as => 'member_forked'

View File

@ -5067,9 +5067,9 @@ KEditor.prototype = {
] ]
K.each(fullItems, function(i, name) { K.each(fullItems, function(i, name) {
if (name == '|') { if (name == '|') {
htmlListFull.push('<span class="ke-inline-block ke-separator"></span>'); // htmlListFull.push('<span class="ke-inline-block ke-separator"></span>');
} else if (name == '/') { } else if (name == '/') {
htmlListFull.push('<div class="ke-hr"></div>'); // htmlListFull.push('<div class="ke-hr"></div>');
} else { } else {
htmlListFull.push('<span class="ke-outline" data-name="' + name + '" title="' + self.lang(name) + '" unselectable="on">'); htmlListFull.push('<span class="ke-outline" data-name="' + name + '" title="' + self.lang(name) + '" unselectable="on">');
htmlListFull.push('<span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-' + name + '" unselectable="on"></span></span>'); htmlListFull.push('<span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-' + name + '" unselectable="on"></span></span>');

View File

@ -865,9 +865,9 @@ a.pro_new_username_fork { font-size: 12px; color: #3b94d6; line-height: 24px;}
a.pro_new_proname{ overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;} a.pro_new_proname{ overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;}
a.pro_new_project_name{ width: 250px; overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;} a.pro_new_project_name{ width: 250px; overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;}
a.pro_new_topbtn{ padding: 3px 7px; font-size: 12px; line-height: 20px; color: #333;vertical-align: middle;background-color: #fff; border: 1px solid #ddd; border-left: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; color: #333;} a.pro_new_topbtn{ padding: 3px 7px; font-size: 12px; line-height: 20px; color: #333;vertical-align: middle;background-color: #fff; border: 1px solid #ddd; border-left: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; color: #333;}
a.pro_new_topbtn_left { padding: 3px 10px; font-size: 12px;line-height: 20px; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #333; } a.pro_new_topbtn_left { padding: 3px 10px; font-size: 12px;line-height: 20px; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #333;}
a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd);} a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd);}
a.pro_new_grey_topbtn_left{padding: 3px 10px; font-size: 12px;line-height: 20px; background: #fff; border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #888888; } a.pro_new_grey_topbtn_left{padding: 3px 10px; font-size: 12px;line-height: 20px; background: #fff; border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #888888; cursor:default;}
.pro_new_topnav ul{border-bottom: 3px solid #fff; height: 30px; line-height: 30px;} .pro_new_topnav ul{border-bottom: 3px solid #fff; height: 30px; line-height: 30px;}
.pro_new_topnav ul li{ float: left;padding:0 15px; height: 30px; line-height: 30px;text-align: center; } .pro_new_topnav ul li{ float: left;padding:0 15px; height: 30px; line-height: 30px;text-align: center; }
.pro_new_topnav_active{border-bottom: 3px solid #3b94d6; } .pro_new_topnav_active{border-bottom: 3px solid #3b94d6; }

View File

@ -117,7 +117,7 @@ a.resourcesTypeUser {background:url(../images/homepage_icon.png) -178px -453px n
.softwareIcon {background:url(/images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} .softwareIcon {background:url(/images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
/*意见反馈*/ /*意见反馈*/
html{ overflow-x:hidden;} html{ overflow-x:auto;}
.scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; } .scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; }
.side_content{width:180px; height:auto; overflow:hidden; float:left;} .side_content{width:180px; height:auto; overflow:hidden; float:left;}
.side_content .side_list {width:180px;overflow:hidden;} .side_content .side_list {width:180px;overflow:hidden;}

View File

@ -455,7 +455,7 @@ a.topnav_login_box:hover {color:#a1ebff;}
.portraitRadius {border-radius: 3px;} .portraitRadius {border-radius: 3px;}
/*底部*/ /*底部*/
#Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/ #Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;min-width: 1000px;} /*margin-bottom:10px;*/
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef; text-align:center;} .footerAboutContainer {width:auto; border-bottom:1px solid #efefef; text-align:center;}
.footerAbout{margin:0 auto;height:35px; line-height:35px; padding-top: 10px; display:inline-block;} .footerAbout{margin:0 auto;height:35px; line-height:35px; padding-top: 10px; display:inline-block;}
.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;} .languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}