Commit 7e41eca3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'milestone-mr-dragging' into 'master'

Milestone merge request dragging

This is part of #1207.
parents 9bd1afd7 336d50d0
...@@ -11,10 +11,23 @@ class Milestone ...@@ -11,10 +11,23 @@ class Milestone
new Flash("Issue update failed", 'alert') new Flash("Issue update failed", 'alert')
dataType: "json" dataType: "json"
@updateMergeRequest: (li, merge_request_url, data) ->
$.ajax
type: "PUT"
url: merge_request_url
data: data
success: (data) ->
if data.saved == true
$(li).effect 'highlight'
else
new Flash("Issue update failed", 'alert')
dataType: "json"
constructor: -> constructor: ->
@bindSorting() @bindIssuesSorting()
@bindMergeRequestSorting()
bindSorting: -> bindIssuesSorting: ->
$("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed").sortable( $("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed").sortable(
connectWith: ".issues-sortable-list", connectWith: ".issues-sortable-list",
dropOnEmpty: true, dropOnEmpty: true,
...@@ -38,4 +51,28 @@ class Milestone ...@@ -38,4 +51,28 @@ class Milestone
).disableSelection() ).disableSelection()
bindMergeRequestSorting: ->
$("#merge_requests-list-unassigned, #merge_requests-list-ongoing, #merge_requests-list-closed").sortable(
connectWith: ".merge_requests-sortable-list",
dropOnEmpty: true,
receive: (event, ui) ->
new_state = $(this).data('state')
merge_request_id = ui.item.data('iid')
merge_request_url = ui.item.data('url')
data = switch new_state
when 'ongoing'
"merge_request[assignee_id]=" + gon.current_user_id
when 'unassigned'
"merge_request[assignee_id]="
when 'closed'
"merge_request[state_event]=close"
if $(ui.sender).data('state') == "closed"
data += "&merge_request[state_event]=reopen"
Milestone.updateMergeRequest(ui.item, merge_request_url, data)
).disableSelection()
@Milestone = Milestone @Milestone = Milestone
%li %li{ class: 'mr-row', 'data-iid' => merge_request.iid, 'data-url' => project_merge_request_path(@project, merge_request) }
= link_to [@project, merge_request] do %span.str-truncated
%span.label.label-info ##{merge_request.iid} = link_to [@project, merge_request] do
– %span.cgray ##{merge_request.iid}
= link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request] = link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request]
.panel.panel-default
.panel-heading= title
%ul{ class: "well-list merge_requests-sortable-list", id: "merge_requests-list-#{id}", "data-state" => id }
- merge_requests.each do |merge_request|
= render 'merge_request', merge_request: merge_request
%li.light Drag and drop available
...@@ -84,18 +84,12 @@ ...@@ -84,18 +84,12 @@
.tab-pane#tab-merge-requests .tab-pane#tab-merge-requests
.row .row
.col-md-6 .col-md-4
.panel.panel-default = render('merge_requests', title: 'Work in progress (open and unassigned)', merge_requests: @merge_requests.opened.unassigned, id: 'unassigned')
.panel-heading Open .col-md-4
%ul.well-list = render('merge_requests', title: 'Assigned (open and assigned)', merge_requests: @merge_requests.opened.assigned, id: 'ongoing')
- @merge_requests.opened.each do |merge_request| .col-md-4
= render 'merge_request', merge_request: merge_request = render('merge_requests', title: 'Declined (closed)', merge_requests: @merge_requests.closed, id: 'closed')
.col-md-6
.panel.panel-default
.panel-heading Closed
%ul.well-list
- @merge_requests.closed.each do |merge_request|
= render 'merge_request', merge_request: merge_request
.tab-pane#tab-participants .tab-pane#tab-participants
%ul.bordered-list %ul.bordered-list
......
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