1、添加功能:依据分支切换显示不同的提交记录

2、切换分支刷新页面
3、版本库显示页面修稿
This commit is contained in:
huang 2015-10-27 11:41:25 +08:00
parent 34a8d0890c
commit 7970a46469
5 changed files with 60 additions and 25 deletions

View File

@ -243,7 +243,7 @@ update
# :name, :path, :kind, :size, :lastrev, :changeset # :name, :path, :kind, :size, :lastrev, :changeset
@entries = @repository.entries(@path, @rev) @entries = @repository.entries(@path, @rev)
# @trees = g.trees(project, @path) # @trees = g.trees(project, @path)
# @changeset = @repository.find_changeset_by_name(@rev) @changeset = @repository.find_changeset_by_name(@rev)
#@project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT #@project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
#@ip = RepositoriesHelper::REPO_IP_ADDRESS #@ip = RepositoriesHelper::REPO_IP_ADDRESS
@ -253,6 +253,8 @@ update
#Modified by young #Modified by young
# (show_error_not_found; return) unless @entries # (show_error_not_found; return) unless @entries
@changesets = @repository.latest_changesets(@path, @rev) @changesets = @repository.latest_changesets(@path, @rev)
@changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_latest_coimmit = @changesets.first
@properties = @repository.properties(@path, @rev) @properties = @repository.properties(@path, @rev)
@repositories = @project.repositories @repositories = @project.repositories
@course_tag = params[:course] @course_tag = params[:course]

View File

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

View File

@ -14,8 +14,7 @@
<%= render_properties(@properties) %> <%= render_properties(@properties) %>
<div class="mt10"> <div class="mt10">
<%= render(:partial => 'revisions', <%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %>
:locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %>
</div> </div>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %> <%= stylesheet_link_tag "scm" %>

View File

@ -23,25 +23,25 @@
<% else %> <% else %>
<%= render :partial => 'navigation' %> <%= render :partial => 'navigation' %>
<div class="fl c_grey02 mt5 mr5">克隆网址:</div> <div class="fl c_grey02 mt5 mr5">克隆网址:</div>
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" placeholder="http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git"> <textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" placeholder="" >
<% if @repository.type.to_s=="Repository::Gitlab" %> <% if @repository.type.to_s=="Repository::Gitlab" %>
<%= @repos_url %> <%= @repos_url %>
<% else %> <% else %>
<%= h @repository.url %> <%= h @repository.url %>
<% end %> <% end %>
</textarea> </textarea>
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy"></span></a> <a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb"><span class="vl_zip"></span>ZIP</a> </div> <div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb"><span class="vl_zip"></span>ZIP</a> </div>
<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb"><span class="vl_fork"></span>Fork</a> <a href="javascript:void(0);" class="vl_btn_2 fb">109</a> </div> <!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb"><span class="vl_fork"></span>Fork</a> <a href="javascript:void(0);" class="vl_btn_2 fb">109</a> </div>-->
<div class="cl"></div> <div class="cl"></div>
<div class="recordBanner mt10"> <div class="recordBanner mt10">
<img src="images/newsPortrait.png" width="25" height="25" alt="头像" class="fl portraitRadius mt2 ml4 mr5" /> <%= image_tag(url_to_avatar(@changesets_latest_coimmit.user), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><font class="fb fontGrey3 mr5"><%#= @user_chageset_recently.user %></font>提交于两天前:<%#= @user_chageset_recently.comments %></span> <span class="fl"><div class="fb fontGrey3 mr5 fl"><%= @changesets_latest_coimmit.user %></div><div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.committed_on) %>前:</div><div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.comments %></div></span>
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2"> <span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2">
<%= @repository.branches.count %></font>个分支 <%= @repository.branches.count %></font>个分支
</span> </span>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit"> <span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to @changesets.count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev} %></font>提交 <%=link_to @changesets_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev} %></font>提交
</span> </span>
</div> </div>
<% end %> <% end %>
@ -57,6 +57,35 @@
<%= render_properties(@properties) %> <%= render_properties(@properties) %>
<!-- 代码修订 --> <!-- 代码修订 -->
<%= 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>
<% 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 %>
<% 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 %>
<% end %>
</p>
<% end %>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %> <%= stylesheet_link_tag "scm" %>

View File

@ -217,4 +217,5 @@
.vl_commit {background:url(../images/vlicon/commit_icon.png) 0px -2px no-repeat; padding-left:22px;weight:20px;height: 24px;} .vl_commit {background:url(../images/vlicon/commit_icon.png) 0px -2px no-repeat; padding-left:22px;weight:20px;height: 24px;}
.vl_branch {background:url(../images/vlicon/branch_icon.png) 0px -2px no-repeat; padding-left:22px} .vl_branch {background:url(../images/vlicon/branch_icon.png) 0px -2px no-repeat; padding-left:22px}
.mt1 {margin-top:1px;} .mt1 {margin-top:1px;}
.mt2 {margin-top:2px;} .mt2 {margin-top:2px;}
.commit_content_dec{width: 300px;overflow: hidden; white-space: nowrap;text-overflow: ellipsis;}