Merge branch 'dev_newproject' of https://git.trustie.net/jacknudt/trustieforge into dev_newproject

This commit is contained in:
daiao 2016-11-08 16:19:23 +08:00
commit 27c8d53cad
13 changed files with 114 additions and 77 deletions

View File

@ -40,7 +40,7 @@ class RepositoriesController < ApplicationController
# before_filter :connect_gitlab, :only => [:quality_analysis, :commit_diff]
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :project_archive, :quality_analysis]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :project_archive, :quality_analysis, :commit_diff]
# 版本库新增权限
# before_filter :show_rep, :only => [:show, :stats, :revisions, :revision, :diff, :commit_diff ]
accept_rss_auth :revisions
@ -480,8 +480,14 @@ update
end
def entry
# 顶部导航
@project_menu_type = 5
entry_and_raw(false)
@content = @repository.cat(@path, @rev)
@changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev))
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
if is_entry_text_data?(@content, @path)
render :layout => 'base_projects'
end

View File

@ -1,13 +1,36 @@
<div class="git_usr_title">
<%=link_to @project.owner, user_path(@project.owner), :class => "repository-title-dec" %>
/
<span><%= link_to @repository.identifier.present? ? h(@repository.identifier) : 'root',
{:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev },
:class => "repository-title-dec"
%>
</span>
</div>
<% unless @path.blank? %>
<%= link_to "#{@repository.identifier.present? ? h(@repository.identifier) : 'root'}", ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "c_blue f14 fb" %>
<%#= link_to(@repository.identifier.present? ? h(@repository.identifier) : 'root',
:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev)
%>
<%
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}"
%>
<span class="c_grey">/</span> <%= link_to h(dir), {:action => 'show', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param(link_path), :rev => @rev}, :class => "f14 fb" %>
<% end %>
<% if filename %>
<span class="c_grey">/</span> <%= link_to h(filename),
{:action => 'changes', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param("#{link_path}/#{filename}"), :rev => @rev}, :class => "f14 fb" %>
<% 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)
%>
<%#= "@ #{h rev_text}" unless rev_text.blank? %>
<% end %>
<% html_title(with_leading_slash(path)) -%>

View File

@ -0,0 +1,25 @@
<div class="recordBanner mt3">
<% if @changesets_latest_coimmit %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150 ml5"><%=link_to get_user_by_mail(@changesets_latest_coimmit.author_email).show_name, user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
<div class="fl">提交于 <%= time_tag(@changesets_latest_coimmit.created_at) %> 前:</div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<% else %>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150 ml5"><%= @changesets_latest_coimmit.author_email %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<%end%>
<% end %>
<% if @entry && @entry.kind == 'file' %>
<%= render :partial => 'link_to_functions' %>
<% else %>
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2"><%= @repository.branches.count %></font> 个分支</span>
<% end %>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)} 提交", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
</span>
</div>

View File

@ -1,10 +1,8 @@
<% if @entry && @entry.kind == 'file' %>
<p class="mt5 mb5">
<%= 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 }, :class =>"fr mr5"%>
<%# 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 }, :class =>"fr" %>
<%# 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 %>
@ -12,8 +10,6 @@
{:action => 'raw', :id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => @rev}) if @repository.supports_cat? %>
:rev => @rev}, :class => "fr mr5") if @repository.supports_cat? %>
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
</p>
<% end %>

View File

@ -0,0 +1,5 @@
<div class="fl"><h2 class="project_h2_repository">
<div class="git_usr_title">
<%=link_to @project.owner, user_path(@project.owner), :class => "repository-title-dec" %> / <%= link_to @project.name, project_path(@project), :class => "repository-title-dec" %>
</div></h2>
</div>

View File

@ -1,26 +1,26 @@
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<div class="wrap-big">
<div class="project_r_h">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
</div>
<div class="project_r_h">
<%= render :partial => "top" %>
</div>
<div class="repository_con " style="line-height:1.9;">
<%= render :partial => 'navigation' %>
<div class="cl"></div>
</div>
<%= render :partial => 'link_to_functions' %>
<%= render_properties(@properties) %>
<div class="mt10">
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path , :revisions => @commits, :entry => @entry , :commits_pages => @commits_pages , :commits_count => @commits_count}) unless @commits.empty? %>
</div>
<div class="repository_con " style="line-height:1.9;">
<%= render :partial => 'navigation' %>
<div class="cl"></div>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>
<%#= render :partial => 'link_to_functions' %>
<% html_title(l(:label_change_plural)) -%>
<%= render_properties(@properties) %>
<div class="mt10">
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path , :revisions => @commits, :entry => @entry , :commits_pages => @commits_pages , :commits_count => @commits_count}) unless @commits.empty? %>
</div>
<div class="cl"></div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>
<% html_title(l(:label_change_plural)) -%>
</div>

