2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-06-04 13:48:07 +02:00
|
|
|
export class ColumnModel {
|
|
|
|
// ToDo: Add validation for all passed-in parameters
|
2015-07-01 10:53:40 +02:00
|
|
|
constructor(transformFn, columnName, displayName, displayType, rowWidth, canBeOrdered, transition, className) {
|
2015-06-04 13:48:07 +02:00
|
|
|
this.transformFn = transformFn;
|
|
|
|
this.columnName = columnName;
|
|
|
|
this.displayName = displayName;
|
|
|
|
this.displayType = displayType;
|
|
|
|
this.rowWidth = rowWidth;
|
|
|
|
this.canBeOrdered = canBeOrdered;
|
|
|
|
this.transition = transition;
|
2015-07-01 10:53:40 +02:00
|
|
|
this.className = className ? className : '';
|
2015-06-04 13:48:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-06-05 11:06:36 +02:00
|
|
|
* If a user opens an editionList of a piece and clicks on a specific edition to go to the
|
2015-06-04 13:48:07 +02:00
|
|
|
* piece detail page, all previously opened editionLists are still saved as show = true in the
|
|
|
|
* pieceList store.
|
|
|
|
*
|
|
|
|
* So if the user now comes back to this view the old data will still be in this store,
|
|
|
|
* since the browser wasn't able to load the new data (only containing show = undefined = false).
|
|
|
|
*
|
|
|
|
* This means that without closing all pieces after a transition, we'll get this flickering of editionLists.
|
|
|
|
*
|
|
|
|
* Since react-router does not implement a callback function for its transitionTo method, we have to do it
|
|
|
|
* our selfes, using this TransitionModel.
|
|
|
|
*/
|
|
|
|
export class TransitionModel {
|
|
|
|
constructor(to, queryKey, valueKey, callback) {
|
|
|
|
this.to = to;
|
|
|
|
this.queryKey = queryKey;
|
|
|
|
this.valueKey = valueKey;
|
|
|
|
this.callback = callback;
|
|
|
|
}
|
2015-06-04 16:07:37 +02:00
|
|
|
|
2015-09-30 18:30:50 +02:00
|
|
|
toReactRouterLink(queryValue) {
|
|
|
|
return '/' + this.to + '/' + queryValue;
|
2015-06-04 16:07:37 +02:00
|
|
|
}
|
2015-06-04 13:48:07 +02:00
|
|
|
}
|