1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-10-24 01:28:52 +02:00
phorge-phorge/webroot/rsrc/js/application/projects/WorkboardCardTemplate.js
epriestley 7d849afd16 Add a "WorkboardCardTemplate" class to make workboard client code easier to reason about
Summary:
Depends on D20266. Boards currently have several `whateverMap<cardPHID => stuff>` properties, but we can just move these all down into a `CardTemplate`, similar to the recently introduced `HeaderTemplate`.

The `CardTemplate` holds all the global information for a card, and then `Card` is specific for a particular copy in a column. Today, each `CardTemplate` has one `Card`, but a `CardTemplate` may have more than one card in the future (when we add subproject columns).

Test Plan: Viewed workboards in different sort orders and dragged stuff around, grepped for all affected symbols.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20267
2019-03-12 13:01:52 -07:00

47 lines
792 B
JavaScript

/**
* @provides javelin-workboard-card-template
* @requires javelin-install
* @javelin
*/
JX.install('WorkboardCardTemplate', {
construct: function(phid) {
this._phid = phid;
this._vectors = {};
this.setObjectProperties({});
},
properties: {
objectProperties: null
},
members: {
_phid: null,
_vectors: null,
getPHID: function() {
return this._phid;
},
setNodeHTMLTemplate: function(html) {
this._html = html;
return this;
},
setSortVector: function(order, vector) {
this._vectors[order] = vector;
return this;
},
getSortVector: function(order) {
return this._vectors[order];
},
newNode: function() {
return JX.$H(this._html).getFragment().firstChild;
}
}
});