From 0158fe023df822e8e92cca4dd4023752282d61d9 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 29 Oct 2015 15:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=9C=80=E8=BF=91?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E6=8F=90=E4=BA=A4=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=20val?= =?UTF-8?q?idate=E7=B1=BB=E5=9E=8B=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 6 +++--- app/views/repositories/_revisions.html.erb | 22 ++-------------------- app/views/repositories/show.html.erb | 8 ++++---- lib/trustie/gitlab/sync.rb | 2 +- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 6497297ea..72314cad9 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -253,11 +253,11 @@ update #Modified by young # (show_error_not_found; return) unless @entries g = Gitlab.client - p = g.project(@project.gpid) - @changesets = g.get ("/projects/#{p}/repository/commits") + @changesets = g.get ("/projects/#{@project.gpid}/repository/commits") # @changesets = @repository.latest_changesets(@path, @rev) + # @changesets_count = @repository.latest_changesets(@path, @rev).count @changesets_count = @changesets.count - @changesets_latest_coimmit = @changesets.first + @changesets_latest_coimmit = @changesets[0] @properties = @repository.properties(@path, @rev) @repositories = @project.repositories @course_tag = params[:course] diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index 891952559..3da718484 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -1,19 +1,4 @@ -<% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %> -<%= if show_revision_graph && revisions && revisions.any? - indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid| - url_for( - :controller => 'repositories', - :action => 'revision', - :id => project, - :repository_id => @repository.identifier_param, - :rev => scmid) - end - render :partial => 'revision_graph', - :locals => { - :commits => indexed_commits, - :space => graph_space - } - end %> + <%= form_tag( {:controller => 'repositories', :action => 'diff', :id => project, :repository_id => @repository.identifier_param, :path => to_path_param(path)}, @@ -33,10 +18,7 @@ <% line_num = 1 %> <% revisions.each do |changeset| %> - <% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %> - <%= content_tag(:td, :class => 'id', :style => id_style) do %> - <%= link_to_revision(changeset, @repository) %> - <% end %> + <%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %> <%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %> <%= format_time(changeset.committed_on) %> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index a1dd44cb7..132d915f2 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -30,10 +30,10 @@
<% if @changesets && !@changesets.empty? %> - <%= image_tag(url_to_avatar(@changesets_latest_coimmit.user), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> -
<%=link_to @changesets_latest_coimmit.user, user_path(@changesets_latest_coimmit.user) %>
-
提交于<%= time_tag(@changesets_latest_coimmit.committed_on) %>:
-
<%= @changesets_latest_coimmit.comments %>
+ <%= image_tag(url_to_avatar(@changesets_latest_coimmit.author_name), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> +
<%=link_to @changesets_latest_coimmit.author_name, user_path(@changesets_latest_coimmit.author_name) %>
+
提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
+
<%= @changesets_latest_coimmit.message %>
<% end %> diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index fd04f354d..ae1cded6c 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -22,7 +22,7 @@ module Trustie def sync_user(user) u = add_user(user) - if user.mail_notification.blank? or user.mail_notification == "only_assigned" or user.mail_notification == "only_my_events" + if (!("day,none,all".include? user.mail_notification) or user.mail_notification.blank?) user.mail_notification = "day" end user.save!