parent
fa0332babd
commit
8ec2dc3196
|
@ -117,6 +117,28 @@ module ProjectsHelper
|
||||||
end
|
end
|
||||||
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
|
# Added by young
|
||||||
def course_settings_tabs
|
def course_settings_tabs
|
||||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
||||||
|
|
|
@ -8,39 +8,26 @@
|
||||||
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
|
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
|
||||||
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
|
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
|
||||||
<% if @project.repositories.any? %>
|
<% 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" } %>
|
||||||
|
<div class="rep_history_title">历史版本库</div>
|
||||||
<table class="pro_table">
|
<table class="pro_table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="pro_table_tit">
|
<% rep_forge(@project).sort.each do |repository| %>
|
||||||
<td class=" w150"><%= l(:field_identifier) %></td>
|
|
||||||
<td class="w150"> <%= l(:field_repository_is_default) %></td>
|
|
||||||
<td class="w150"><%= l(:label_scm) %> </td>
|
|
||||||
<td class="w150" ><%= l(:label_repository_path) %> </td>
|
|
||||||
<td class="w150"> </td>
|
|
||||||
<td class="w150"> </td>
|
|
||||||
</tr>
|
|
||||||
<% @project.repositories.sort.each do |repository| %>
|
|
||||||
<tr class="<%= cycle 'pro_table_on', '' %>">
|
<tr class="<%= cycle 'pro_table_on', '' %>">
|
||||||
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
|
<td class="w150"><span class="rep_history_grey" title="<%= repository.identifier %>">
|
||||||
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a></td>
|
<%= repository.identifier %></span></td>
|
||||||
<td> <%= checked_image repository.is_default? %></td>
|
<td class="w150"><span class="rep_history_grey"><%=h repository.scm_name %></span></td>
|
||||||
<td><%=h repository.scm_name %></td>
|
|
||||||
<%if repository.scm_name=="Git"%>
|
<%if repository.scm_name=="Git"%>
|
||||||
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
|
<td class="w360" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
|
||||||
<%=h repository.url.slice(project_path_cut, repository.url.length) %>"> <%=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)%></td><!--Modified by tanxianbo-->
|
<%=h repository.url.slice(project_path_cut, repository.url.length) %>">
|
||||||
|
<span class="rep_history_grey">
|
||||||
|
<%=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) %>
|
||||||
|
</span>
|
||||||
|
</td><!--Modified by tanxianbo-->
|
||||||
<%else %>
|
<%else %>
|
||||||
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
|
<td class="w360" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td><a href="javascript:viod(0)" class="c_blue" >
|
|
||||||
<% 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 %>
|
|
||||||
</a></td>
|
|
||||||
<td>
|
|
||||||
<% if repository.login.to_s==User.current.login.to_s %>
|
|
||||||
<%= delete_new_link repository_path(repository) %>
|
|
||||||
<% end %></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -50,7 +37,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%# 新建版本库 %>
|
<%# 新建版本库 %>
|
||||||
<% if @project.repositories.count == 0 %>
|
<% if @project.repositories.count == 0 || rep_is_gitlab?(@project) %>
|
||||||
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
|
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
|
||||||
<a href="javascript:viod(0)" class="c_blue fl" onclick="pro_st_show_ku();">
|
<a href="javascript:viod(0)" class="c_blue fl" onclick="pro_st_show_ku();">
|
||||||
<% course_tag = @project.project_type %>
|
<% course_tag = @project.project_type %>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<table class="pro_table">
|
||||||
|
<tbody>
|
||||||
|
<tr class="pro_table_tit">历史版本</tr>
|
||||||
|
<tr class="pro_table_tit">
|
||||||
|
<td class=" w150"><%= l(:field_identifier) %></td>
|
||||||
|
<td class="w150"> <%= l(:field_repository_is_default) %></td>
|
||||||
|
<td class="w150"><%= l(:label_scm) %> </td>
|
||||||
|
<td class="w150" ><%= l(:label_repository_path) %> </td>
|
||||||
|
<td class="w150"> </td>
|
||||||
|
<td class="w150"> </td>
|
||||||
|
</tr>
|
||||||
|
<% rep_forge(project).sort.each do |repository| %>
|
||||||
|
<tr class="<%= cycle 'pro_table_on', '' %>">
|
||||||
|
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
|
||||||
|
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a></td>
|
||||||
|
<td> <%= checked_image repository.is_default? %></td>
|
||||||
|
<td><%=h repository.scm_name %></td>
|
||||||
|
<%if repository.scm_name=="Git"%>
|
||||||
|
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
|
||||||
|
<%=h repository.url.slice(project_path_cut, repository.url.length) %>"> <%=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)%></td><!--Modified by tanxianbo-->
|
||||||
|
<%else %>
|
||||||
|
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><a href="javascript:viod(0)" class="c_blue" >
|
||||||
|
<% 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 %>
|
||||||
|
</a></td>
|
||||||
|
<td>
|
||||||
|
<% if repository.login.to_s==User.current.login.to_s %>
|
||||||
|
<%= delete_new_link repository_path(repository) %>
|
||||||
|
<% end %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<% rep_gitlab(project).sort.each do |repository| %>
|
||||||
|
|
||||||
|
<table class="pro_table">
|
||||||
|
<tbody>
|
||||||
|
<tr class="pro_table_tit">
|
||||||
|
<td class=" w150"><%= l(:field_identifier) %></td>
|
||||||
|
<td class="w150"><%= l(:label_scm) %> </td>
|
||||||
|
<td class="w362" ><%= l(:label_repository_path) %> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="<%= cycle 'pro_table_on', '' %>">
|
||||||
|
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
|
||||||
|
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a>
|
||||||
|
</td>
|
||||||
|
<td><%=h repository.scm_name %></td>
|
||||||
|
<%if repository.scm_name=="Gitlab"%>
|
||||||
|
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="<%= rep_gitlab_url(project) %>">
|
||||||
|
<%=truncate(rep_gitlab_url(project), :length => 360) %>
|
||||||
|
</td>
|
||||||
|
<%else %>
|
||||||
|
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -133,6 +133,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
||||||
.w265{ width: 265px;}
|
.w265{ width: 265px;}
|
||||||
.w270{ width: 270px;}
|
.w270{ width: 270px;}
|
||||||
.w350 {width:350px;}
|
.w350 {width:350px;}
|
||||||
|
.w362 {width:362px;}
|
||||||
.w430{ width:470px;}
|
.w430{ width:470px;}
|
||||||
.w520{ width:520px;}
|
.w520{ width:520px;}
|
||||||
.w543{ width:543px;}
|
.w543{ width:543px;}
|
||||||
|
|
|
@ -275,4 +275,13 @@ li.commit .commit-row-info a {
|
||||||
}
|
}
|
||||||
li.commit .commit-row-info .committed_ago {
|
li.commit .commit-row-info .committed_ago {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.rep_history_title{
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #7F7F7F;
|
||||||
|
}
|
||||||
|
.rep_history_grey{
|
||||||
|
color: #7F7F7F;
|
||||||
}
|
}
|
Loading…
Reference in New Issue