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) @properties = @repository.properties(@path, @rev)
@repositories = @project.repositories @repositories = @project.repositories
@course_tag = params[:course] @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 if @course_tag == 1
render :action => 'show', :layout => 'base_courses' render :action => 'show', :layout => 'base_courses'
else else

View File

@ -3,30 +3,36 @@
<div class="contextual" style="padding-right: 10px;"> <div class="contextual" style="padding-right: 10px;">
<%= render :partial => 'navigation' %> <%= render :partial => 'navigation' %>
</div> </div>
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by young For formatting project's path-->
<h3> <h3>
<%= render :partial => 'breadcrumbs', <%= render :partial => 'breadcrumbs',
:locals => { :path => @path, :kind => 'dir', :revision => @rev } %> :locals => { :path => @path, :kind => 'dir', :revision => @rev } %>
<div style="font-size:11px;"> <div style="font-size:11px;">
<%if @repository.type.to_s=="Repository::Git"%> <%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 %> <%else %>
<td><%=h @repository.url %></td> <td><%=h @repository.url %></td>
<% end %> <% end %>
</div> </div>
<% if @repositories.size > 1 %> <% if @repositories.size >1 %>
<p style=" word-wrap: break-word; word-break: break-all"> <p style=" word-wrap: break-word; word-break: break-all">
(<%= l(:label_all_revisions) %><%= @repositories.sort.collect {|repo| (<%= l(:label_all_revisions) %><%= @repositories.sort.collect {|repo|
link_to h(repo.name), link_to h(repo.name),
{:controller => 'repositories', :action => 'show', {:controller => 'repositories', :action => 'show',
:id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil}, :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (repo == @repository ? ' selected' : '') :class => 'repository' + (repo == @repository ? ' selected' : '')
}.join('&nbsp|&nbsp').html_safe %>)</p> }.join('&nbsp|&nbsp').html_safe %>)</p>
<% end %> <% end %>
</h3> </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') %> <% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %> <%= render :partial => 'dir_list' %>
<% end %> <% end %>

View File

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

View File

@ -2659,3 +2659,16 @@ h2 img { vertical-align:middle; }
text-decoration: none; text-decoration: none;
cursor: pointer; 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);