imitate github show help doucument

This commit is contained in:
xianbo 2013-12-10 20:18:21 +08:00
parent 4f6cd0800a
commit 0f93065ac4
4 changed files with 31 additions and 8 deletions

View File

@ -238,6 +238,10 @@ class RepositoriesController < ApplicationController
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@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+
@repository.url.slice(project_path_cut, @repository.url.length).to_s
if @course_tag == 1
render :action => 'show', :layout => 'base_courses'
else

View File

@ -3,30 +3,36 @@
<div class="contextual" style="padding-right: 10px;">
<%= render :partial => 'navigation' %>
</div>
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by young For formatting project's path-->
<h3>
<%= render :partial => 'breadcrumbs',
:locals => { :path => @path, :kind => 'dir', :revision => @rev } %>
<div style="font-size:11px;">
<%if @repository.type.to_s=="Repository::Git"%>
<td>http://<%= @repository.login.to_s %>_<%= @repository.identifier.to_s%>@<%= ip %><%=h @repository.url.slice(project_path_cut, @repository.url.length) %></td><!--Modified by tanxianbo-->
<%= @repos_url%>
<%else %>
<td><%=h @repository.url %></td>
<% end %>
</div>
<% if @repositories.size > 1 %>
<% if @repositories.size >1 %>
<p style=" word-wrap: break-word; word-break: break-all">
(<%= 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' : '')
}.join('&nbsp|&nbsp').html_safe %>)</p>
}.join('&nbsp|&nbsp').html_safe %>)</p>
<% end %>
</h3>
<% if @repository.branches.empty?%>
<h3>进入到需要建立版本库文件夹,打开命令行执行如下</h3>
<div class="repos_explain">
<p>git init</p>
<p>git add *</p>
<p>git commit -m "first commit"</p>
<p>git remote add origin <%= @repos_url%></p>
<p>git push -u origin master</p>
</div>
<% end %>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>
<% end %>

View File

@ -15,7 +15,7 @@ production:
development:
adapter: mysql2
database: trustie
database: test
host: 10.107.17.20
#socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock
port: 3306

View File

@ -2659,3 +2659,16 @@ h2 img { vertical-align:middle; }
text-decoration: none;
cursor: pointer;
}
/*tanxianbo*/
div.repos_explain{
word-wrap: normal;
line-height: 8px;
font-size: 13px;
background-color: #f8f8f8;
border: 1px solid #ddd;
overflow: auto;
border-radius: 3px;
padding: 6px 10px;
font-family: Consolas, 'Liberation Mono', Courier, monospace;
color: rgb(51, 51, 51);