From 7970a46469309a50615c342cfbbe7303921f632a Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 27 Oct 2015 11:41:25 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=9A=E4=BE=9D=E6=8D=AE=E5=88=86=E6=94=AF=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=90=8C=E7=9A=84=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=202=E3=80=81=E5=88=87=E6=8D=A2=E5=88=86?= =?UTF-8?q?=E6=94=AF=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=203=E3=80=81?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=98=BE=E7=A4=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BF=AE=E7=A8=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 4 +- app/views/repositories/_navigation.html.erb | 34 +++++++++-------- app/views/repositories/changes.html.erb | 3 +- app/views/repositories/show.html.erb | 41 ++++++++++++++++++--- public/stylesheets/repository.css | 3 +- 5 files changed, 60 insertions(+), 25 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index b0ad4d9c1..742a02337 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -243,7 +243,7 @@ update # :name, :path, :kind, :size, :lastrev, :changeset @entries = @repository.entries(@path, @rev) # @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 #@ip = RepositoriesHelper::REPO_IP_ADDRESS @@ -253,6 +253,8 @@ update #Modified by young # (show_error_not_found; return) unless @entries @changesets = @repository.latest_changesets(@path, @rev) + @changesets_count = @repository.latest_changesets(@path, @rev).count + @changesets_latest_coimmit = @changesets.first @properties = @repository.properties(@path, @rev) @repositories = @project.repositories @course_tag = params[:course] diff --git a/app/views/repositories/_navigation.html.erb b/app/views/repositories/_navigation.html.erb index 7140c6238..c3e154f17 100644 --- a/app/views/repositories/_navigation.html.erb +++ b/app/views/repositories/_navigation.html.erb @@ -1,29 +1,33 @@ -<% content_for :header_tags do %> - <%= javascript_include_tag 'repository_navigation' %> -<% end %> <%#= 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}, - {:method => :get, :id => 'revision_selector', :class => "fl c_grey02 ml5"}) do -%> + <% content_for :header_tags do %> + <%= javascript_include_tag 'repository_navigation' %> + <% end %> + + + + <%= 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 -%> <% if !@repository.branches.nil? && @repository.branches.length > 0 -%> <%= l(:label_branch) %>: <%= select_tag :branch, options_for_select([''] + @repository.branches, @rev), :id => 'branch' %> <% end -%> - <%# if !@repository.tags.nil? && @repository.tags.length > 0 -%> - - <%#= select_tag :tag, options_for_select([''] + @repository.tags, @rev), :id => 'tag' %> - <%# end -%> + <% if !@repository.tags.nil? && @repository.tags.length > 0 -%> + <%= select_tag :tag, options_for_select([''] + @repository.tags, @rev), :id => 'tag', :style=>" display:none" %> + <% end -%> - <%# if @repository.supports_all_revisions? %> - <%#= l(:label_revision) %> - <%#= text_field_tag 'rev', @rev, :size => 8 %> - <%# end %> + <% if @repository.supports_all_revisions? %> + <%= hidden_field_tag 'rev', @rev, :size => 8 %> + <% end %> <% end -%> +
diff --git a/app/views/repositories/changes.html.erb b/app/views/repositories/changes.html.erb index d3834bb41..f4037cb36 100644 --- a/app/views/repositories/changes.html.erb +++ b/app/views/repositories/changes.html.erb @@ -14,8 +14,7 @@ <%= render_properties(@properties) %>
-<%= render(:partial => 'revisions', - :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %> + <%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %>
<% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index eca7a3322..05293adc2 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -23,25 +23,25 @@ <% else %> <%= render :partial => 'navigation' %>
克隆网址:
- - +
ZIP
-
Fork 109
+
- 头像 - <%#= @user_chageset_recently.user %>提交于两天前:<%#= @user_chageset_recently.comments %> + <%= image_tag(url_to_avatar(@changesets_latest_coimmit.user), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> +
<%= @changesets_latest_coimmit.user %>
提交于<%= time_tag(@changesets_latest_coimmit.committed_on) %>前:
<%= @changesets_latest_coimmit.comments %>
<%= @repository.branches.count %>个分支 - <%=link_to @changesets.count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev} %>提交 + <%=link_to @changesets_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev} %>提交
<% end %> @@ -57,6 +57,35 @@ <%= render_properties(@properties) %> +<%= render_properties(@properties) %> + +<% if authorize_for('repositories', 'revisions') %> + <% if @changesets && !@changesets.empty? %> +

<%= l(:label_latest_revision_plural) %>

+ <%= render :partial => 'revisions', + :locals => {:project => @project, :path => @path, + :revisions => @changesets, :entry => nil }%> + <% end %> +

+ <% 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 %> +

+<% end %> <% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index ba3a419bf..3b8027d74 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -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_branch {background:url(../images/vlicon/branch_icon.png) 0px -2px no-repeat; padding-left:22px} .mt1 {margin-top:1px;} -.mt2 {margin-top:2px;} \ No newline at end of file +.mt2 {margin-top:2px;} +.commit_content_dec{width: 300px;overflow: hidden; white-space: nowrap;text-overflow: ellipsis;}