Merge branch 'hjq_new_course' into szzh
This commit is contained in:
commit
2fb26c3ac4
|
@ -34,7 +34,7 @@ class RepositoriesController < ApplicationController
|
|||
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
|
||||
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked]
|
||||
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff]
|
||||
accept_rss_auth :revisions
|
||||
# hidden repositories filter // 隐藏代码过滤器
|
||||
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
|
||||
|
@ -521,6 +521,13 @@ update
|
|||
end
|
||||
end
|
||||
|
||||
# 每次提交对应的文件差异
|
||||
def commit_diff
|
||||
@commit_diff = $g.commit_diff(@project.gpid, params[:changeset])
|
||||
@commit_details = $g.commit(@project.gpid, params[:changeset])
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
def diff
|
||||
if params[:format] == 'diff'
|
||||
@diff = @repository.diff(@path, @rev, @rev_to)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -41,6 +41,16 @@ module RepositoriesHelper
|
|||
identifiers.include?(iden) ? false :true
|
||||
end
|
||||
|
||||
# 获取diff内容行号
|
||||
def diff_line_num content
|
||||
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
|
||||
end
|
||||
|
||||
# 处理内容
|
||||
def diff_content content
|
||||
content.gsub!(/.*@@ -\d+,\d+ \+\d+,\d+ @@\n/m,'')
|
||||
end
|
||||
|
||||
def format_revision(revision)
|
||||
if revision.respond_to? :format_identifier
|
||||
revision.format_identifier
|
||||
|
|
|
@ -85,6 +85,11 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
def link_to_user_version(version, options = {})
|
||||
return '' unless version && version.is_a?(Version)
|
||||
link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue"
|
||||
end
|
||||
|
||||
# 统计未读消息数
|
||||
def unviewed_message(user)
|
||||
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
|
|
|
@ -643,8 +643,8 @@ class Attachment < ActiveRecord::Base
|
|||
|
||||
def decrease_attchments_count
|
||||
if self.container_type == "Project" && !self.project.project_score.nil?
|
||||
aatach_count = self.container.project_score.attach_num - 1
|
||||
self.container.project_score.update_attribute(:attach_num, aatach_count)
|
||||
attach_count = self.container.project_score.attach_num - 1
|
||||
self.container.project_score.update_attribute(:attach_num, attach_count < 0 ? 0 : attach_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -184,7 +184,7 @@ class Issue < ActiveRecord::Base
|
|||
def decrease_issues_count
|
||||
unless self.project.project_score.nil?
|
||||
issue_count = self.project.project_score.issue_num - 1
|
||||
self.project.project_score.update_attribute(:issue_num, issue_count)
|
||||
self.project.project_score.update_attribute(:issue_num, issue_count < 0 ? 0 : issue_count)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -219,8 +219,9 @@ class Journal < ActiveRecord::Base
|
|||
# 减少留言数量统计
|
||||
def decrease_issues_journal_count
|
||||
unless self.issue.project.nil?
|
||||
project = self.issue.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num - 1)
|
||||
journal_count = self.issue.project.project_score.issue_journal_num - 1
|
||||
# project = self.issue.project
|
||||
self.issue.project.project_score.update_attribute(:issue_journal_num, journal_count < 0 ? 0 : journal_count)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -146,10 +146,10 @@ class Message < ActiveRecord::Base
|
|||
# 讨论区
|
||||
if self.parent_id.nil?
|
||||
count = self.project.project_score.board_num - 1
|
||||
self.project.project_score.update_attribute(:board_num, count)
|
||||
self.project.project_score.update_attribute(:board_num, count < 0 ? 0 : count)
|
||||
else # 回复
|
||||
count = self.project.project_score.board_message_num - 1
|
||||
self.project.project_score.update_attribute(:board_message_num, count)
|
||||
self.project.project_score.update_attribute(:board_message_num, count < 0 ? 0 : count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -126,7 +126,7 @@ class News < ActiveRecord::Base
|
|||
def decrease_news_count
|
||||
if self.project && !self.project.project_score.nil?
|
||||
count = self.project.project_score.news_num - 1
|
||||
self.project.project_score.update_attribute(:news_num, count)
|
||||
self.project.project_score.update_attribute(:news_num, count < 0 ? 0 : count)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
|
||||
</th>
|
||||
<td class="line-code">
|
||||
<pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre>
|
||||
<pre style="width:auto;white-space: nowrap;overflow: auto; "><%= line.html_safe %></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<% line_num += 1 %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'header','public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','repository','share' %>
|
||||
<%= stylesheet_link_tag 'header','scm','public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','repository','share' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %>
|
||||
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<div class="commit-row-info">
|
||||
<% if !user_commit_rep(changeset.author_email).nil? %>
|
||||
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
|
||||
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>提交于
|
||||
<div class="committed_ago">
|
||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>前 </time>
|
||||
</div>
|
||||
<% else %>
|
||||
<span class="commit-author-name"><%= changeset.author_email %></span>提交于
|
||||
<div class="committed_ago">
|
||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -24,10 +24,10 @@
|
|||
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
|
||||
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
|
||||
<% if @repository.report_last_commit %>
|
||||
<td class="revision"><%= link_to_revision(entry.changeset, @repository) if entry.changeset %></td>
|
||||
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
|
||||
<td class="author"><%= entry.author %></td>
|
||||
<td class="comments"><%=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %></td>
|
||||
<td class="revision"><%= link_to_revision(entry.changeset, @repository) if entry.changeset %></td>
|
||||
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
|
||||
<td class="author"><%= entry.author %></td>
|
||||
<td class="comments"><%=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -20,27 +20,13 @@
|
|||
<div class="col-md-10 col-sm-12">
|
||||
<ul class="bordered-list">
|
||||
<li class="commit js-toggle-container">
|
||||
<div class="commit-row-info">
|
||||
<% if !user_commit_rep(changeset.author_email).nil? %>
|
||||
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
|
||||
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>提交于
|
||||
<div class="committed_ago">
|
||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>前 </time>
|
||||
</div>
|
||||
<% else %>
|
||||
<span class="commit-author-name"><%= changeset.author_email %></span>提交于
|
||||
<div class="committed_ago">
|
||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => 'commit_details', :locals => {:changeset => changeset} %>
|
||||
<div style="padding-left:30px;" class="commit-row-title">
|
||||
<strong class="str-truncated">
|
||||
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
|
||||
</strong>
|
||||
<div class="pull-right" title="修订号">
|
||||
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
|
||||
<%= link_to truncate(changeset.short_id.to_s, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => project.id, :changeset => changeset.id} %>
|
||||
</div>
|
||||
<div class="notes_count">
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div class="mt10">
|
||||
|
||||
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path ,:revisions => @commits, :entry => @entry ,:commits_pages =>@commits_pages , :commits_count => @commits_count}) unless @commits.empty? %>
|
||||
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path , :revisions => @commits, :entry => @entry , :commits_pages => @commits_pages , :commits_count => @commits_count}) unless @commits.empty? %>
|
||||
|
||||
</div>
|
||||
<% content_for :header_tags do %>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<div class="project_r_h">
|
||||
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
|
||||
</div>
|
||||
<!--<script>-->
|
||||
<!--// $(document).ready(function(){-->
|
||||
<!--// $("#changed-files").click(function(){-->
|
||||
<!--// $("#changed-files-detail").toggle();-->
|
||||
<!--// });-->
|
||||
<!--// });-->
|
||||
<!--</script>-->
|
||||
<div class="showing-changes-info fontGrey2"> Commit <a href="javascript:void()" class="linkGrey3">
|
||||
<%= @commit_details.id %></a><br />
|
||||
<li class="commit js-toggle-container">
|
||||
<%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %>
|
||||
</li>
|
||||
</div>
|
||||
<div class="showing-changes-project f14"><%= @commit_details.message %></div>
|
||||
<!--<div class="showing-changes-row fontGrey2">Showing <a href="javascript:void()" class="linkGrey3" id="changed-files">3 changed files</a> with <span class="c_green">3 additions</span> and <span class="c_red">3 deletions</span>-->
|
||||
<!--<ol class="mt10" id="changed-files-detail">-->
|
||||
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/organizations/_org_course_homework.html.erb</a> </li>-->
|
||||
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_course_homework.html.erb</a> </li>-->
|
||||
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_user_homework_detail.html.erb</a> </li>-->
|
||||
<!--</ol>-->
|
||||
<!--</div>-->
|
||||
|
||||
<% @commit_diff.each do |cd| %>
|
||||
<div class="showing-changes-row fontGrey2">
|
||||
<a href="javascript:void()" class="linkGrey3" id="changed-files">
|
||||
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd.new_path %>
|
||||
</a>
|
||||
</div>
|
||||
<div class="autoscroll">
|
||||
<table class="filecontent syntaxhl" style="width:100%;" >
|
||||
<tbody>
|
||||
<% line_num = diff_line_num(cd.diff) %>
|
||||
<% diff_content = diff_content(cd.diff) %>
|
||||
<% syntax_highlight_lines(cd.new_path, Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %>
|
||||
<tr>
|
||||
<th class="line-num" id="L<%= line_num %>" style="vertical-align: top;">
|
||||
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
|
||||
</th>
|
||||
<% if line[0,1] == "-" %>
|
||||
<td class="line-code diff_out"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
|
||||
<% elsif line[0,1] == "+" %>
|
||||
<td class="line-code diff_in"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
|
||||
<% else%>
|
||||
<td class="line-code"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% line_num += 1 %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,11 +1,11 @@
|
|||
<% if @obj %>
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
|
||||
:locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>');
|
||||
$("#tags_name_<%=@obj.id%>").val("");
|
||||
$("#add_tag_<%=@obj.id%>").hide();
|
||||
<% else %>
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'files/project_list',
|
||||
:locals => {project: @project,all_attachments: @all_attachments,sort:@sort,order:@order,project_attachments:@obj_attachments}) %>");
|
||||
<% end %>
|
||||
<% if @obj %>
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
|
||||
:locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>');
|
||||
$("#tags_name_<%=@obj.id%>").val("");
|
||||
$("#add_tag_<%=@obj.id%>").hide();
|
||||
<% else %>
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'files/project_list',
|
||||
:locals => {project: @project,all_attachments: @all_attachments,sort:@sort,order:@order,project_attachments:@obj_attachments}) %>");
|
||||
<% end %>
|
||||
$("#files_tag_project").html("<%= escape_javascript(render :partial => "files/tag_yun_project", :locals => {:tag_list => @tag_list,:project => @project,:tag_name => @select_tag_name}) %>");
|
|
@ -831,7 +831,7 @@ RedmineApp::Application.routes.draw do
|
|||
:controller => 'repositories',
|
||||
:format => false,
|
||||
:constraints => {
|
||||
:action => /(browse|show|entry|raw|annotate|diff)/,
|
||||
:action => /(browse|show|entry|raw|annotate|diff|commit_diff)/,
|
||||
:rev => /[a-z0-9\.\-_]+/
|
||||
}
|
||||
|
||||
|
@ -850,15 +850,15 @@ RedmineApp::Application.routes.draw do
|
|||
:controller => 'repositories',
|
||||
:format => false,
|
||||
:constraints => {
|
||||
:action => /(browse|show|entry|raw|annotate|diff)/,
|
||||
:action => /(browse|show|entry|raw|annotate|diff|commit_diff)/,
|
||||
:rev => /[a-z0-9\.\-_]+/
|
||||
}
|
||||
get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
|
||||
:controller => 'repositories',
|
||||
:action => /(browse|show|entry|raw|changes|annotate|diff)/
|
||||
:action => /(browse|show|entry|raw|changes|annotate|diff|commit_diff)/
|
||||
get 'projects/:id/repository/:action(/*path(.:ext))',
|
||||
:controller => 'repositories',
|
||||
:action => /(browse|show|entry|raw|changes|annotate|diff)/
|
||||
:action => /(browse|show|entry|raw|changes|annotate|diff|commit_diff)/
|
||||
|
||||
get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
|
||||
get 'projects/:id/repository', :to => 'repositories#show', :path => nil
|
||||
|
|
|
@ -1269,7 +1269,6 @@ ActiveRecord::Schema.define(:version => 20160223073859) do
|
|||
t.text "description"
|
||||
t.integer "creator_id"
|
||||
t.integer "home_id"
|
||||
t.string "domain"
|
||||
t.boolean "is_public"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -694,7 +694,7 @@ p.other-formats { text-align: right; font-size:0.9em; color: #666; }
|
|||
|
||||
/*pre标签换行*/
|
||||
.break_word{word-break: break-all;word-wrap: break-word;}
|
||||
.break_word_firefox{white-space: pre-wrap;word-break: break-all;}
|
||||
.break_word_firefox{white-space: pre-wrap !important;word-break: break-all;}
|
||||
|
||||
/*问题跟踪attachment显示*/
|
||||
div.attachments { margin-top: 12px; }
|
||||
|
@ -896,9 +896,9 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
|
|||
/*end*/
|
||||
/***** Diff *****/
|
||||
.diff_out { background: #fcc; }
|
||||
.diff_out span { background: #faa; }
|
||||
/*.diff_out span { background: #faa; }*/
|
||||
.diff_in { background: #cfc; }
|
||||
.diff_in span { background: #afa; }
|
||||
/*.diff_in span { background: #afa; }*/
|
||||
|
||||
.text-diff {
|
||||
padding: 1em;
|
||||
|
@ -1169,3 +1169,18 @@ div.disable_link {background-color: #c1c1c1 !important;}
|
|||
.proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;}
|
||||
.proInfoBox2 ul li{ height:24px; position:relative;}
|
||||
.maxwidth150{max-width: 150px;}
|
||||
|
||||
/*版本库diff*/
|
||||
.showing-changes-info {width:650px; padding:10px; padding-top: 0px; background-color:#ffffff; line-height:2;}
|
||||
.showing-changes-project {width:650px; padding:10px; border-top:1px solid #dce0e6; border-bottom:1px solid #dce0e6; background-color:#f1f1f1;}
|
||||
.showing-changes-row {width:650px; padding:10px; border-bottom:1px solid #dce0e6; background-color:#f1f1f1;}
|
||||
#changed-files-detail {display:none;}
|
||||
#changed-files-detail li {list-style-type:disc; margin-left:15px;}
|
||||
.showing-changes-detail {width:670px; border-bottom:1px solid #dce0e6; background-color:#f1f1f1;}
|
||||
.changes-detail-chart {width:100%; overflow:auto; border-collapse:collapse; margin:0px; padding:0px; background-color:#f1f1f1;}
|
||||
.diff-line-number {width:35px; min-width:35px; max-width:50px; border-right:1px solid #c1c1c1; padding:0px 5px; text-align:right; background-color:#f1f1f1;}
|
||||
.code-line-old {background-color:#ffecec;}
|
||||
.number-line-old {background-color:#ffdddd; border-color:#f1c0c0;}
|
||||
.code-line-new {background-color:#eaffea;}
|
||||
.number-line-new {background-color:#dbffdb; border-color:#c1e9c1;}
|
||||
.branch-label {padding-right: 5px; border-radius:2px; color:#888888; display:inline-block; background-color:#f8fafc;}
|
Loading…
Reference in New Issue