From bf06a6cafd8de3b55875404d658e60340a61e4f0 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 29 Oct 2015 12:33:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98=EF=BC=88=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5validate=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/gitlab.rake | 2 +- lib/trustie/gitlab/sync.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/tasks/gitlab.rake b/lib/tasks/gitlab.rake index ffa81e912..729c9245f 100644 --- a/lib/tasks/gitlab.rake +++ b/lib/tasks/gitlab.rake @@ -7,7 +7,7 @@ namespace :gitlab do # User.where(username: 'root').find_each do |user| s = Trustie::Gitlab::Sync.new User.find_each do |user| - s.sync_user(user) + s.sync_user(user) end end diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index d941795ee..fd04f354d 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -22,7 +22,10 @@ module Trustie def sync_user(user) u = add_user(user) - user.save! if u + if user.mail_notification.blank? or user.mail_notification == "only_assigned" or user.mail_notification == "only_my_events" + user.mail_notification = "day" + end + user.save! end def sync_project(project, opt={}) From df8d2f8dd4accab180f0ba51395179109405e34f Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 29 Oct 2015 14:20:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?gitlab=E8=B0=83=E7=94=A8commits=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 7 +++++-- config/locales/projects/zh.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 742a02337..6497297ea 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -252,8 +252,11 @@ update else #Modified by young # (show_error_not_found; return) unless @entries - @changesets = @repository.latest_changesets(@path, @rev) - @changesets_count = @repository.latest_changesets(@path, @rev).count + g = Gitlab.client + p = g.project(@project.gpid) + @changesets = g.get ("/projects/#{p}/repository/commits") + # @changesets = @repository.latest_changesets(@path, @rev) + @changesets_count = @changesets.count @changesets_latest_coimmit = @changesets.first @properties = @repository.properties(@path, @rev) @repositories = @project.repositories diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index bd31c4d79..cce03b13e 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -375,7 +375,7 @@ zh: # label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。' field_name: 名称 - field_identifier: 标识 + field_identifier: 版本库名 field_enterprise_name: 组织名称 label_organization_choose: --请选择组织-- text_length_between: "长度必须在 %{min} 到 %{max} 个字符之间。" From 0158fe023df822e8e92cca4dd4023752282d61d9 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 29 Oct 2015 15:56:41 +0800 Subject: [PATCH 3/5] =?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! From 070166e7c7e0b7cce7d2fd8eb28b787231060288 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 29 Oct 2015 17:26:37 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E7=82=B9=E5=87=BB=E9=80=80=E5=87=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E6=89=A7=E8=A1=8C=E6=93=8D=E4=BD=9C=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=88=B7=E6=96=B0=E5=BD=93=E5=89=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E9=80=80=E5=87=BA=E5=8F=98=E6=88=90=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_set_join.js.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index 33caf5273..dbdf3d7f3 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -23,4 +23,6 @@ <% else %> alert("未知错误,请稍后再试"); <% end %> +<% else %> + location.reload(); <% end %> From 57f37acecc449522542e156bfbdec5a9b6026d27 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 29 Oct 2015 17:28:23 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=83=85=E5=86=B5?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=20=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 4 ++- app/views/repositories/_revisions.html.erb | 30 +++++++++++----------- app/views/repositories/show.html.erb | 10 +------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 72314cad9..f41dbe6c7 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -283,7 +283,9 @@ update def changes @entry = @repository.entry(@path, @rev) (show_error_not_found; return) unless @entry - @changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i) + g = Gitlab.client + @changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}") + #@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i) @properties = @repository.properties(@path, @rev) @changeset = @repository.find_changeset_by_name(@rev) render :layout => 'base_projects' diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index 3da718484..fe60f8933 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -1,35 +1,35 @@ - <%= form_tag( {:controller => 'repositories', :action => 'diff', :id => project, :repository_id => @repository.identifier_param, :path => to_path_param(path)}, :method => :get ) do %> - - - - - - - - + + + + + + + + <% show_diff = revisions.size > 1 %> <% line_num = 1 %> <% revisions.each do |changeset| %> - - - - - + + + + + <% line_num += 1 %> <% end %>
#<%= l(:label_date) %><%= l(:field_author) %><%= l(:field_comments) %>
<%= 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) %><%= h truncate(changeset.author.to_s, :length => 30) %><%= textilizable(truncate_at_line_break(changeset.comments)) %><%= h truncate(changeset.id.to_s, :length => 20) %><%= format_time(changeset.created_at) %><%= h truncate(changeset.author_name.to_s, :length => 30) %><%= textilizable(truncate_at_line_break(changeset.message)) %>

- <%= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %> + <%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>

+ <% end %> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 132d915f2..7f9f675d2 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -59,15 +59,7 @@ <%= render_properties(@properties) %> -<% if authorize_for('repositories', 'revisions') %> - <% if @changesets && !@changesets.empty? %> - <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0) - sep = '' %> - <% if @repository.supports_all_revisions? && @path.blank? %> - <%= link_to l(:label_view_all_revisions_commits), :action => 'revisions', :id => @project, :repository_id => @repository.identifier_param %> - <% end %> | - <% end %> -<% end %> + 如何提交代码 <% content_for :header_tags do %>