From d81f0b7845ff80d22d4ee2bc41208730ffc14df7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 28 Jan 2012 17:21:00 +0200 Subject: [PATCH] Bootstrap: Merge Request -> Show --- app/models/commit.rb | 2 +- app/views/layouts/_project_side.html.haml | 2 + app/views/merge_requests/_form.html.haml | 63 ++++++++++------------- app/views/merge_requests/edit.html.haml | 3 ++ app/views/merge_requests/new.html.haml | 2 + app/views/merge_requests/show.html.haml | 54 ++++++++++--------- 6 files changed, 64 insertions(+), 62 deletions(-) diff --git a/app/models/commit.rb b/app/models/commit.rb index 01fac4a849c..902ffbc6789 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -27,7 +27,7 @@ class Commit @head = head end - def safe_message + def safe_message() message end diff --git a/app/views/layouts/_project_side.html.haml b/app/views/layouts/_project_side.html.haml index 022425f72c6..b51d2b31fa0 100644 --- a/app/views/layouts/_project_side.html.haml +++ b/app/views/layouts/_project_side.html.haml @@ -13,5 +13,7 @@ Issues = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do Wall + - if @project.common_notes.today.count > 0 + %span.label= @project.common_notes.today.count = link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do Requests diff --git a/app/views/merge_requests/_form.html.haml b/app/views/merge_requests/_form.html.haml index d771661b03b..cab517dc3d5 100644 --- a/app/views/merge_requests/_form.html.haml +++ b/app/views/merge_requests/_form.html.haml @@ -1,46 +1,35 @@ = form_for [@project, @merge_request] do |f| - %div - %span.entity-info - - if @merge_request.new_record? - = link_to project_merge_requests_path(@project) do - .entity-button - Merge Requests - %i - - else - = link_to project_merge_request_path(@project, @merge_request) do - .entity-button - Show Merge Request - %i + -if @merge_request.errors.any? + .alert-message.block-message.error + %ul + - @merge_request.errors.full_messages.each do |msg| + %li= msg - %h2= @merge_request.new_record? ? "New Merge Request" : "Edit Merge Request ##{@merge_request.id}" + .clearfix + = f.label :source_branch, "From" + .input= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") + .clearfix + = f.label :target_branch, "To" + .input= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") + .clearfix + = f.label :assignee_id, "Assign to" + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px") - %hr - %table.no-borders - -if @merge_request.errors.any? - %tr - %td{:colspan => 2} - #error_explanation - - @merge_request.errors.full_messages.each do |msg| - %span= msg - %br - %tr - %td= f.label :source_branch, "From" - %td= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") - %tr - %td= f.label :target_branch, "To" - %td= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") - %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" }, :style => "width:250px") - = f.text_area :title, :style => "width:718px; height:100px", :maxlength => 255 - %br - %br - .merge-tabs - = f.submit 'Save', :class => "positive-button" + .clearfix + = f.label :title + .input= f.text_area :title, :class => "xlarge", :maxlength => 255, :rows => 5 + .actions + = f.submit 'Save', :class => "primary btn" + - if @merge_request.new_record? + = link_to project_merge_requests_path(@project), :class => "btn" do + Cancel + - else + = link_to project_merge_request_path(@project, @merge_request), :class => "btn" do + Cancel   - unless @merge_request.new_record? .right - = link_to 'Remove', [@project, @merge_request], :confirm => 'Are you sure?', :method => :delete, :class => "red-button" + = link_to 'Remove', [@project, @merge_request], :confirm => 'Are you sure?', :method => :delete, :class => "btn danger" diff --git a/app/views/merge_requests/edit.html.haml b/app/views/merge_requests/edit.html.haml index bcc5832792f..9e4f9327cdc 100644 --- a/app/views/merge_requests/edit.html.haml +++ b/app/views/merge_requests/edit.html.haml @@ -1 +1,4 @@ +%h3 + = "Edit merge request #{@merge_request.id}" +%hr = render 'form' diff --git a/app/views/merge_requests/new.html.haml b/app/views/merge_requests/new.html.haml index bcc5832792f..efafa45d758 100644 --- a/app/views/merge_requests/new.html.haml +++ b/app/views/merge_requests/new.html.haml @@ -1 +1,3 @@ +%h3 New Merge Request +%hr = render 'form' diff --git a/app/views/merge_requests/show.html.haml b/app/views/merge_requests/show.html.haml index 5de44518016..ead867f1115 100644 --- a/app/views/merge_requests/show.html.haml +++ b/app/views/merge_requests/show.html.haml @@ -6,28 +6,40 @@ %span.label= @merge_request.target_branch %span.right + - if can?(current_user, :admin_project, @project) || @merge_request.author == current_user + - if @merge_request.closed + = link_to 'Reopen', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => false }, :status_only => true), :method => :put, :class => "btn" + - else + = link_to 'Close', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => true }, :status_only => true), :method => :put, :class => "btn", :title => "Close merge request" - if can?(current_user, :admin_project, @project) || @merge_request.author == current_user = link_to edit_project_merge_request_path(@project, @merge_request), :class => "btn small" do - Edit Merge Request -%hr + Edit -%div - %span.entity-info - = image_tag gravatar_icon(@merge_request.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" - %span.commit-title - %strong - %span.commit-author - %strong - = link_to project_team_member_path(@project, @project.team_member_by_id(@merge_request.author.id)) do - %span.author= @merge_request.author_name - → - = link_to project_team_member_path(@project, @project.team_member_by_id(@merge_request.assignee.id)) do - %span.author= @merge_request.assignee_name - %br - = @merge_request.created_at.stamp("Aug 21, 2011 9:23pm") %hr -.clearfix -%div.well= simple_format @merge_request.title +- if @merge_request.closed + .alert-message.error Closed +- else + .alert-message.success Open + + +%div.well + %div + %span.entity-info + = image_tag gravatar_icon(@merge_request.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" + %span.commit-title + %strong + %span.commit-author + %strong + = link_to project_team_member_path(@project, @project.team_member_by_id(@merge_request.author.id)) do + %span.author= @merge_request.author_name + → + = link_to project_team_member_path(@project, @project.team_member_by_id(@merge_request.assignee.id)) do + %span.author= @merge_request.assignee_name + %br + .cgray= @merge_request.created_at.stamp("Aug 21, 2011 9:23pm") + + + %div= simple_format @merge_request.title .tabs @@ -41,12 +53,6 @@ = link_to "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab tab" do Diff - - 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 => "btn" - - else - = link_to 'Close', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => true }, :status_only => true), :method => :put, :class => "btn", :title => "Close merge request" %img{:src => "/assets/ajax-loader-facebook.gif", :class => "dashboard-loader"} .merge-request-notes