Commit 8803fbb5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

merge request: notes, diffs, commits

parent c0e5bc5e
......@@ -49,3 +49,4 @@
.no-padding {
padding:0 !important;
}
......@@ -426,3 +426,39 @@ body.project-page table.no-borders tr,
body.project-page table.no-borders td{
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;
}
}
}
}
class MergeRequestsController < ApplicationController
before_filter :authenticate_user!
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"
# Authorize
......@@ -19,7 +19,24 @@ class MergeRequestsController < ApplicationController
head(404)and return
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)}
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
def new
......
- 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
- @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.text_field :title
%tr
%td= f.label :target_branch, "From"
%td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" })
%tr
%td= f.label :source_branch, "To"
%td= f.label :source_branch, "From"
%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
%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" })
......
......@@ -40,20 +40,20 @@
%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-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
= commit.id.to_s
%span.update-author
%strong= commit.author_name
authored
= time_ago_in_words(commit.created_at)
ago
.clear
#merge-notes
.issue_notes= render "notes/notes"
.loading{ :style => "display:none;"}
%center= image_tag "ajax-loader.gif"
.clear
:javascript
$(function(){
$("#gitlab-tabs").tabs();
})
......@@ -59,7 +59,12 @@ Gitlab::Application.routes.draw do
end
end
resources :merge_requests
resources :merge_requests do
member do
get :diffs
get :commits
end
end
resources :snippets
resources :commits
resources :team_members
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment