-
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
+
+ <%= render :partial => "top" %>
From ac60940c34a2fbc1103c1109a1b989262a18a9ba Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 8 Nov 2016 16:18:59 +0800
Subject: [PATCH 16/96] =?UTF-8?q?1.=E9=A1=B9=E7=9B=AE=E5=A4=B4=E9=83=A8?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/projects_controller.rb | 10 +++-
app/controllers/repositories_controller.rb | 55 ++++++++++---------
app/views/projects/_applied_status.html.erb | 21 +++++--
app/views/projects/forked_pop.js.erb | 3 +
app/views/repositories/forked_popbox.html.erb | 7 +++
config/routes.rb | 2 +-
6 files changed, 63 insertions(+), 35 deletions(-)
create mode 100644 app/views/projects/forked_pop.js.erb
create mode 100644 app/views/repositories/forked_popbox.html.erb
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 059e55e0a..107f2ff88 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -27,7 +27,7 @@ class ProjectsController < ApplicationController
menu_item :feedback, :only => :feedback
menu_item :share, :only => :share
- before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project]
+ before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project, :forked_pop]
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 :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
@@ -760,6 +760,13 @@ class ProjectsController < ApplicationController
redirect_to admin_projects_url(:status => params[:status])
end
+ # 资源库fork弹框
+ def forked_pop
+ respond_to do |format|
+ format.js
+ end
+ end
+
def close
@project.close
redirect_to project_url(@project)
@@ -946,5 +953,4 @@ class ProjectsController < ApplicationController
return projects
end
#gcmend
-
end
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index bd6c67f58..ee5194500 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -87,35 +87,38 @@ class RepositoriesController < ApplicationController
end
def forked
- @project = Project.find(params[:id])
- @repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab")
- # 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项
- unless has_forked?(@project, User.current)
- project = project_from_current_project(@project.id, User.current.id)
- redirect_to project_path(project)
- else
- # 自己不能fork自己的项目
- if User.current.id == @project.user_id
- flash[:notice] = l(:project_gitlab_fork_own)
- redirect_to repository_url(@repository)
- else
- g = Gitlab.client
- if User.current.gid.nil?
- begin
- g.sync_user(User.current)
- ensure
- logger.error "Synv user failed ==>#{User.current.id}"
+ respond_to do |format|
+ format.html{
+ @project = Project.find(params[:id])
+ @repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab")
+ # 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项
+ unless has_forked?(@project, User.current)
+ project = project_from_current_project(@project.id, User.current.id)
+ redirect_to project_path(project)
+ else
+ # 自己不能fork自己的项目
+ if User.current.id == @project.user_id
+ flash[:notice] = l(:project_gitlab_fork_own)
+ redirect_to repository_url(@repository)
+ else
+ g = Gitlab.client
+ if User.current.gid.nil?
+ begin
+ g.sync_user(User.current)
+ ensure
+ logger.error "Synv user failed ==>#{User.current.id}"
+ end
+ end
+ gproject = g.fork(@project.gpid, User.current.gid)
+ if gproject
+ copy_project(@project, gproject)
+ forked_count = @project.forked_count.to_i + 1
+ @project.update_attributes(:forked_count => forked_count)
+ end
end
end
- gproject = g.fork(@project.gpid, User.current.gid)
- if gproject
- copy_project(@project, gproject)
- forked_count = @project.forked_count.to_i + 1
- @project.update_attributes(:forked_count => forked_count)
- end
- end
+ }
end
-
end
# 一键ZIP下载
diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb
index 3193e8e95..8c51cf1f6 100644
--- a/app/views/projects/_applied_status.html.erb
+++ b/app/views/projects/_applied_status.html.erb
@@ -18,16 +18,25 @@
<% else %>
<% if User.current.id != @project.user_id %>
- <%= "已加入" %>
- <%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :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 => "项目成员" %>
<% end %>
<% end %>
-
<% if @project.gpid && User.current.id != @project.user_id %>
-
<%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
- <%= link_to @project.forked_count.to_i, member_forked_project_path(@project) %>
-
+
+
+
+ <%= link_to "Fork", {:controller => 'projects', :action => 'forked_pop'},
+ :class=>"pro_new_topbtn_left fl", :remote => true %>
+ <%= @project.forked_count.to_i %>
+
<% end %>
diff --git a/app/views/projects/forked_pop.js.erb b/app/views/projects/forked_pop.js.erb
new file mode 100644
index 000000000..8a5705501
--- /dev/null
+++ b/app/views/projects/forked_pop.js.erb
@@ -0,0 +1,3 @@
+var htmlvalue = "<%= escape_javascript(render :partial => 'repositories/forked_popbox') %>";
+pop_box_new(htmlvalue,820,316);
+
diff --git a/app/views/repositories/forked_popbox.html.erb b/app/views/repositories/forked_popbox.html.erb
new file mode 100644
index 000000000..9ed28d5e0
--- /dev/null
+++ b/app/views/repositories/forked_popbox.html.erb
@@ -0,0 +1,7 @@
+
diff --git a/config/routes.rb b/config/routes.rb
index c2b4e92fb..05dc9be4a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -795,6 +795,7 @@ RedmineApp::Application.routes.draw do
post 'unarchive'
post 'close'
post 'reopen'
+ get 'forked_pop'
get 'search_public_orgs_not_in_project'
match 'copy', :via => [:get, :post]
match 'set_public_or_private', :via => [:post]
@@ -809,7 +810,6 @@ RedmineApp::Application.routes.draw do
match '/file', :to => 'projects#file', :as => 'file', :via => :get
match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get
match '/watcherlist', :to=>'projects#watcherlist', :as => 'watcherlist', :via => :get #add by huang
-
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
collection do
get 'autocomplete'
From 14f66e1e82ceabafbfb76d5add75fc8976e36e9f Mon Sep 17 00:00:00 2001
From: huang
Date: Tue, 8 Nov 2016 16:20:07 +0800
Subject: [PATCH 17/96] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E8=BF=94=E5=9B=9E=E4=B8=8A=E4=B8=80=E7=BA=A7=E7=9B=AE?=
=?UTF-8?q?=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/repositories/_dir_list.html.erb | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/app/views/repositories/_dir_list.html.erb b/app/views/repositories/_dir_list.html.erb
index 3c446aee0..9fe4c79b4 100644
--- a/app/views/repositories/_dir_list.html.erb
+++ b/app/views/repositories/_dir_list.html.erb
@@ -1,5 +1,18 @@