merge request: notes, diffs, commits
This commit is contained in:
parent
c0e5bc5ee8
commit
8803fbb593
8 changed files with 120 additions and 22 deletions
|
@ -49,3 +49,4 @@
|
||||||
.no-padding {
|
.no-padding {
|
||||||
padding:0 !important;
|
padding:0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -426,3 +426,39 @@ body.project-page table.no-borders tr,
|
||||||
body.project-page table.no-borders td{
|
body.project-page table.no-borders td{
|
||||||
border:none;
|
border:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#gitlab-tabs {
|
||||||
|
.ui-tabs-nav {
|
||||||
|
border-bottom: 1px solid #DEDFE1;
|
||||||
|
|
||||||
|
li {
|
||||||
|
background: none;
|
||||||
|
border:none;
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
a {
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px 16px;
|
||||||
|
width:150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.ui-tabs-selected {
|
||||||
|
background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.076, #fefefe), to(#F6F7F8));
|
||||||
|
background-image: -webkit-linear-gradient(#fefefe 7.6%, #F6F7F8);
|
||||||
|
background-image: -moz-linear-gradient(#fefefe 7.6%, #F6F7F8);
|
||||||
|
background-image: -o-linear-gradient(#fefefe 7.6%, #F6F7F8);
|
||||||
|
font-weight: bold;
|
||||||
|
border:1px solid #DEDFE1;
|
||||||
|
border-bottom: 1px solid #DEDFE1;
|
||||||
|
-webkit-border-top-left-radius: 5px;
|
||||||
|
-webkit-border-top-right-radius: 5px;
|
||||||
|
-moz-border-radius-topleft: 5px;
|
||||||
|
-moz-border-radius-topright: 5px;
|
||||||
|
border-top-left-radius: 5px;
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class MergeRequestsController < ApplicationController
|
class MergeRequestsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :project
|
before_filter :project
|
||||||
before_filter :merge_request, :only => [:edit, :update, :destroy, :show]
|
before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs]
|
||||||
layout "project"
|
layout "project"
|
||||||
|
|
||||||
# Authorize
|
# Authorize
|
||||||
|
@ -19,7 +19,24 @@ class MergeRequestsController < ApplicationController
|
||||||
head(404)and return
|
head(404)and return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@notes = @merge_request.notes.inc_author.order("created_at DESC").limit(20)
|
||||||
|
@note = @project.notes.new(:noteable => @merge_request)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.js { respond_with_notes }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def commits
|
||||||
@commits = @project.repo.commits_between(@merge_request.target_branch, @merge_request.source_branch).map {|c| Commit.new(c)}
|
@commits = @project.repo.commits_between(@merge_request.target_branch, @merge_request.source_branch).map {|c| Commit.new(c)}
|
||||||
|
render :template => "merge_requests/_commits", :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def diffs
|
||||||
|
@commit = @project.commit(@merge_request.source_branch)
|
||||||
|
@diffs = @project.repo.diff(@merge_request.target_branch, @merge_request.source_branch)
|
||||||
|
render :template => "merge_requests/_diffs", :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
17
app/views/merge_requests/_commits.html.haml
Normal file
17
app/views/merge_requests/_commits.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
- if @commits.size > 0
|
||||||
|
.merge-request-commits.ui-box.width-100p
|
||||||
|
- @commits.each do |commit|
|
||||||
|
%a{ :class => "commit", :href => project_commit_path(@project, :id => commit.id) }
|
||||||
|
- if commit.author_email
|
||||||
|
= image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
|
||||||
|
- else
|
||||||
|
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
|
||||||
|
%span.update-title
|
||||||
|
= truncate commit.safe_message, :length => 60
|
||||||
|
%span.update-author
|
||||||
|
%strong= commit.author_name
|
||||||
|
authored
|
||||||
|
= time_ago_in_words(commit.created_at)
|
||||||
|
ago
|
||||||
|
.clear
|
||||||
|
|
22
app/views/merge_requests/_diffs.html.haml
Normal file
22
app/views/merge_requests/_diffs.html.haml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
- @diffs.each do |diff|
|
||||||
|
- next if diff.diff.empty?
|
||||||
|
- file = (@commit.tree / diff.b_path)
|
||||||
|
- next unless file
|
||||||
|
.diff_file
|
||||||
|
.diff_file_header
|
||||||
|
- if diff.deleted_file
|
||||||
|
%strong{:id => "#{diff.b_path}"}= diff.a_path
|
||||||
|
- else
|
||||||
|
= link_to tree_file_project_ref_path(@project, @commit.id, diff.b_path) do
|
||||||
|
%strong{:id => "#{diff.b_path}"}= diff.b_path
|
||||||
|
%br/
|
||||||
|
.diff_file_content
|
||||||
|
- if file.text?
|
||||||
|
= render :partial => "commits/text_file", :locals => { :diff => diff }
|
||||||
|
- elsif file.image?
|
||||||
|
.diff_file_content_image
|
||||||
|
%img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
|
||||||
|
- else
|
||||||
|
%p
|
||||||
|
%center No preview for this file type
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
%td= f.label :title
|
%td= f.label :title
|
||||||
%td= f.text_field :title
|
%td= f.text_field :title
|
||||||
%tr
|
%tr
|
||||||
%td= f.label :target_branch, "From"
|
%td= f.label :source_branch, "From"
|
||||||
%td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" })
|
|
||||||
%tr
|
|
||||||
%td= f.label :source_branch, "To"
|
|
||||||
%td= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" })
|
%td= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" })
|
||||||
|
%tr
|
||||||
|
%td= f.label :target_branch, "To"
|
||||||
|
%td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" })
|
||||||
%tr
|
%tr
|
||||||
%td= f.label :assignee_id, "Assign to"
|
%td= f.label :assignee_id, "Assign to"
|
||||||
%td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
|
%td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
|
||||||
|
|
|
@ -40,20 +40,20 @@
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
|
|
||||||
|
#gitlab-tabs
|
||||||
|
%ul
|
||||||
|
%li= link_to "Notes", "#merge-notes"
|
||||||
|
%li= link_to "Commits", commits_project_merge_request_path(@project, @merge_request)
|
||||||
|
%li= link_to "Diff", diffs_project_merge_request_path(@project, @merge_request)
|
||||||
|
|
||||||
- if @commits.size > 0
|
#merge-notes
|
||||||
.merge-request-commits.ui-box.width-100p
|
.issue_notes= render "notes/notes"
|
||||||
- @commits.each do |commit|
|
.loading{ :style => "display:none;"}
|
||||||
%a{ :class => "commit", :href => project_commit_path(@project, :id => commit.id) }
|
%center= image_tag "ajax-loader.gif"
|
||||||
- if commit.author_email
|
.clear
|
||||||
= image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
|
|
||||||
- else
|
|
||||||
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
|
:javascript
|
||||||
%span.update-title
|
$(function(){
|
||||||
= commit.id.to_s
|
$("#gitlab-tabs").tabs();
|
||||||
%span.update-author
|
})
|
||||||
%strong= commit.author_name
|
|
||||||
authored
|
|
||||||
= time_ago_in_words(commit.created_at)
|
|
||||||
ago
|
|
||||||
.clear
|
|
||||||
|
|
|
@ -59,7 +59,12 @@ Gitlab::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :merge_requests
|
resources :merge_requests do
|
||||||
|
member do
|
||||||
|
get :diffs
|
||||||
|
get :commits
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :snippets
|
resources :snippets
|
||||||
resources :commits
|
resources :commits
|
||||||
resources :team_members
|
resources :team_members
|
||||||
|
|
Loading…
Add table
Reference in a new issue