Commit 6f32ccf4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

merge_requests restyle with forms

parent 3a50b6ca
...@@ -555,44 +555,78 @@ h4.middle-panel { ...@@ -555,44 +555,78 @@ h4.middle-panel {
.merge-tabs { .merge-tabs {
margin: 0; margin: 0;
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 10px; padding: 5px;
font-size: 11px; font-size: 12px;
font-weight: bold; text-transform: uppercase;
background: #F7F7F7; background: #F7F7F7;
margin-bottom:20px; margin-bottom:20px;
height:26px;
a { .tab {
margin-right:5px; font-weight: bold;
@include round-borders-all(4px); text-transform: uppercase;
border: 1px solid #ddd; border-right: 1px solid #ddd;
background:none; background:none;
padding: 4px 10px; padding: 10px;
width:160px; width:60px;
float:left;
position:relative;
top:-5px;
left:-5px;
height:16px;
padding-left:34px;
span {
width: 20px;
height: 20px;
display: inline-block;
position: absolute;
left: 8px;
top: 8px;
}
&.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 { .merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; }
@include round-borders-all(4px); .merge-commits-tab span { background: url("images.png") no-repeat -86px 1px; }
padding:2px 4px; .merge-diffs-tab span { background: url("images.png") no-repeat -118px 1px; }
border:1px solid #aaa; .merge-tabs .dashboard-loader { padding:8px; }
text-shadow:none;
background: #44aa22;
color:white;
}
.user-mention { .user-mention {
color: #2FA0BB; color: #2FA0BB;
font-weight: bold; font-weight: bold;
} }
.author {
color: #999;
}
.red-button{
border-radius: 5px;
font-size: 12px;
font-weight: bold;
padding: 5px 17px;
border: 1px solid #999;
color: #666;
display: inline-block;
box-shadow: 0 1px 2px rgba(0,0,0,.3);
background: #D12F19;
color: white;
}
.positive-button{
border-radius: 5px;
font-size: 12px;
font-weight: bold;
padding: 5px 17px;
border: 1px solid #999;
color: #666;
display: inline-block;
box-shadow: 0 1px 2px rgba(0,0,0,.3);
background: #4A2;
color: white;
}
...@@ -130,7 +130,7 @@ table tr:hover, .listed_items tr.odd:hover{background-color:#FFFFCF} ...@@ -130,7 +130,7 @@ table tr:hover, .listed_items tr.odd:hover{background-color:#FFFFCF}
border-radius: 5px; border-radius: 5px;
font-size: 12px; font-size: 12px;
font-weight: bold; font-weight: bold;
padding: 6px 20px; padding: 5px 17px;
border: 1px solid #999; border: 1px solid #999;
color: #666; color: #666;
display: inline-block; display: inline-block;
......
...@@ -90,6 +90,10 @@ class Project < ActiveRecord::Base ...@@ -90,6 +90,10 @@ class Project < ActiveRecord::Base
users_projects.find_by_user_id(user.id) if user users_projects.find_by_user_id(user.id) if user
end end
def team_member_by_id(user_id)
users_projects.find_by_user_id(user_id)
end
def fresh_issues(n) def fresh_issues(n)
issues.includes(:project, :author).order("created_at desc").first(n) issues.includes(:project, :author).order("created_at desc").first(n)
end end
......
%div.merge-request-form-holder = form_for [@project, @merge_request] do |f|
.ui-box.width-100p %div
%h3 %span.entity-info
= @merge_request.new_record? ? "New Merge Request" : "Edit Merge Request ##{@merge_request.id}" - if @merge_request.new_record?
= form_for [@project, @merge_request] do |f| = link_to project_merge_requests_path(@project) do
.data .entity-button
Back
%i
- else
= link_to project_merge_request_path(@project, @merge_request) do
.entity-button
Back
%i
%h2= @merge_request.new_record? ? "New Merge Request" : "Edit Merge Request ##{@merge_request.id}"
%hr
%table.no-borders %table.no-borders
-if @merge_request.errors.any? -if @merge_request.errors.any?
%tr %tr
%td Errors %td{:colspan => 2}
%td
#error_explanation #error_explanation
- @merge_request.errors.full_messages.each do |msg| - @merge_request.errors.full_messages.each do |msg|
%span= msg %span= msg
%br %br
%tr
%td= f.label :title
%td= f.text_field :title
%tr %tr
%td= f.label :source_branch, "From" %td= f.label :source_branch, "From"
%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" }, :style => "width:250px")
%tr %tr
%td= f.label :target_branch, "To" %td= f.label :target_branch, "To"
%td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }) %td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px")
%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" }, :style => "width:250px")
.buttons = f.text_area :title, :style => "width:718px; height:100px", :maxlength => 255
%br
%br
.merge-tabs
= f.submit 'Save', :class => "grey-button" = f.submit 'Save', :class => "grey-button"
&nbsp; &nbsp;
= link_to 'Back', project_merge_requests_path(@project), :class => "grey-button"
- unless @merge_request.new_record? - unless @merge_request.new_record?
.right .right
= link_to 'Remove', [@project, @merge_request], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button" = link_to 'Remove', [@project, @merge_request], :confirm => 'Are you sure?', :method => :delete, :class => "red-button"
:javascript :javascript
......
...@@ -15,33 +15,42 @@ ...@@ -15,33 +15,42 @@
.tag.commit.inline= @merge_request.target_branch .tag.commit.inline= @merge_request.target_branch
%span.commit-author %span.commit-author
%strong %strong
= link_to project_team_member_path(@project, @project.users_projects.find(@merge_request.author.id)) do = link_to project_team_member_path(@project, @project.team_member_by_id(@merge_request.author.id)) do
= @merge_request.author_name %span.author= @merge_request.author_name
&rarr; &rarr;
= link_to project_team_member_path(@project, @project.users_projects.find(@merge_request.assignee.id)) do = link_to project_team_member_path(@project, @project.team_member_by_id(@merge_request.assignee.id)) do
= @merge_request.assignee_name %span.author= @merge_request.assignee_name
&nbsp; &nbsp;
&nbsp; &nbsp;
= @merge_request.created_at.stamp("Aug 21, 2011 9:23pm") = @merge_request.created_at.stamp("Aug 21, 2011 9:23pm")
%hr %hr
%h3= @merge_request.title %br
%h3
= simple_format @merge_request.title
.clear .clear
%br %br
%br %br
.merge-tabs .merge-tabs
= link_to "Notes", "#notes", :class => "merge-notes-tab active" = link_to "#notes", :class => "merge-notes-tab active tab" do
= link_to "Commits","#commits", "data-url" => commits_project_merge_request_path(@project, @merge_request), :class => "merge-commits-tab" %span
= link_to "Diff", "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab" Notes
= link_to "#commits", "data-url" => commits_project_merge_request_path(@project, @merge_request), :class => "merge-commits-tab tab" do
%span
Commits
= link_to "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab tab" do
%span
Diff
- if can?(current_user, :admin_project, @project) || @merge_request.author == current_user - if can?(current_user, :admin_project, @project) || @merge_request.author == current_user
.right .right
- if @merge_request.closed - 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" = link_to 'Reopen', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => false }, :status_only => true), :method => :put, :class => "red-button"
- else - 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" = link_to 'Close', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => true }, :status_only => true), :method => :put, :class => "positive-button", :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
......
...@@ -42,8 +42,8 @@ describe "MergeRequests" do ...@@ -42,8 +42,8 @@ describe "MergeRequests" do
it { should have_content(@merge_request.title) } it { should have_content(@merge_request.title) }
it "Show page should inform user that merge request closed" do it "Show page should inform user that merge request closed" do
within ".merge-request-show-holder h3" do within ".merge-tabs" do
page.should have_content "Closed" page.should have_content "Reopen"
end end
end end
end end
...@@ -62,7 +62,7 @@ describe "MergeRequests" do ...@@ -62,7 +62,7 @@ describe "MergeRequests" do
it { current_path.should == project_merge_request_path(project, project.merge_requests.last) } it { current_path.should == project_merge_request_path(project, project.merge_requests.last) }
it "should create merge request" do it "should create merge request" do
page.should have_content "Open" page.should have_content "Close"
page.should have_content @user.name page.should have_content @user.name
end end
end end
......
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