数据获取及展示

This commit is contained in:
huang 2016-08-03 15:06:10 +08:00
parent 0a9224d036
commit 27e755a0a9
6 changed files with 43 additions and 37 deletions

View File

@ -77,6 +77,7 @@ class PullRequestsController < ApplicationController
# 获取某次请求的改动
def pull_request_changes
@type = 2
@changes = @g.merge_request_changes(@project.gpid, params[:id])
end

View File

@ -1,32 +1,34 @@
<div class="showing-changes-row fontGrey2" style="width:730px; margin:0 -10px;">Showing <a href="javascript:void(0)" class="linkGrey3 fb" id="changed-files">3 changed files</a> with <span class="c_green fb">3 additions</span> and <span class="c_red fb">3 deletions</span>
<ol class="mt10" id="changed-files-detail">
<li><a href="javascript:void(0)" class="linkGrey3">app/views/organizations/_org_course_homework.html.erb</a> </li>
<li><a href="javascript:void(0)" class="linkGrey3">app/views/users/_course_homework.html.erb</a> </li>
<li><a href="javascript:void(0)" class="linkGrey3">app/views/users/_user_homework_detail.html.erb</a> </li>
</ol>
</div>
<div class="showing-changes-row fontGrey2" style="width:730px; margin:0 -10px;"><a href="javascript:void(0)" class="linkGrey3"><img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" />app/views/organizations/_org_course_homework.html.erb</a></div>
<div class="showing-changes-detail" style="width:750px; margin:0 -10px;">
<table class="changes-detail-chart">
<tr>
<td class="diff-line-number fontGrey2">99</td>
<td class="diff-line-number fontGrey2">99</td>
<td class="fontGrey2 p10">&lt;% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %&gt;</td>
</tr>
<tr>
<td class="diff-line-number fontGrey2">100</td>
<td class="diff-line-number fontGrey2">100</td>
<td class="fontGrey2 p10">&lt;div class="mt10"&gt;</td>
</tr>
<tr>
<td class="diff-line-number fontGrey2 number-line-old">111</td>
<td class="diff-line-number fontGrey2 number-line-old"></td>
<td class="fontGrey2 p10 code-line-old">- &lt;div class="fl mr5 fontGrey3"&gt;</td>
</tr>
<tr class="code-line-new">
<td class="diff-line-number fontGrey2 number-line-new"></td>
<td class="diff-line-number fontGrey2 number-line-new">111</td>
<td class="fontGrey2 p10 code-line-new">+ &lt;div class="fl mr20 fontGrey3 w80"&gt;</td>
</tr>
</table>
</div>
<% @changes.each do |changes| %>
<div class="showing-changes-row fontGrey2" style="width:730px; margin:0 -10px;">Showing <a href="javascript:void(0)" class="linkGrey3 fb" id="changed-files">3 changed files</a> with <span class="c_green fb">3 additions</span> and <span class="c_red fb">3 deletions</span>
<ol class="mt10" id="changed-files-detail">
<li><a href="javascript:void(0)" class="linkGrey3">app/views/organizations/_org_course_homework.html.erb</a> </li>
<li><a href="javascript:void(0)" class="linkGrey3">app/views/users/_course_homework.html.erb</a> </li>
<li><a href="javascript:void(0)" class="linkGrey3">app/views/users/_user_homework_detail.html.erb</a> </li>
</ol>
</div>
<div class="showing-changes-row fontGrey2" style="width:730px; margin:0 -10px;"><a href="javascript:void(0)" class="linkGrey3"><img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" />app/views/organizations/_org_course_homework.html.erb</a></div>
<div class="showing-changes-detail" style="width:750px; margin:0 -10px;">
<table class="changes-detail-chart">
<tr>
<td class="diff-line-number fontGrey2">99</td>
<td class="diff-line-number fontGrey2">99</td>
<td class="fontGrey2 p10">&lt;% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %&gt;</td>
</tr>
<tr>
<td class="diff-line-number fontGrey2">100</td>
<td class="diff-line-number fontGrey2">100</td>
<td class="fontGrey2 p10">&lt;div class="mt10"&gt;</td>
</tr>
<tr>
<td class="diff-line-number fontGrey2 number-line-old">111</td>
<td class="diff-line-number fontGrey2 number-line-old"></td>
<td class="fontGrey2 p10 code-line-old">- &lt;div class="fl mr5 fontGrey3"&gt;</td>
</tr>
<tr class="code-line-new">
<td class="diff-line-number fontGrey2 number-line-new"></td>
<td class="diff-line-number fontGrey2 number-line-new">111</td>
<td class="fontGrey2 p10 code-line-new">+ &lt;div class="fl mr20 fontGrey3 w80"&gt;</td>
</tr>
</table>
</div>
<% end %>

View File

@ -1,2 +1,2 @@
<%= render :partial => "pull_requests/pull_request_container" %>
<% render :partial => "pull_requests/new" %>
<%= render :partial => "pull_requests/new" %>

View File

@ -0,0 +1 @@
$("#merge_record_1").html('<%= render :partial => "pull_requests/pull_request_changes" %>');

View File

@ -19,9 +19,11 @@
<div class="new-merge-wrap" id="merge_record_0">
<%= render :partial => "pull_requests/pull_request_commits" %>
</div>
<div id="merge_record_1" class="undis">
<%= render :partial => "pull_requests/pull_request_changes" %>
</div>
<% if @type == 2 %>
<div id="merge_record_1" class="undis">
<%= render :partial => "pull_requests/pull_request_changes" %>
</div>
<% end %>
<script>
$("#mergeShow").parent().css("width","730px");

View File

@ -1,7 +1,7 @@
<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") %>
<%= 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>&nbsp;