diff --git a/.gitignore b/.gitignore
index 9d33b264c..601f691a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,4 @@ public/javascripts/wechat/node_modules/
.access_token
tmux*.log
config/wechat.yml
+config/oneapm.yml
diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb
index eeea2d01a..8c6cc4f0c 100644
--- a/app/controllers/blogs_controller.rb
+++ b/app/controllers/blogs_controller.rb
@@ -26,7 +26,7 @@ class BlogsController < ApplicationController
@type = 2
@topics.each do |topic|
- topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count)
+ topic[:infocount] = get_praise_num(topic) + BlogComment.where("root_id = #{topic.id}").count
if topic[:infocount] < 0
topic[:infocount] = 0
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 2bdaddb25..13a1a1e58 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@@ -739,7 +740,7 @@ class ProjectsController < ApplicationController
rescue Exception => e
puts e
end
- # 删除Trustie班额本库记录
+ # 删除Trustie版本库记录
repoisitory = Repository.where(:project_id => @project.id, :type => GITLABTYPE).first
repoisitory.delete
@project.update_column(:gpid, nil)
@@ -799,6 +800,31 @@ class ProjectsController < ApplicationController
@project = nil
end
+ REP_TYPE = "Repository::Gitlab"
+ # Delete @project's repository
+ def destroy_repository
+ if is_project_manager?(User.current.id, @project.id)
+ @gitlab_repository = Repository.where(:project_id => @project, :type => REP_TYPE).first
+ @is_true = params[:is_true]
+ if @is_true
+ begin
+ g = Gitlab.client
+ g.delete_project(@project.gpid)
+ @gitlab_repository.destroy
+ @gitlab_repository = nil
+ scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
+ @repository = Repository.factory(scm)
+ @repository.is_default = @project.repository.nil?
+ @project.update_attribute(:gpid, nil)
+ rescue Exception => e
+ puts e
+ end
+ end
+ else
+ return render_403
+ end
+ end
+
def show_projects_score
respond_to do |format|
format.html { render :layout => "base_projects"}
@@ -946,6 +972,14 @@ class ProjectsController < ApplicationController
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
+ #@curse_attachments_all = @all_attachments[@offset, @limit]
+ @watchers = paginateHelper @watchers,20
end
end
@@ -962,5 +996,7 @@ class ProjectsController < ApplicationController
end
return projects
end
+
#gcmend
end
+
diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb
index ec9f98ccf..a71f9c105 100644
--- a/app/controllers/pull_requests_controller.rb
+++ b/app/controllers/pull_requests_controller.rb
@@ -92,7 +92,7 @@ class PullRequestsController < ApplicationController
if compare_pull_request(source_branch, target_project_id, target_branch)
# 如果传送了目标项目ID即向fork源项目发送请求
# if params[:forked_project_id] && params[:source_project] == "forked_project_name"
- if params[:target_project_id]
+ if params[:target_project_id].to_i != @project.id
target_project_id = params[:forked_project_id].to_i
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
@@ -109,7 +109,7 @@ class PullRequestsController < ApplicationController
format.js{redirect_to new_project_pull_request_path(:show_tip => tip)}
end
end
- rescue Exception => e
+ rescue Gitlab::Error::Conflict => e
@message = e.message
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 56b536d30..049789115 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1369,9 +1369,10 @@ class UsersController < ApplicationController
@jour = jours.limit(10).offset(@page * 10)
@type = params[:type]
if User.current == @user
- jours.update_all(:is_readed => true, :status => false)
- jours.each do |journal|
- fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
+ @jour.update_all(:is_readed => true, :status => false)
+ @jour.each do |journal|
+ # fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
+ journal.delay.set_children_readed_delay
end
end
@state = false
diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb
index da0c5733a..6f0d96dfa 100644
--- a/app/controllers/watchers_controller.rb
+++ b/app/controllers/watchers_controller.rb
@@ -37,7 +37,9 @@ class WatchersController < ApplicationController
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@action = 'fans'
else
-
+ if params[:target_id]
+ @user = User.find(params[:target_id])
+ end
end
if params[:object_type] == 'project'
@@ -78,6 +80,9 @@ class WatchersController < ApplicationController
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@action = 'fans'
else
+ if params[:target_id]
+ @user = User.find(params[:target_id])
+ end
end
if params[:object_type] == 'project'
@project = Project.find(params[:object_id])
diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb
index a082d72ff..654f83855 100644
--- a/app/controllers/wechats_controller.rb
+++ b/app/controllers/wechats_controller.rb
@@ -137,7 +137,7 @@ class WechatsController < ActionController::Base
on :fallback, respond: 'fallback message'
on :click, with: 'FEEDBACK' do |request, key|
- request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框,发微信给我们。\n2、加入QQ群:373967360,直接互动。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机:13467631747\nQQ:494496321"
+ request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框,发微信给我们。\n2、加入QQ群:373967360,直接互动。\n3、登录网站:www.trustie.net,给我们留言。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机:13467631747\nQQ:494496321"
end
on :click, with: 'MY_NEWS' do |request, key|
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 188481cb2..653afef62 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -312,6 +312,16 @@ module ProjectsHelper
type << option2
end
+ # 判断用户是否为项目管理员
+ def is_project_manager?(user_id, project_id)
+ @result = false
+ mem = Member.where("user_id = ? and project_id = ?",user_id, project_id)
+ unless mem.blank?
+ @result = mem.first.roles.to_s.include?("Manager") ? true : false
+ end
+ return @result
+ end
+
# 用来判断用户是否是项目的管理员
# added by william
def is_manager?(user_id,project_id)
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index acece2307..09d9115b4 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -333,6 +333,7 @@ module WatchersHelper
return '' unless user && user.logged?
objects = Array.wrap(objects)
watched = objects.any? {|object| object.watched_by?(user)}
+ watched = true if user.id == @project.user_id
@watch_flag = objects.first.instance_of?(Project)
id = watcher_css(objects)
text = @watch_flag ?
@@ -340,8 +341,13 @@ module WatchersHelper
url = watch_path(:object_type => objects.first.class.to_s.underscore,
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort))
method = watched ? 'delete' : 'post'
- link_to text, url, :remote => true, :method => method,
- :class => "pro_new_topbtn_left fl" ,:id=>id
+ if user.id != @project.user_id
+ link_to text, url, :remote => true, :method => method,
+ :class => "pro_new_topbtn_left fl" ,:id => id
+ else
+ link_to "关注", "javascript:void(0)", :remote => true, :method => method,
+ :class => "pro_new_grey_topbtn_left fl" , :id => id
+ end
end
def store_project_link project_id, user_id
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 4a9601d07..aa83c2210 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -344,4 +344,9 @@ class JournalsForMessage < ActiveRecord::Base
def content_detail
self.notes
end
+
+ def set_children_readed_delay
+ # fetch_user_leaveWord_reply(self).update_all(:is_readed => true, :status => false)
+ end
+
end
diff --git a/app/views/issues/_statistics.html.erb b/app/views/issues/_statistics.html.erb
index b144b8e6b..8b1fc6f22 100644
--- a/app/views/issues/_statistics.html.erb
+++ b/app/views/issues/_statistics.html.erb
@@ -12,7 +12,7 @@
<%= link_to "打开#{@issue_open_count}".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %>
- <%= link_to "锁定#{@issue_close_count}".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
+ <%= link_to "关闭#{@issue_close_count}".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index 07be357dc..7846efa18 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -148,7 +148,7 @@
粉丝
- <%= @user.watcher_users.count %>
+ <%= @user.watcher_users.count %>
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index 2a4b3b480..fd7425aab 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -214,7 +214,8 @@
确认密码 :
-
+
+
- 请输入8-12个字符
-
diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb
index ec64a08ae..55190c613 100644
--- a/app/views/projects/_applied_status.html.erb
+++ b/app/views/projects/_applied_status.html.erb
@@ -3,7 +3,8 @@
-
<%= watcher_link_for_project(@project, User.current) %>
- <%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id},:id=>"fans_num", :class => 'pro_new_topbtn fl' %>
+ <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist",
+ :id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
-
@@ -12,15 +13,21 @@
<% else %>
等待审批
<% end %>
- <%= 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 => "项目成员列表" %>
<% end %>
<% else %>
- <% if User.current.id != @project.user_id %>
+ <% if User.current.login? %>
+ -
+ <%= watcher_link_for_project(@project, User.current) %>
+ <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist",
+ :id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
+
-
已加入
- <%= Member.where(:project_id => @project.id).count %>
+
+ <%= 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 => "项目成员" %>
<% end %>
@@ -35,8 +42,17 @@
<%= link_to "".html_safe+"Fork", forked_pop_project_path(@project),
:class=>"pro_new_topbtn_left fl", :remote => true %>
- <%= @project.forked_count.to_i %>
+ <%= @project.forked_count.to_i %>
+
+<% else%>
+ -
+ <%#= link_to "".html_safe+"Fork","#",
+ :class=>"pro_new_grey_topbtn_left fl"%>
+
+ Fork
+
+ <%= @project.forked_count.to_i %>
<% end %>
diff --git a/app/views/projects/_project_member_list.html.erb b/app/views/projects/_project_member_list.html.erb
index eb2573d03..31a86e8c9 100644
--- a/app/views/projects/_project_member_list.html.erb
+++ b/app/views/projects/_project_member_list.html.erb
@@ -1,30 +1,31 @@
-
-
加入时间
-
+
<% members.each do |member| %>
-
-
- <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
-
-
<%= l(:label_user_for_project_grade) %>:<%= format("%.2f" ,read_user_project_scores(member.user,@project)).to_i %>
+
-
+ <%= link_to image_tag(url_to_avatar(member.user), :width => "50", :height => "50"), user_path(member.user), :alt => "用户头像", :class => "pro_new_users fl mr5" %>
+
+ <%= link_to member.user.try(:show_name), user_path(member.user), :class => "pro_new_users mt5 fl" %>
+
+
+ <%= h time_tag(member.created_on) %>
+
+
+ <% end %>
+
-
<%= l(:label_username)%>
- <%= link_to(member.user.name, user_path(member.user),:class => "ml10 c_blue02") %>(<%= rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ') %>)
+
-
- <%= format_date(member.created_on)%>
-
-
- <% end%>
-
-
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
+
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
+
diff --git a/app/views/projects/_reposistory_destory_pop.html.erb b/app/views/projects/_reposistory_destory_pop.html.erb
new file mode 100644
index 000000000..1f8dd06f2
--- /dev/null
+++ b/app/views/projects/_reposistory_destory_pop.html.erb
@@ -0,0 +1,22 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/views/projects/destroy_repository.js.erb b/app/views/projects/destroy_repository.js.erb
new file mode 100644
index 000000000..3bc1d727b
--- /dev/null
+++ b/app/views/projects/destroy_repository.js.erb
@@ -0,0 +1,6 @@
+<% if @is_true %>
+$("#pro_st_tbc_06").html('<%= escape_javascript( render :partial => 'projects/settings/new_repositories') %>');
+<% else %>
+var htmlvalue = "<%= escape_javascript(render :partial => 'projects/reposistory_destory_pop') %>";
+pop_box_new(htmlvalue,460,316);
+<% end %>
diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb
index e24dab160..49ab1ac68 100644
--- a/app/views/projects/member.html.erb
+++ b/app/views/projects/member.html.erb
@@ -1,11 +1,12 @@
-
-
-
<%= @subPage_title %>
+
+
+
<%= @subPage_title %>
<% if is_project_manager?(User.current, @project) %>
- <%=link_to "成员管理", :controller => 'projects', :action => 'settings', :id => @project.id, :tab => 'members' %>
+ <%=link_to "成员管理", {:controller => 'projects', :action => 'settings'}, :id => @project.id, :tab => 'members', :class => "sy_cblue", :style => "font-weight: normal;" %>
<% end %>
+
<%= error_messages_for 'member' %>
diff --git a/app/views/projects/member_forked.html.erb b/app/views/projects/member_forked.html.erb
index 488952057..5ea62b4c9 100644
--- a/app/views/projects/member_forked.html.erb
+++ b/app/views/projects/member_forked.html.erb
@@ -9,7 +9,7 @@
/
<%= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %>
- <%=h time_tag(project.created_on) %>前
+ <%=h time_tag(project.created_on) %>
<% end %>
diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb
index b5a6ffe57..7322a0615 100644
--- a/app/views/projects/settings/_new_repositories.html.erb
+++ b/app/views/projects/settings/_new_repositories.html.erb
@@ -14,7 +14,7 @@
- <%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false, :label=>"", :no_label => true, :class => "w650 fl", :style => "height: 28px;", :id => "project_setting_repository" %>
+ <%= f.text_field :identifier, :disabled => @repository.nil? || @repository.identifier_frozen? ? true:false, :label=>"", :no_label => true, :class => "w650 fl", :style => "height: 28px;", :id => "project_setting_repository" %>
版本库名是无效的
-
@@ -35,14 +35,22 @@
版本库名 |
管理系统 |
- 库路径 |
+ 库路径 |
+ |
<%= @gitlab_repository.identifier %> |
Git |
- <%=h @repos_url %> |
+ <%=h @repos_url %> |
+
+ <% if is_project_manager?(User.current.id, @project.id) %>
+ <%= link_to "删除", destroy_repository_project_path(@project), :class => "c_blue", :remote => true %>
+ <% else %>
+ <%= "删除" %>
+ <% end %>
+ |
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index 09ed2216a..74a4878b8 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -1,11 +1,11 @@
-
+
<%= render :partial => 'projects/invite_code' %>
<% if @project.description.blank? %>
-
<%= @project.name %>
+
<%= @project.name %>
<% else %>
-
<%=h @project.description.html_safe %>
+
<%=h @project.description.html_safe %>
<% end %>
diff --git a/app/views/projects/watcherlist.html.erb b/app/views/projects/watcherlist.html.erb
index effef316b..ffa0670de 100644
--- a/app/views/projects/watcherlist.html.erb
+++ b/app/views/projects/watcherlist.html.erb
@@ -1,28 +1,28 @@
-
-
-
<%= l(:label_user_watcher)%>
-
-
-
-
加入时间
-
+
+
成员 本页面展示关注了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户
+
+
- <% for user in @project.watcher_users %>
-
-
- <% end%>
+
+
+
+ <%= pagination_links_full @watcher_pages, @watchers_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
+
+
+
+
+
-
-
-
-
-
- <% html_title(l(:label_followers)) -%>
-
\ No newline at end of file
diff --git a/app/views/pull_requests/_form.html.erb b/app/views/pull_requests/_form.html.erb
index 43b3bf4d9..d76c3e8a8 100644
--- a/app/views/pull_requests/_form.html.erb
+++ b/app/views/pull_requests/_form.html.erb
@@ -12,9 +12,9 @@
<% if @forked_project.nil? %>
<%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "fl PullReques_minselect ml5" %>
<% else %>
-