版本库summary

文件目录
新版本库地址
按分支显示提交记录
相关界面
This commit is contained in:
huang 2015-10-22 13:44:35 +08:00
parent 147cdf3018
commit 1157dcaa06
13 changed files with 152 additions and 1831 deletions

View File

@ -283,7 +283,6 @@ update
@entries = @repository.entries(@path, @rev)
#@entries = g.trees(project.id, @path)
@changeset = @repository.find_changeset_by_name(@rev)
#@project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
#@ip = RepositoriesHelper::REPO_IP_ADDRESS
@ -298,8 +297,13 @@ update
@course_tag = params[:course]
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
ip = RepositoriesHelper::REPO_IP_ADDRESS
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+
@repository.url.slice(project_path_cut, @repository.url.length).to_s
gitlab_address = RepositoriesHelper::REPO_GITLAB_ADDRESS
if @repository.type.to_s=="Repository::Gitlab"
@repos_url = "http://"+gitlab_address.to_s+"/"+repository_creater(@repository).lastname.to_s+"/"+@repository.identifier+"."+"git"
else
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+
@repository.url.slice(project_path_cut, @repository.url.length).to_s
end
if @course_tag == 1
render :action => 'show', :layout => 'base_courses'
else

View File

@ -25,6 +25,7 @@ module RepositoriesHelper
end
PROJECT_PATH_CUT = 40
REPO_IP_ADDRESS = Setting.host_repository
REPO_GITLAB_ADDRESS = "git.trustie.net"
def format_revision(revision)
if revision.respond_to? :format_identifier
@ -34,6 +35,10 @@ module RepositoriesHelper
end
end
def repository_creater rep
repository_creater = User.find_by_login(rep.login) unless rep.login.nil?
end
def truncate_at_line_break(text, length = 255)
if text
text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...')

View File

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header' %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

View File

@ -1,32 +1,12 @@
<%= link_to @repository.identifier.present? ? h(@repository.identifier) : 'root',
{:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev },
:class=>"fl c_blue f14 fb" %>
<%
dirs = path.split('/')
if 'file' == kind
filename = dirs.pop
end
link_path = ''
dirs.each do |dir|
next if dir.blank?
link_path << '/' unless link_path.empty?
link_path << "#{dir}"
%>
/ <%= link_to h(dir), :action => 'show', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param(link_path), :rev => @rev %>
<% end %>
<% if filename %>
/ <%= link_to h(filename),
:action => 'changes', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param("#{link_path}/#{filename}"), :rev => @rev %>
<% end %>
<%
# @rev is revsion or Git and Mercurial branch or tag.
# For Mercurial *tip*, @rev and @changeset are nil.
rev_text = @changeset.nil? ? @rev : format_revision(@changeset)
%>
<p class="fl f14 fb c_grey02"><%= "@ #{h rev_text}" unless rev_text.blank? %></p>
<div class="git_usr_title">
<span><%= link_to @repository.identifier.present? ? h(@repository.identifier) : 'root',
{:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev }
%>
/
<%=link_to repository_creater(@repository).show_name, user_path(repository_creater(@repository)) %>
</span>
</div>
<% html_title(with_leading_slash(path)) -%>

View File

@ -7,6 +7,7 @@
<td style="padding-left: <%=18 * depth%>px;" class="<%=
@repository.report_last_commit ? "filename" : "filename_no_report" %>">
<% if entry.is_dir? %>
<%# 展开文件目录 %>
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
:action => 'show',
:id => @project,
@ -17,10 +18,11 @@
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'changes'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<% if @repository.report_last_commit %>
<td class="revision"><%= link_to_revision(entry.changeset, @repository) if entry.changeset %></td>
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>

View File

@ -1,10 +1,10 @@
<% if @entry && @entry.kind == 'file' %>
<p class="mt13 mb13">
<%= link_to_if action_name != 'changes', l(:label_history), {:action => 'changes', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |
<% if @repository.supports_cat? %>
<%= link_to_if action_name != 'entry', l(:button_view), {:action => 'entry', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |
<% end %>
<%= link_to_if action_name != 'changes', l(:label_history), {:action => 'changes', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %>
<%# if @repository.supports_cat? %>
<%#= link_to_if action_name != 'entry', l(:button_view), {:action => 'entry', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |
<%# end %>
<% if @repository.supports_annotate? %>
<%= link_to_if action_name != 'annotate', l(:button_annotate), {:action => 'annotate', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |
<% end %>

View File

@ -1,34 +1,30 @@
<% content_for :header_tags do %>
<%= javascript_include_tag 'repository_navigation' %>
<% end %>
<a href="javascript:void(0);" class="pic_stats fl ml20 mt3"></a>
<%= link_to l(:label_statistics),
<!--<a href="javascript:void(0);" class="pic_stats fl ml20 mt3"></a>-->
<%#= link_to l(:label_statistics),
{:action => 'stats', :id => @project, :repository_id => @repository.identifier_param},
:class => 'mt3 c_blue fl' if @repository.supports_all_revisions? %>
<%= form_tag({:action => controller.action_name,
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => nil},
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => nil},
{:method => :get, :id => 'revision_selector', :class => "fl c_grey02 ml5"}) do -%>
<!-- Branches Dropdown -->
<% if !@repository.branches.nil? && @repository.branches.length > 0 -%>
| <%= l(:label_branch) %>:
<%= select_tag :branch,
options_for_select([''] + @repository.branches, @rev),
:id => 'branch' %>
<%= l(:label_branch) %>:
<%= select_tag :branch, options_for_select([''] + @repository.branches, @rev), :id => 'branch' %>
<% end -%>
<% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
| <%= l(:label_tag) %>:
<%= select_tag :tag,
options_for_select([''] + @repository.tags, @rev),
:id => 'tag' %>
<%= select_tag :tag, options_for_select([''] + @repository.tags, @rev), :id => 'tag' %>
<% end -%>
<% if @repository.supports_all_revisions? %>
| <%= l(:label_revision) %>:
<%= text_field_tag 'rev', @rev, :size => 8 %>
<% end %>
<%# if @repository.supports_all_revisions? %>
| <%#= l(:label_revision) %>:
<%#= text_field_tag 'rev', @rev, :size => 8 %>
<%# end %>
<% end -%>

View File

@ -0,0 +1,37 @@
<div class="overall-summary overall-summary-bottomless">
<div class="stats-switcher-viewport js-stats-switcher-viewport">
<div class="stats-switcher-wrapper">
<ul class="numbers-summary">
<li class="commits">
<a data-pjax="" href="/redmine/redmine/commits/0.6-stable">
<span class="octicon octicon-history"></span>
<span class="num text-emphasized">
<%=link_to @changesets.count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev}, :class => "num text-emphasized" %>
</span>
commits
</a>
</li>
<li>
<span class="octicon image-type"></span>
<span class="num text-emphasized">
<%= @repository.branches.count %>
</span>
branches
</li>
<li>
<span class="octicon octicon-organization"></span>
<span class="num text-emphasized">
<%=link_to @repository.committers.count, committers_repository_path(@repository) %>
</span>
contributors
</li>
</ul>
</div>
</div>
</div>

View File

@ -4,76 +4,35 @@
</div>
<div class="repository_con" style="line-height:1.9;">
<div class="repositorytitle" style="float:left;">
<%= render :partial => 'breadcrumbs',
:locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
<%= render :partial => 'navigation' %>
</div>
<!--contextual end-->
<div class="cl"></div>
<div class=" c_dark f14">
<p>
<% if @repository.type.to_s=="Repository::Git" %>
<% if @repository.type.to_s=="Repository::Gitlab" %>
<%= @repos_url %>
<% else %>
<%= h @repository.url %>
<% end %>
</p>
<p class="mb10 break_word">
(<%= l(:label_all_revisions) %><%= @repositories.sort.collect { |repo|
link_to h(repo.name),
{:controller => 'repositories', :action => 'show',
:id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (repo == @repository ? ' selected' : ''),
:class => "mb10 break_word c_orange" }.join('&nbsp|&nbsp').html_safe %>)
</p>
</div>
</div>
<%# 各类信息入口 %>
<% if !@repository.nil? %>
<%= render :partial => 'summary' %>
<% end %>
<%# end %>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>
<% end %>
<%= render_properties(@properties) %>
<!-- 代码修订 -->
<% if authorize_for('repositories', 'revisions') %>
<%# if @changesets && !@changesets.empty? %>
<h3>
<%= l(:label_latest_revision_plural) %>
</h3>
<%= render :partial => 'revisions',
:locals => {:project => @project, :path => @path,
:revisions => @changesets, :entry => nil} %>
<%# end %>
<p style="padding-top: 10px;">
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
sep = '' %>
<% if @repository.supports_all_revisions? && @path.blank? %>
<%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param},
:class => "orange_u_btn" %>
<% sep = '|' %>
<% end %>
<% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %>
<%= sep %>
<%= link_to l(:label_view_revisions),
{:action => 'changes',
:path => to_path_param(@path),
:id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev},
:class => "orange_u_btn" %>
<% end %>
</p>
<% if @repository.supports_all_revisions? %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(
:atom, params.merge(
{:format => 'atom', :action => 'revisions',
:id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
<% end %>
<% end %>
<!-- added by bai -->
<p class="fb mt10"><a href="http://<%=Setting.host_name %>/forums/1/memos/1232" class=" c_blue ">点击查看如何提交代码</a></p>

View File

@ -481,6 +481,7 @@ en:
label_attribute_plural: Attributes
label_change_status: Change status
label_history: History
label_commit_history: Commit History
label_attachment: Files
label_attachment_delete: Delete file

View File

@ -580,6 +580,7 @@ zh:
label_change_status: 变更状态
label_history: 历史记录
label_commit_history: 历史变更记录
label_attachment: 文件
label_file_upload: 上传资料
@ -924,7 +925,7 @@ zh:
button_change_password: 修改密码
button_copy: 复制
button_copy_and_follow: 复制并转到新问题
button_annotate: 追溯
button_annotate: 代码定位
button_configure: 配置
button_quote: 引用

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
.git_usr_title{
margin: 0px;
overflow: hidden;
font-size: 18px;
font-weight: bold;
color: #444;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
}
.overall-summary{
position: relative;
margin-bottom: 10px;
border: 1px solid #DDD;
border-radius: 3px;
}
.overall-summary .overall-summary-bottomless{
margin-bottom: 0px;
border-bottom: 0px none;
border-radius: 3px 3px 0px 0px;
}
.stats-switcher-viewport{
height: 38px;
overflow: hidden;
}
.stats-switcher-viewport .stats-switcher-wrapper{
position: relative;
top: 0px;
transition: top 0.25s ease-in-out 0s;
}
.numbers-summary{
display: table;
width: 100%;
table-layout: fixed;
}
.numbers-summary li{
display: table-cell;
padding: 0px;
margin: 0px;
text-align: center;
white-space: nowrap;
}
.numbers-summary .octicon {
color: #999;
}
.text-emphasized {
font-weight: bold;
color: #333;
}
.octicon .octicon-history {
font: 16px/1 octicons;
display: inline-block;
text-decoration: none;
text-rendering: auto;
-moz-user-select: none;
}