修改 最近一次提交记录 接口

数据同步 validate类型控制
This commit is contained in:
huang 2015-10-29 15:56:41 +08:00
parent 331461465f
commit 0158fe023d
4 changed files with 10 additions and 28 deletions

View File

@ -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]

View File

@ -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| %>
<tr class="changeset <%= cycle 'odd', 'even' %>">
<% 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 %>
<td class="checkbox"><%= 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) %></td>
<td class="checkbox"><%= 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) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>

View File

@ -30,10 +30,10 @@
<div class="cl"></div>
<div class="recordBanner mt10">
<% if @changesets && !@changesets.empty? %>
<%= image_tag(url_to_avatar(@changesets_latest_coimmit.user), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl"><%=link_to @changesets_latest_coimmit.user, user_path(@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>
<%= image_tag(url_to_avatar(@changesets_latest_coimmit.author_name), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl"><%=link_to @changesets_latest_coimmit.author_name, user_path(@changesets_latest_coimmit.author_name) %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<% end %>
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2">

View File

@ -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!