merge request show page refactored
This commit is contained in:
parent
e4bd6442a9
commit
3a50b6cac9
9 changed files with 105 additions and 52 deletions
|
@ -1,4 +1,4 @@
|
||||||
[Dolphin]
|
[Dolphin]
|
||||||
ShowPreview=true
|
ShowPreview=true
|
||||||
Timestamp=2011,12,12,23,25,14
|
Timestamp=2011,12,13,12,22,12
|
||||||
Version=2
|
Version=2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
var MergeRequest = {
|
var MergeRequest = {
|
||||||
diff_loaded: false,
|
diffs_loaded: false,
|
||||||
commits_loaded: false,
|
commits_loaded: false,
|
||||||
|
|
||||||
init:
|
init:
|
||||||
|
@ -9,12 +9,25 @@ var MergeRequest = {
|
||||||
$(this).addClass("active");
|
$(this).addClass("active");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".merge-tabs a.merge-notes-tab").live("click", function() {
|
||||||
|
$(".merge-request-commits, .merge-request-diffs").hide();
|
||||||
|
$(".merge-request-notes").show();
|
||||||
|
});
|
||||||
|
|
||||||
$(".merge-tabs a.merge-commits-tab").live("click", function() {
|
$(".merge-tabs a.merge-commits-tab").live("click", function() {
|
||||||
if(MergeRequest.commits_loaded) {
|
if(!MergeRequest.commits_loaded) {
|
||||||
$(".merge-request-commits").show();
|
|
||||||
} else {
|
|
||||||
MergeRequest.loadCommits();
|
MergeRequest.loadCommits();
|
||||||
}
|
}
|
||||||
|
$(".merge-request-notes, .merge-request-diffs").hide();
|
||||||
|
$(".merge-request-commits").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".merge-tabs a.merge-diffs-tab").live("click", function() {
|
||||||
|
if(!MergeRequest.diffs_loaded) {
|
||||||
|
MergeRequest.loadDiff();
|
||||||
|
}
|
||||||
|
$(".merge-request-notes, .merge-request-commits").hide();
|
||||||
|
$(".merge-request-diffs").show();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -23,14 +36,24 @@ var MergeRequest = {
|
||||||
$(".dashboard-loader").show();
|
$(".dashboard-loader").show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: location.href + "/commits",
|
url: $(".merge-commits-tab").attr("data-url"),
|
||||||
complete: function(){
|
complete: function(){
|
||||||
MergeRequest.commits_loaded = true;
|
MergeRequest.commits_loaded = true;
|
||||||
|
$(".merge-request-notes, .merge-request-diffs").hide();
|
||||||
$(".dashboard-loader").hide()},
|
$(".dashboard-loader").hide()},
|
||||||
dataType: "script"});
|
dataType: "script"});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadDiff:
|
loadDiff:
|
||||||
function() {
|
function() {
|
||||||
|
$(".dashboard-loader").show();
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: $(".merge-diffs-tab").attr("data-url"),
|
||||||
|
complete: function(){
|
||||||
|
MergeRequest.diffs_loaded = true;
|
||||||
|
$(".merge-request-notes, .merge-request-commits").hide();
|
||||||
|
$(".dashboard-loader").hide()},
|
||||||
|
dataType: "script"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@ h4.middle-panel {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.merge-tabs {
|
.merge-tabs {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
@ -567,9 +567,32 @@ ul.merge-tabs {
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
background:none;
|
background:none;
|
||||||
padding: 4px 10px;
|
padding: 4px 10px;
|
||||||
|
width:160px;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: #eaeaea;
|
background: #eaeaea;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.merge-tabs .reopen-request {
|
||||||
|
@include round-borders-all(4px);
|
||||||
|
padding:2px 4px;
|
||||||
|
border:1px solid #aaa;
|
||||||
|
text-shadow:none;
|
||||||
|
background: #D12F19;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.merge-tabs .close-request {
|
||||||
|
@include round-borders-all(4px);
|
||||||
|
padding:2px 4px;
|
||||||
|
border:1px solid #aaa;
|
||||||
|
text-shadow:none;
|
||||||
|
background: #44aa22;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-mention {
|
||||||
|
color: #2FA0BB;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
|
@ -30,14 +30,11 @@ class MergeRequestsController < ApplicationController
|
||||||
|
|
||||||
def commits
|
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
|
end
|
||||||
|
|
||||||
def diffs
|
def diffs
|
||||||
@diffs = @merge_request.diffs
|
@diffs = @merge_request.diffs
|
||||||
@commit = @merge_request.last_commit
|
@commit = @merge_request.last_commit
|
||||||
|
|
||||||
render :template => "merge_requests/_diffs", :layout => false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -28,7 +28,12 @@
|
||||||
%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" })
|
||||||
.buttons
|
.buttons
|
||||||
= f.submit 'Save', :class => "grey-button"
|
= f.submit 'Save', :class => "grey-button"
|
||||||
.right= link_to 'Back', project_merge_requests_path(@project), :class => "grey-button"
|
|
||||||
|
= link_to 'Back', project_merge_requests_path(@project), :class => "grey-button"
|
||||||
|
- unless @merge_request.new_record?
|
||||||
|
.right
|
||||||
|
= link_to 'Remove', [@project, @merge_request], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button"
|
||||||
|
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(function(){
|
$(function(){
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%a.update-item{:href => project_merge_request_path(merge_request.project, merge_request)}
|
%a.update-item{:href => project_merge_request_path(merge_request.project, merge_request)}
|
||||||
= image_tag gravatar_icon(merge_request.author_email), :class => "left", :width => 40
|
= image_tag gravatar_icon(merge_request.author_email), :class => "left", :width => 40
|
||||||
%span.update-title
|
%span.update-title
|
||||||
= merge_request.title
|
= truncate(merge_request.title, :length => 60)
|
||||||
%span.update-author
|
%span.update-author
|
||||||
%strong= merge_request.author_name
|
%strong= merge_request.author_name
|
||||||
authored
|
authored
|
||||||
|
|
4
app/views/merge_requests/commits.js.haml
Normal file
4
app/views/merge_requests/commits.js.haml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
:plain
|
||||||
|
$(".merge-request-commits").html("#{escape_javascript(render(:partial => "commits"))}");
|
||||||
|
|
||||||
|
|
4
app/views/merge_requests/diffs.js.haml
Normal file
4
app/views/merge_requests/diffs.js.haml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
:plain
|
||||||
|
$(".merge-request-diffs").html("#{escape_javascript(render(:partial => "diffs"))}");
|
||||||
|
|
||||||
|
|
|
@ -1,49 +1,47 @@
|
||||||
.merge-request-show-holder.ui-box.width-100p
|
%div
|
||||||
%h3
|
%span.entity-info
|
||||||
|
- if can?(current_user, :admin_project, @project) || @merge_request.author == current_user
|
||||||
|
= link_to edit_project_merge_request_path(@project, @merge_request) do
|
||||||
|
.entity-button
|
||||||
|
Edit Merge Request
|
||||||
|
%i
|
||||||
|
= image_tag gravatar_icon(@merge_request.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
|
||||||
|
%span.commit-title
|
||||||
|
%strong
|
||||||
= "Merge Request ##{@merge_request.id}:"
|
= "Merge Request ##{@merge_request.id}:"
|
||||||
|
|
||||||
.tag.commit.inline= @merge_request.source_branch
|
.tag.commit.inline= @merge_request.source_branch
|
||||||
→
|
→
|
||||||
.tag.commit.inline= @merge_request.target_branch
|
.tag.commit.inline= @merge_request.target_branch
|
||||||
.right
|
%span.commit-author
|
||||||
- if @merge_request.closed
|
%strong
|
||||||
%span.tag.high Closed
|
= link_to project_team_member_path(@project, @project.users_projects.find(@merge_request.author.id)) do
|
||||||
- else
|
|
||||||
%span.tag.today Open
|
|
||||||
|
|
||||||
.data
|
|
||||||
%p= @merge_request.title
|
|
||||||
|
|
||||||
- if @merge_request.author == @merge_request.assignee
|
|
||||||
= image_tag gravatar_icon(@merge_request.assignee_email), :width => 20, :style => "padding:0 5px;"
|
|
||||||
= @merge_request.assignee_name
|
|
||||||
- else
|
|
||||||
= image_tag gravatar_icon(@merge_request.author_email), :width => 20, :style => "padding:0 5px;"
|
|
||||||
= @merge_request.author_name
|
= @merge_request.author_name
|
||||||
→
|
→
|
||||||
= image_tag gravatar_icon(@merge_request.assignee_email), :width => 20, :style => "padding:0 5px;"
|
= link_to project_team_member_path(@project, @project.users_projects.find(@merge_request.assignee.id)) do
|
||||||
= @merge_request.assignee_name
|
= @merge_request.assignee_name
|
||||||
.right
|
|
||||||
%cite.cgray= @merge_request.created_at.stamp("21 Aug 2011, 11:15pm")
|
|
||||||
.clear
|
|
||||||
|
|
||||||
.buttons
|
|
||||||
- if can? current_user, :write_project, @project
|
|
||||||
- if @merge_request.closed
|
= @merge_request.created_at.stamp("Aug 21, 2011 9:23pm")
|
||||||
= link_to 'Reopen', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => false }, :status_only => true), :method => :put, :class => "grey-button"
|
|
||||||
- else
|
%hr
|
||||||
= link_to 'Close', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => true }, :status_only => true), :method => :put, :class => "grey-button"
|
%h3= @merge_request.title
|
||||||
.right
|
|
||||||
= link_to 'Edit', edit_project_merge_request_path(@project, @merge_request), :class => "grey-button positive"
|
|
||||||
|
|
||||||
.clear
|
.clear
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
|
|
||||||
%ul.merge-tabs
|
.merge-tabs
|
||||||
= link_to "Notes", "#", :class => "merge-notes-tab"
|
= link_to "Notes", "#notes", :class => "merge-notes-tab active"
|
||||||
= link_to "Commits","#", "data-url" => commits_project_merge_request_path(@project, @merge_request), :class => "merge-commits-tab"
|
= link_to "Commits","#commits", "data-url" => commits_project_merge_request_path(@project, @merge_request), :class => "merge-commits-tab"
|
||||||
= link_to "Diff", diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab"
|
= link_to "Diff", "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab"
|
||||||
|
- if can?(current_user, :admin_project, @project) || @merge_request.author == current_user
|
||||||
|
.right
|
||||||
|
- if @merge_request.closed
|
||||||
|
= link_to 'Reopen', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => false }, :status_only => true), :method => :put, :class => "reopen-request"
|
||||||
|
- else
|
||||||
|
= link_to 'Close', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => true }, :status_only => true), :method => :put, :class => "close-request", :title => "Close merge request"
|
||||||
%img{:src => "/assets/ajax-loader-facebook.gif", :class => "dashboard-loader"}
|
%img{:src => "/assets/ajax-loader-facebook.gif", :class => "dashboard-loader"}
|
||||||
|
|
||||||
.merge-request-notes
|
.merge-request-notes
|
||||||
|
@ -53,7 +51,6 @@
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
.merge-request-commits
|
.merge-request-commits
|
||||||
|
|
||||||
.merge-request-diffs
|
.merge-request-diffs
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue