Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/projects/WorkboardColumn.js
Show First 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | redraw: function() { | ||||
if (has_headers) { | if (has_headers) { | ||||
var header_templates = board.getHeaderTemplatesForOrder(order); | var header_templates = board.getHeaderTemplatesForOrder(order); | ||||
for (var k in header_templates) { | for (var k in header_templates) { | ||||
header_keys.push(header_templates[k].getHeaderKey()); | header_keys.push(header_templates[k].getHeaderKey()); | ||||
} | } | ||||
header_keys.reverse(); | header_keys.reverse(); | ||||
} | } | ||||
var header_key; | |||||
var next; | |||||
for (ii = 0; ii < list.length; ii++) { | for (ii = 0; ii < list.length; ii++) { | ||||
var card = list[ii]; | var card = list[ii]; | ||||
// If a column has a "High" priority card and a "Low" priority card, | // If a column has a "High" priority card and a "Low" priority card, | ||||
// we need to add the "Normal" header in between them. This allows | // we need to add the "Normal" header in between them. This allows | ||||
// you to change priority to "Normal" even if there are no "Normal" | // you to change priority to "Normal" even if there are no "Normal" | ||||
// cards in a column. | // cards in a column. | ||||
if (has_headers) { | if (has_headers) { | ||||
var header_key = board.getCardTemplate(card.getPHID()) | header_key = board.getCardTemplate(card.getPHID()) | ||||
.getHeaderKey(order); | .getHeaderKey(order); | ||||
if (!seen_headers[header_key]) { | if (!seen_headers[header_key]) { | ||||
while (header_keys.length) { | while (header_keys.length) { | ||||
var next = header_keys.pop(); | next = header_keys.pop(); | ||||
var header = this.getHeader(next); | var header = this.getHeader(next); | ||||
objects.push(header); | objects.push(header); | ||||
seen_headers[header_key] = true; | seen_headers[header_key] = true; | ||||
if (next === header_key) { | if (next === header_key) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
objects.push(card); | objects.push(card); | ||||
} | } | ||||
// Add any leftover headers at the bottom of the column which don't have | |||||
// any cards in them. In particular, empty columns don't have any cards | |||||
// but should still have headers. | |||||
while (header_keys.length) { | |||||
next = header_keys.pop(); | |||||
if (seen_headers[next]) { | |||||
continue; | |||||
} | |||||
objects.push(this.getHeader(next)); | |||||
} | |||||
this._objects = objects; | this._objects = objects; | ||||
var content = []; | var content = []; | ||||
for (ii = 0; ii < this._objects.length; ii++) { | for (ii = 0; ii < this._objects.length; ii++) { | ||||
var object = this._objects[ii]; | var object = this._objects[ii]; | ||||
var node = object.getNode(); | var node = object.getNode(); | ||||
content.push(node); | content.push(node); | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | _redrawFrame: function() { | ||||
var over_limit = ((limit !== null) && (total_points > limit)); | var over_limit = ((limit !== null) && (total_points > limit)); | ||||
var content_node = this.getPointsContentNode(); | var content_node = this.getPointsContentNode(); | ||||
var points_node = this.getPointsNode(); | var points_node = this.getPointsNode(); | ||||
JX.DOM.setContent(content_node, display_value); | JX.DOM.setContent(content_node, display_value); | ||||
var is_empty = !this.getCardPHIDs().length; | // Only put the "empty" style on the column (which just adds some empty | ||||
// space so it's easier to drop cards into an empty column) if it has no | |||||
// cards and no headers. | |||||
var is_empty = | |||||
(!this.getCardPHIDs().length) && | |||||
(!this._hasColumnHeaders()); | |||||
var panel = JX.DOM.findAbove(this.getRoot(), 'div', 'workpanel'); | var panel = JX.DOM.findAbove(this.getRoot(), 'div', 'workpanel'); | ||||
JX.DOM.alterClass(panel, 'project-panel-empty', is_empty); | JX.DOM.alterClass(panel, 'project-panel-empty', is_empty); | ||||
JX.DOM.alterClass(panel, 'project-panel-over-limit', over_limit); | JX.DOM.alterClass(panel, 'project-panel-over-limit', over_limit); | ||||
var color_map = { | var color_map = { | ||||
'phui-tag-disabled': (total_points === 0), | 'phui-tag-disabled': (total_points === 0), | ||||
'phui-tag-blue': (total_points > 0 && !over_limit), | 'phui-tag-blue': (total_points > 0 && !over_limit), | ||||
'phui-tag-red': (over_limit) | 'phui-tag-red': (over_limit) | ||||
}; | }; | ||||
Show All 10 Lines |