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