Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-04 19:51:01 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-04 19:51:01 +0400
commit47937802a2c29f6ec4a1bd15bb06e8e2866fdb7f (patch)
tree0dd60732579e20487be1adb917b406e7f57c59de /app
parentad60701e9e097a046f65048bd4e707da512daa07 (diff)
Add js milestone class. Activate drag-drop for issues on milestone page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee2
-rw-r--r--app/assets/javascripts/milestone.js.coffee40
2 files changed, 42 insertions, 0 deletions
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index b61d9875e03..6518c380bdc 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -21,6 +21,8 @@ class Dispatcher
Issues.init()
when 'projects:issues:show'
new Issue()
+ when 'projects:milestones:show'
+ new Milestone()
when 'projects:issues:new', 'projects:merge_requests:new'
GitLab.GfmAutoComplete.setup()
when 'dashboard:show'
diff --git a/app/assets/javascripts/milestone.js.coffee b/app/assets/javascripts/milestone.js.coffee
new file mode 100644
index 00000000000..bbbaa288b89
--- /dev/null
+++ b/app/assets/javascripts/milestone.js.coffee
@@ -0,0 +1,40 @@
+class Milestone
+ @updateIssue: (li, issue_url, data) ->
+ $.ajax
+ type: "PUT"
+ url: issue_url
+ data: data
+ success: (data) ->
+ if data.saved == true
+ $(li).effect 'highlight'
+ else
+ new Flash("Issue update failed", 'alert')
+ dataType: "json"
+
+ constructor: ->
+ @bindSorting()
+
+ bindSorting: ->
+ $("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed, #issues-list-reopened").sortable(
+ connectWith: ".issues-sortable-list",
+ dropOnEmpty: true,
+ receive: (event, ui) ->
+ new_state = $(this).data('state')
+ issue_id = ui.item.data('iid')
+ issue_url = ui.item.data('url')
+
+ data = switch new_state
+ when 'ongoing'
+ "issue[assignee_id]=" + gon.current_user_id
+ when 'unassigned'
+ "issue[assignee_id]="
+ when 'closed'
+ "issue[state_event]=close"
+ when 'reopened'
+ "issue[state_event]=reopen"
+
+ Milestone.updateIssue(ui.item, issue_url, data)
+
+ ).disableSelection()
+
+@Milestone = Milestone