summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-18 16:24:19 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-18 16:24:27 +0200
commit702128892b5edd093e8671527fb9860d3631f5eb (patch)
tree9c3b623e967fb80162368d6361e9466723f701aa /app
parentb05a67f4e3fdf94477539d61bff6d74337d2ddef (diff)
downloadgitlab-ce-702128892b5edd093e8671527fb9860d3631f5eb.tar.gz
Allow change assignee/milestone from MergeRequest show page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/merge_requests_controller.rb9
-rw-r--r--app/views/projects/issues/_issue_context.html.haml2
-rw-r--r--app/views/projects/merge_requests/show/_context.html.haml23
-rw-r--r--app/views/projects/merge_requests/show/_mr_box.html.haml10
-rw-r--r--app/views/projects/merge_requests/update.js.haml2
5 files changed, 35 insertions, 11 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index d36b5b27e86..e3a0699ef3f 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -108,8 +108,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id))
@merge_request.reload_code
@merge_request.mark_as_unchecked
+
@merge_request.reset_events_cache
- redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully updated.'
+
+ respond_to do |format|
+ format.js
+ format.html do
+ redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully updated.'
+ end
+ end
else
render "edit"
end
diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml
index fb124a8ab44..e5418c25b23 100644
--- a/app/views/projects/issues/_issue_context.html.haml
+++ b/app/views/projects/issues/_issue_context.html.haml
@@ -4,7 +4,7 @@
\ and currently assigned to
- if can?(current_user, :modify_issue, @issue)
- = project_users_select_tag('issue[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @issue.assignee_id)
+ = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @issue.assignee_id)
- elsif issue.assignee
= link_to_member(@project, @issue.assignee)
diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml
new file mode 100644
index 00000000000..705eeb9894a
--- /dev/null
+++ b/app/views/projects/merge_requests/show/_context.html.haml
@@ -0,0 +1,23 @@
+= form_for [@project, @merge_request], remote: true, html: {class: 'edit-merge_request inline-update'} do |f|
+ Created by #{link_to_member(@project, merge_request.author)}&nbsp;
+ - if merge_request.assignee
+ \ and currently assigned to
+
+ - if can?(current_user, :modify_merge_request, @merge_request)
+ = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @merge_request.assignee_id)
+ - elsif merge_request.assignee
+ = link_to_member(@project, @merge_request.assignee)
+
+
+ .pull-right.hidden-sm.hidden-xs
+ - if merge_request.milestone
+ - milestone = merge_request.milestone
+ %cite.cgray Attached to milestone
+
+ - if can?(current_user, :modify_merge_request, @merge_request)
+ = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'})
+
+ = hidden_field_tag :merge_request_context
+ = f.submit class: 'btn'
+ - elsif merge_request.milestone
+ = link_to merge_request.milestone.title, project_milestone_path
diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml
index b4f648ab197..7c3f9b93444 100644
--- a/app/views/projects/merge_requests/show/_mr_box.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_box.html.haml
@@ -4,15 +4,7 @@
.context
%cite.cgray
- Created by #{link_to_member(@project, @merge_request.author)}.
- - if @merge_request.assignee
- Currently assigned to #{link_to_member(@project, @merge_request.assignee)}.
- - if @merge_request.milestone
- .pull-right
- - milestone = @merge_request.milestone
- %cite.cgray Attached to milestone
- %strong= link_to_gfm truncate(milestone.title, length: 20), project_milestone_path(milestone.project, milestone)
-
+ = render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request }
- if @merge_request.description.present?
.description
diff --git a/app/views/projects/merge_requests/update.js.haml b/app/views/projects/merge_requests/update.js.haml
new file mode 100644
index 00000000000..6452cc6382d
--- /dev/null
+++ b/app/views/projects/merge_requests/update.js.haml
@@ -0,0 +1,2 @@
+- if params[:merge_request_context]
+ $('.issue-box .context').effect('highlight');