View File

@ -1,6 +1,6 @@
<div class="container-big">
<div class="project_r_h" style="width:970px;">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
<div class="project_r_h">
<%= render :partial => "top" %>
</div>
<!--<script>-->
<!--// $(document).ready(function(){-->

View File

@ -1,14 +1,15 @@
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<div class="wrap-big">
<div style="padding-left: 8px;">
<div class="contextual">
<div class="contextual mt-5 mb5">
<%= render :partial => 'navigation' %>
</div>
<h3><%= l(:label_revision_path) %> <%= @path %></h3>
<%= render :partial => 'link_to_functions' %>
<!--目录跳转-->
<div class="fl mt3">
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
</div>
<div class="cl"></div>
<%= render :partial => 'latest_commit' %>
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
<% content_for :header_tags do %>

View File

@ -1,7 +1,7 @@
<%#= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
<div class="wrap-big">
<div class="project_r_h">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
<%= render :partial => "top" %>
</div>
<div class="repository_con" style="line-height:1.9;">
<% if @entries.nil? %>
@ -43,30 +43,13 @@
<%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %>
</div>
<div class="cl"></div>
<div class="recordBanner mt10">
<% if @changesets_latest_coimmit %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=link_to get_user_by_mail(@changesets_latest_coimmit.author_email).show_name, user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
<div class="fl">提交于 <%= time_tag(@changesets_latest_coimmit.created_at) %> 前:</div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<% else %>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%= @changesets_latest_coimmit.author_email %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<%end%>
<% end %>
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2">
<%= @repository.branches.count %></font> 个分支
</span>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)} 提交", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
</span>
<!--目录跳转-->
<div class="mt3">
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
</div>
<div class="cl"></div>
<%= render :partial => 'latest_commit' %>
<div class="cl"></div>
<% end %>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>

View File

@ -183,6 +183,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.mt-20 {margin-top:-20px;}
.mt-10 {margin-top:-10px;}
.mt-4 {margin-top:-4px;}
.mt-5 {margin-top:-5px;}
.mt-2 {margin-top:-2px;}
.mt0 {margin-top: 0px !important;}
.mt1{margin-top: 1px;}

View File

@ -216,9 +216,6 @@ p.percent {
float: right;
white-space: nowrap;
line-height: 1.4em;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
font-size: 0.9em;
}

View File

@ -211,7 +211,7 @@
.clone_btn {width:30px; height:21px; border-top:1px solid #dddddd; border-bottom:1px solid #dddddd; border-right:1px solid #dddddd; outline:none; float:left; background-image:linear-gradient(#FCFCFC, #EEE); text-align:center;}
.vl_btn {height:21px; padding:0px 5px; vertical-align:middle; border:1px solid #dddddd; float:left; line-height:21px; background-image:linear-gradient(#FCFCFC, #EEE);}
.vl_btn_2 {height:21px; padding:0px 5px; vertical-align:middle; border-top:1px solid #dddddd; border-bottom:1px solid #dddddd; border-right:1px solid #dddddd; float:left; line-height:21px;}
.recordBanner {width:100%; height:30px; background-color:#f1f1f1; color:#666666; line-height:30px; vertical-align:middle;}
.recordBanner {width:99%; height:30px; background-color:#f1f1f1; color:#666666; line-height:30px; vertical-align:middle;}
.vl_copy {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;}
.vl_copy2 {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;}
.vl_zip {background:url(../images/vlicon/graph.png) 0px 2px no-repeat; padding-left:22px;}

View File

@ -34,7 +34,7 @@ li.change .copied-from:before { content: " - "}
#changes-legend { float: right; font-size: 0.8em; margin:0; margin-right: 10px; }/*by young*/
#changes-legend li { float: left; background-position: 5px 0; }
table.filecontent { border: 1px solid #e2e2e2; border-collapse: collapse; width:98%; background-color: #fafafa; }
table.filecontent { border: 1px solid #e2e2e2; border-collapse: collapse; width:99%; background-color: #fafafa; }
table.filecontent tbody {font-family:"Liberation Mono", Courier, monospace; font-size:12px;}
table.filecontent th { border: 1px solid #e2e2e2; background-color: #eee; }
table.filecontent th.filename { background-color: #e4e4d4; text-align: left; padding:5px;}