Differential D20409 Diff 48716 webroot/rsrc/js/application/dashboard/behavior-dashboard-move-panels.js
Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/dashboard/behavior-dashboard-move-panels.js
| Show All 27 Lines | function onresponse(response, item, list) { | ||||
| list.unlock(); | list.unlock(); | ||||
| JX.DOM.alterClass(item, 'drag-sending', false); | JX.DOM.alterClass(item, 'drag-sending', false); | ||||
| } | } | ||||
| function ondrop(list, item, after) { | function ondrop(list, item, after) { | ||||
| list.lock(); | list.lock(); | ||||
| JX.DOM.alterClass(item, 'drag-sending', true); | JX.DOM.alterClass(item, 'drag-sending', true); | ||||
| var item_phid = JX.Stratcom.getData(item).objectPHID; | |||||
| var data = { | var data = { | ||||
| objectPHID: item_phid, | panelKey: JX.Stratcom.getData(item).panelKey, | ||||
| columnID: JX.Stratcom.getData(list.getRootNode()).columnID | columnKey: JX.Stratcom.getData(list.getRootNode()).columnKey | ||||
| }; | }; | ||||
| var after_phid = null; | |||||
| var items = finditems(list.getRootNode()); | |||||
| if (after) { | if (after) { | ||||
| after_phid = JX.Stratcom.getData(after).objectPHID; | var after_data = JX.Stratcom.getData(after); | ||||
| data.afterPHID = after_phid; | if (after_data.panelKey) { | ||||
| data.afterKey = after_data.panelKey; | |||||
| } | } | ||||
| var ii; | |||||
| var ii_item; | |||||
| var ii_item_phid; | |||||
| var ii_prev_item_phid = null; | |||||
| var before_phid = null; | |||||
| for (ii = 0; ii < items.length; ii++) { | |||||
| ii_item = items[ii]; | |||||
| ii_item_phid = JX.Stratcom.getData(ii_item).objectPHID; | |||||
| if (ii_item_phid == item_phid) { | |||||
| // skip the item we just dropped | |||||
| continue; | |||||
| } | |||||
| // note this handles when there is no after phid - we are at the top of | |||||
| // the list - quite nicely | |||||
| if (ii_prev_item_phid == after_phid) { | |||||
| before_phid = ii_item_phid; | |||||
| break; | |||||
| } | |||||
| ii_prev_item_phid = ii_item_phid; | |||||
| } | |||||
| if (before_phid) { | |||||
| data.beforePHID = before_phid; | |||||
| } | } | ||||
amckinley: Not sure if you'd consider this a whitespace-only change detection bug or not, since we're just… | |||||
Done Inline ActionsI think the rendering is reasonable -- this is the brace from line 70. The brace on line 47/45 moved in, arguably? How would you expect/prefer this be rendered? epriestley: I think the rendering is reasonable -- this is the brace from line 70. The brace on line 47/45… | |||||
Not Done Inline ActionsOh no, this is fine; I just called it out because I spent a minute scratching my head before I figured out what had happened. amckinley: Oh no, this is fine; I just called it out because I spent a minute scratching my head before I… | |||||
| var workflow = new JX.Workflow(config.moveURI, data) | var workflow = new JX.Workflow(config.moveURI, data) | ||||
| .setHandler(function(response) { | .setHandler(function(response) { | ||||
| onresponse(response, item, list); | onresponse(response, item, list); | ||||
| }); | }); | ||||
| workflow.start(); | workflow.start(); | ||||
| } | } | ||||
| var dashboard_node = JX.$(config.dashboardNodeID); | |||||
| var lists = []; | var lists = []; | ||||
| var ii; | var cols = JX.DOM.scry(dashboard_node, 'div', 'dashboard-column'); | ||||
| var cols = JX.DOM.scry(JX.$(config.dashboardID), 'div', 'dashboard-column'); | |||||
| var col = null; | |||||
| var ii; | |||||
| for (ii = 0; ii < cols.length; ii++) { | for (ii = 0; ii < cols.length; ii++) { | ||||
| col = cols[ii]; | var col = cols[ii]; | ||||
| var list = new JX.DraggableList(itemSigil, col) | var list = new JX.DraggableList(itemSigil, col) | ||||
| .setFindItemsHandler(JX.bind(null, finditems, col)) | .setFindItemsHandler(JX.bind(null, finditems, col)) | ||||
| .setCanDragX(true); | .setCanDragX(true); | ||||
| list.listen('didSend', JX.bind(list, onupdate, col)); | list.listen('didSend', JX.bind(list, onupdate, col)); | ||||
| list.listen('didReceive', JX.bind(list, onupdate, col)); | list.listen('didReceive', JX.bind(list, onupdate, col)); | ||||
| list.listen('didDrop', JX.bind(null, ondrop, list)); | list.listen('didDrop', JX.bind(null, ondrop, list)); | ||||
| lists.push(list); | lists.push(list); | ||||
| markcolempty(col, finditems(col).length === 0); | markcolempty(col, finditems(col).length === 0); | ||||
| } | } | ||||
| for (ii = 0; ii < lists.length; ii++) { | for (ii = 0; ii < lists.length; ii++) { | ||||
| lists[ii].setGroup(lists); | lists[ii].setGroup(lists); | ||||
| } | } | ||||
| }); | }); | ||||
Not sure if you'd consider this a whitespace-only change detection bug or not, since we're just moving the brace from line 70 up.