summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--app/observers/mailer_observer.rb2
-rw-r--r--app/views/merge_requests/_form.html.haml20
-rw-r--r--app/views/merge_requests/edit.html.haml2
-rw-r--r--app/views/merge_requests/new.html.haml2
-rw-r--r--app/views/merge_requests/show/_mr_box.html.haml7
-rw-r--r--spec/models/merge_request_spec.rb1
7 files changed, 22 insertions, 14 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index d3e531f7818..27b8e07dc9a 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -22,7 +22,6 @@ class MergeRequest < ActiveRecord::Base
:should_remove_source_branch
validates_presence_of :project_id
- validates_presence_of :assignee_id
validates_presence_of :author_id
validates_presence_of :source_branch
validates_presence_of :target_branch
@@ -36,6 +35,7 @@ class MergeRequest < ActiveRecord::Base
delegate :name,
:email,
:to => :assignee,
+ :allow_nil => true,
:prefix => true
validates :title,
diff --git a/app/observers/mailer_observer.rb b/app/observers/mailer_observer.rb
index 880fd5026a4..451deccd14f 100644
--- a/app/observers/mailer_observer.rb
+++ b/app/observers/mailer_observer.rb
@@ -43,7 +43,7 @@ class MailerObserver < ActiveRecord::Observer
end
def new_merge_request(merge_request)
- if merge_request.assignee != current_user
+ if merge_request.assignee && merge_request.assignee != current_user
Notify.new_merge_request_email(merge_request.id).deliver
end
end
diff --git a/app/views/merge_requests/_form.html.haml b/app/views/merge_requests/_form.html.haml
index d69faa142d5..4f20a06fd25 100644
--- a/app/views/merge_requests/_form.html.haml
+++ b/app/views/merge_requests/_form.html.haml
@@ -5,7 +5,8 @@
- @merge_request.errors.full_messages.each do |msg|
%li= msg
- %h3.padded.cgray 1. Select Branches
+ %h4.cdark 1. Select Branches
+ %br
.row
.span6
@@ -30,14 +31,21 @@
.bottom_commit
.mr_target_commit
- %h3.padded.cgray 2. Fill info
+ %h4.cdark 2. Fill info
+
.clearfix
- = f.label :assignee_id, "Assign to", :class => "control-label"
- .controls= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px")
+ .main_box
+ .top_box_content
+ = f.label :title do
+ %strong= "Title *"
+ .input= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5
+ .middle_box_content
+ = f.label :assignee_id do
+ %i.icon-user
+ Assign to
+ .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px")
.control-group
- = f.label :title, :class => "control-label"
- .controls= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5
.form-actions
= f.submit 'Save', :class => "btn-primary btn"
diff --git a/app/views/merge_requests/edit.html.haml b/app/views/merge_requests/edit.html.haml
index 9e4f9327cdc..eee148994d7 100644
--- a/app/views/merge_requests/edit.html.haml
+++ b/app/views/merge_requests/edit.html.haml
@@ -1,4 +1,4 @@
-%h3
+%h3.page_title
= "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 efafa45d758..594089995ea 100644
--- a/app/views/merge_requests/new.html.haml
+++ b/app/views/merge_requests/new.html.haml
@@ -1,3 +1,3 @@
-%h3 New Merge Request
+%h3.page_title New Merge Request
%hr
= render 'form'
diff --git a/app/views/merge_requests/show/_mr_box.html.haml b/app/views/merge_requests/show/_mr_box.html.haml
index 3027719d94d..b542dac98e0 100644
--- a/app/views/merge_requests/show/_mr_box.html.haml
+++ b/app/views/merge_requests/show/_mr_box.html.haml
@@ -13,9 +13,10 @@
= image_tag gravatar_icon(@merge_request.author_email), :width => 16, :class => "lil_av"
%strong.author= link_to_merge_request_author(@merge_request)
- %cite.cgray and currently assigned to
- = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av"
- %strong.author= link_to_merge_request_assignee(@merge_request)
+ - if @merge_request.assignee
+ %cite.cgray and currently assigned to
+ = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av"
+ %strong.author= link_to_merge_request_assignee(@merge_request)
- if @merge_request.closed
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 8d750bef5a5..ac986ccebe3 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -13,7 +13,6 @@ describe MergeRequest do
it { should validate_presence_of(:title) }
it { should validate_presence_of(:author_id) }
it { should validate_presence_of(:project_id) }
- it { should validate_presence_of(:assignee_id) }
end
describe "Scope" do