Commit 8803fbb593df64a5b8fa43f167548a901fc1a6a0
1 parent
c0e5bc5e
Exists in
master
and in
4 other branches
merge request: notes, diffs, commits
Showing
8 changed files
with
120 additions
and
22 deletions
Show diff stats
app/assets/stylesheets/application.css
app/assets/stylesheets/projects.css.scss
... | ... | @@ -426,3 +426,39 @@ body.project-page table.no-borders tr, |
426 | 426 | body.project-page table.no-borders td{ |
427 | 427 | border:none; |
428 | 428 | } |
429 | + | |
430 | +#gitlab-tabs { | |
431 | + .ui-tabs-nav { | |
432 | + border-bottom: 1px solid #DEDFE1; | |
433 | + | |
434 | + li { | |
435 | + background: none; | |
436 | + border:none; | |
437 | + font-size: 16px; | |
438 | + margin: 0; | |
439 | + padding: 0; | |
440 | + | |
441 | + a { | |
442 | + margin: 0; | |
443 | + padding: 10px 16px; | |
444 | + width:150px; | |
445 | + } | |
446 | + | |
447 | + &.ui-tabs-selected { | |
448 | + background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.076, #fefefe), to(#F6F7F8)); | |
449 | + background-image: -webkit-linear-gradient(#fefefe 7.6%, #F6F7F8); | |
450 | + background-image: -moz-linear-gradient(#fefefe 7.6%, #F6F7F8); | |
451 | + background-image: -o-linear-gradient(#fefefe 7.6%, #F6F7F8); | |
452 | + font-weight: bold; | |
453 | + border:1px solid #DEDFE1; | |
454 | + border-bottom: 1px solid #DEDFE1; | |
455 | + -webkit-border-top-left-radius: 5px; | |
456 | + -webkit-border-top-right-radius: 5px; | |
457 | + -moz-border-radius-topleft: 5px; | |
458 | + -moz-border-radius-topright: 5px; | |
459 | + border-top-left-radius: 5px; | |
460 | + border-top-right-radius: 5px; | |
461 | + } | |
462 | + } | |
463 | + } | |
464 | +} | ... | ... |
app/controllers/merge_requests_controller.rb
1 | 1 | class MergeRequestsController < ApplicationController |
2 | 2 | before_filter :authenticate_user! |
3 | 3 | before_filter :project |
4 | - before_filter :merge_request, :only => [:edit, :update, :destroy, :show] | |
4 | + before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs] | |
5 | 5 | layout "project" |
6 | 6 | |
7 | 7 | # Authorize |
... | ... | @@ -19,7 +19,24 @@ class MergeRequestsController < ApplicationController |
19 | 19 | head(404)and return |
20 | 20 | end |
21 | 21 | |
22 | + @notes = @merge_request.notes.inc_author.order("created_at DESC").limit(20) | |
23 | + @note = @project.notes.new(:noteable => @merge_request) | |
24 | + | |
25 | + respond_to do |format| | |
26 | + format.html | |
27 | + format.js { respond_with_notes } | |
28 | + end | |
29 | + end | |
30 | + | |
31 | + def commits | |
22 | 32 | @commits = @project.repo.commits_between(@merge_request.target_branch, @merge_request.source_branch).map {|c| Commit.new(c)} |
33 | + render :template => "merge_requests/_commits", :layout => false | |
34 | + end | |
35 | + | |
36 | + def diffs | |
37 | + @commit = @project.commit(@merge_request.source_branch) | |
38 | + @diffs = @project.repo.diff(@merge_request.target_branch, @merge_request.source_branch) | |
39 | + render :template => "merge_requests/_diffs", :layout => false | |
23 | 40 | end |
24 | 41 | |
25 | 42 | def new | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +- if @commits.size > 0 | |
2 | + .merge-request-commits.ui-box.width-100p | |
3 | + - @commits.each do |commit| | |
4 | + %a{ :class => "commit", :href => project_commit_path(@project, :id => commit.id) } | |
5 | + - if commit.author_email | |
6 | + = image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" | |
7 | + - else | |
8 | + = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" | |
9 | + %span.update-title | |
10 | + = truncate commit.safe_message, :length => 60 | |
11 | + %span.update-author | |
12 | + %strong= commit.author_name | |
13 | + authored | |
14 | + = time_ago_in_words(commit.created_at) | |
15 | + ago | |
16 | + .clear | |
17 | + | ... | ... |
... | ... | @@ -0,0 +1,22 @@ |
1 | +- @diffs.each do |diff| | |
2 | + - next if diff.diff.empty? | |
3 | + - file = (@commit.tree / diff.b_path) | |
4 | + - next unless file | |
5 | + .diff_file | |
6 | + .diff_file_header | |
7 | + - if diff.deleted_file | |
8 | + %strong{:id => "#{diff.b_path}"}= diff.a_path | |
9 | + - else | |
10 | + = link_to tree_file_project_ref_path(@project, @commit.id, diff.b_path) do | |
11 | + %strong{:id => "#{diff.b_path}"}= diff.b_path | |
12 | + %br/ | |
13 | + .diff_file_content | |
14 | + - if file.text? | |
15 | + = render :partial => "commits/text_file", :locals => { :diff => diff } | |
16 | + - elsif file.image? | |
17 | + .diff_file_content_image | |
18 | + %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | |
19 | + - else | |
20 | + %p | |
21 | + %center No preview for this file type | |
22 | + | ... | ... |
app/views/merge_requests/_form.html.haml
... | ... | @@ -18,12 +18,12 @@ |
18 | 18 | %td= f.label :title |
19 | 19 | %td= f.text_field :title |
20 | 20 | %tr |
21 | - %td= f.label :target_branch, "From" | |
22 | - %td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }) | |
23 | - %tr | |
24 | - %td= f.label :source_branch, "To" | |
21 | + %td= f.label :source_branch, "From" | |
25 | 22 | %td= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }) |
26 | 23 | %tr |
24 | + %td= f.label :target_branch, "To" | |
25 | + %td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }) | |
26 | + %tr | |
27 | 27 | %td= f.label :assignee_id, "Assign to" |
28 | 28 | %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) |
29 | 29 | .buttons | ... | ... |
app/views/merge_requests/show.html.haml
... | ... | @@ -40,20 +40,20 @@ |
40 | 40 | %br |
41 | 41 | %br |
42 | 42 | |
43 | +#gitlab-tabs | |
44 | + %ul | |
45 | + %li= link_to "Notes", "#merge-notes" | |
46 | + %li= link_to "Commits", commits_project_merge_request_path(@project, @merge_request) | |
47 | + %li= link_to "Diff", diffs_project_merge_request_path(@project, @merge_request) | |
43 | 48 | |
44 | -- if @commits.size > 0 | |
45 | - .merge-request-commits.ui-box.width-100p | |
46 | - - @commits.each do |commit| | |
47 | - %a{ :class => "commit", :href => project_commit_path(@project, :id => commit.id) } | |
48 | - - if commit.author_email | |
49 | - = image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" | |
50 | - - else | |
51 | - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" | |
52 | - %span.update-title | |
53 | - = commit.id.to_s | |
54 | - %span.update-author | |
55 | - %strong= commit.author_name | |
56 | - authored | |
57 | - = time_ago_in_words(commit.created_at) | |
58 | - ago | |
59 | - .clear | |
49 | + #merge-notes | |
50 | + .issue_notes= render "notes/notes" | |
51 | + .loading{ :style => "display:none;"} | |
52 | + %center= image_tag "ajax-loader.gif" | |
53 | + .clear | |
54 | + | |
55 | + | |
56 | +:javascript | |
57 | + $(function(){ | |
58 | + $("#gitlab-tabs").tabs(); | |
59 | + }) | ... | ... |
config/routes.rb
... | ... | @@ -59,7 +59,12 @@ Gitlab::Application.routes.draw do |
59 | 59 | end |
60 | 60 | end |
61 | 61 | |
62 | - resources :merge_requests | |
62 | + resources :merge_requests do | |
63 | + member do | |
64 | + get :diffs | |
65 | + get :commits | |
66 | + end | |
67 | + end | |
63 | 68 | resources :snippets |
64 | 69 | resources :commits |
65 | 70 | resources :team_members | ... | ... |