From 8ec2dc3196ebda4f3ccaa12cc15ce56413f9a655 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 2 Nov 2015 13:53:35 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E5=A4=9A=E7=89=88=E6=9C=AC=E5=BA=93?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=9A=201=E3=80=81=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B9=E7=9B=AE=E6=8F=90=E4=BE=9B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=202=E3=80=81=E6=96=B0=E5=BB=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E7=89=88=E6=9C=AC=E5=BA=93=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/projects_helper.rb | 22 ++++++++++ .../settings/_new_repositories.html.erb | 43 +++++++------------ .../projects/settings/_rep_forge.html.erb | 38 ++++++++++++++++ .../projects/settings/_rep_gitlab.html.erb | 26 +++++++++++ public/stylesheets/public.css | 1 + public/stylesheets/repository.css | 9 ++++ 6 files changed, 111 insertions(+), 28 deletions(-) create mode 100644 app/views/projects/settings/_rep_forge.html.erb create mode 100644 app/views/projects/settings/_rep_gitlab.html.erb diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 41f25d1a3..c76006def 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -117,6 +117,28 @@ module ProjectsHelper end end + # 判断版本库是否为gitlab + def rep_is_gitlab?(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") + return rep.blank? ? true :false + end + + # 获取新增gitlab版本库 + def rep_gitlab(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") + end + + # 获取新项目的版本库地址 + def rep_gitlab_url(project) + gitlab_address = Redmine::Configuration['gitlab_address'] + url = gitlab_address.to_s+"/"+project.owner.to_s+"/"+project.identifier+"."+"git" + end + + # # 获取Forge历史版本库 + def rep_forge(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Git") + end + # Added by young def course_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index bfb87b16a..c6ddb9fca 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -8,39 +8,26 @@ <% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %> <% ip = RepositoriesHelper::REPO_IP_ADDRESS %> <% if @project.repositories.any? %> + <%= render :partial => 'projects/settings/rep_gitlab', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %> + <%#= render :partial => 'projects/settings/rep_forge', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %> +
历史版本库
- - - - - - - - - <% @project.repositories.sort.each do |repository| %> + <% rep_forge(@project).sort.each do |repository| %> - - - + + <%if repository.scm_name=="Git"%> - + <%else %> - + <% end %> - - <% end %> @@ -50,7 +37,7 @@ <% end %> <%# 新建版本库 %> -<% if @project.repositories.count == 0 %> +<% if @project.repositories.count == 0 || rep_is_gitlab?(@project) %> <% course_tag = @project.project_type %> diff --git a/app/views/projects/settings/_rep_forge.html.erb b/app/views/projects/settings/_rep_forge.html.erb new file mode 100644 index 000000000..e25849c38 --- /dev/null +++ b/app/views/projects/settings/_rep_forge.html.erb @@ -0,0 +1,38 @@ +
<%= l(:field_identifier) %> <%= l(:field_repository_is_default) %><%= l(:label_scm) %> <%= l(:label_repository_path) %>
- <%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %> <%= checked_image repository.is_default? %><%=h repository.scm_name %> + <%= repository.identifier %><%=h repository.scm_name %> <%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>20)%> + + <%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>60) %> + + <%=h truncate(repository.url,:length=>10) %><%=h truncate(repository.url,:length=>10) %> - <% if repository.scm_name=="Git"%> - <%if User.current.allowed_to?(:manage_repository, @project) %> - <%= link_to(l(:label_user_plural), committers_repository_path(repository)) %> - <% end %> - <% end %> - - <% if repository.login.to_s==User.current.login.to_s %> - <%= delete_new_link repository_path(repository) %> - <% end %>
+ + 历史版本 + + + + + + + + + <% rep_forge(project).sort.each do |repository| %> + + + + + <%if repository.scm_name=="Git"%> + + <%else %> + + <% end %> + + + + <% end %> + +
<%= l(:field_identifier) %> <%= l(:field_repository_is_default) %><%= l(:label_scm) %> <%= l(:label_repository_path) %>
+ <%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %> <%= checked_image repository.is_default? %><%=h repository.scm_name %> <%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>20)%><%=h truncate(repository.url,:length=>10) %> + <% if repository.scm_name=="Git"%> + <%if User.current.allowed_to?(:manage_repository, @project) %> + <%= link_to(l(:label_user_plural), committers_repository_path(repository)) %> + <% end %> + <% end %> + + <% if repository.login.to_s==User.current.login.to_s %> + <%= delete_new_link repository_path(repository) %> + <% end %>
\ No newline at end of file diff --git a/app/views/projects/settings/_rep_gitlab.html.erb b/app/views/projects/settings/_rep_gitlab.html.erb new file mode 100644 index 000000000..1de706b5d --- /dev/null +++ b/app/views/projects/settings/_rep_gitlab.html.erb @@ -0,0 +1,26 @@ +<% rep_gitlab(project).sort.each do |repository| %> + + + + + + + + + + + + + <%if repository.scm_name=="Gitlab"%> + + <%else %> + + <% end %> + +<% end %> + +
<%= l(:field_identifier) %><%= l(:label_scm) %> <%= l(:label_repository_path) %>
+ <%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %> + <%=h repository.scm_name %> + <%=truncate(rep_gitlab_url(project), :length => 360) %> + <%=h truncate(repository.url,:length=>10) %>
\ No newline at end of file diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 0be7a6ff0..ec1b2dc2a 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -133,6 +133,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w265{ width: 265px;} .w270{ width: 270px;} .w350 {width:350px;} +.w362 {width:362px;} .w430{ width:470px;} .w520{ width:520px;} .w543{ width:543px;} diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index 71cbd47b6..6ed2ae924 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -275,4 +275,13 @@ li.commit .commit-row-info a { } li.commit .commit-row-info .committed_ago { display: inline-block; +} +.rep_history_title{ + text-align: center; + font-weight: bold; + font-size: 13px; + color: #7F7F7F; +} +.rep_history_grey{ + color: #7F7F7F; } \ No newline at end of file From 1a7e1db3fb6caba0396ff098986d34f608f84adb Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 2 Nov 2015 14:20:14 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E9=BC=A0?= =?UTF-8?q?=E6=A0=87=E5=9C=A8=E7=A7=BB=E5=8A=A8=E6=97=B6=EF=BC=8C=E7=81=B0?= =?UTF-8?q?=E8=89=B2=E6=9D=A1=E8=B7=9F=E7=9D=80=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_resource.html.erb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index f6bb3c8cb..5c6339e59 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -145,6 +145,7 @@ var id; //资源id var sendType; //发送到课程 1 发送到项目 2 var lastSendType; //保存上次发送的发送类型 + var last_op $("#resources_list").mousedown(function(e) { //如果是右键的话 if (3 == e.which) { @@ -179,6 +180,28 @@ last_line = line; } }); + + //鼠标经过时,背景颜色设为灰色 + $("#resources_list").mouseover(function(e){ + pageX = e.clientX; + pageY = e.clientY; + var ele = document.elementFromPoint(pageX,pageY); + line = $(ele).parent(); + if(last_op != null){ + last_op.children().css("background-color", 'white'); + restore(); + last_op == null; + } + //如果当前的tag是li,那么还要li的父级元素 + if(line.get(0).tagName === 'LI'){ + line = line.parent(); + } + //将当前的元素的所有子元素的背景色改为蓝色 + line.children().css("background-color", '#e1e1e1'); + //将当前元素赋给 上一个对象 保存起来。 + last_op = line; + }); + //元素包含关系计算 var contains = function(root, el) { if (root.compareDocumentPosition) From eb3c65f1c621ecf0b5aacfa991e593912cce268c Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 2 Nov 2015 14:26:23 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98---=E9=A1=B9=E7=9B=AE=E5=B7=A6=E4=BE=A7=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E5=BB=BA=E7=89=88=E6=9C=AC=E5=BA=93=E5=85=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/projects_helper.rb | 2 +- app/views/projects/_development_group.html.erb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index c76006def..90ddca99f 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -117,7 +117,7 @@ module ProjectsHelper end end - # 判断版本库是否为gitlab + # 判断版本库是否初始为gitlab def rep_is_gitlab?(project) rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") return rep.blank? ? true :false diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 1770291f5..e6ba39aa3 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -43,6 +43,9 @@
<% end %> From 4abb532fd48640a304e98caf82037832ab0a4eaf Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 2 Nov 2015 14:51:56 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E6=96=B0=E6=B3=A8=E5=86=8C=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=BB=98=E8=AE=A4=E8=BA=AB=E4=BB=BD=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=20=E7=BC=96=E8=BE=91=E8=B5=84=E6=96=99=E6=97=B6?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E6=98=AF=E5=BF=85=E5=A1=AB=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 7bc674ea6..c2a94a478 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -17,7 +17,7 @@