2019-02-12 09:08:37 +01:00
|
|
|
let CellDefault = pillar.vuecomponents.table.cells.renderer.CellDefault;
|
|
|
|
|
|
|
|
const TEMPLATE =`
|
|
|
|
<div>
|
|
|
|
<a
|
|
|
|
v-if="rawCellValue"
|
2019-03-13 13:53:40 +01:00
|
|
|
@click="onClick"
|
2019-02-12 09:08:37 +01:00
|
|
|
:href="cellLink"
|
|
|
|
>
|
|
|
|
{{ cellValue }}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
|
|
|
|
let ParentNameCell = Vue.component('pillar-cell-parent-name', {
|
|
|
|
extends: CellDefault,
|
|
|
|
template: TEMPLATE,
|
|
|
|
computed: {
|
|
|
|
cellTitle() {
|
|
|
|
return this.rawCellValue;
|
|
|
|
},
|
|
|
|
cellLink() {
|
|
|
|
let project_url = ProjectUtils.projectUrl();
|
|
|
|
let item_type = this.itemType();
|
|
|
|
return `/attract/${project_url}/${item_type}s/${this.rowObject.getParent()._id}`;
|
|
|
|
},
|
|
|
|
embededLink() {
|
|
|
|
return this.cellLink;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2019-03-13 13:53:40 +01:00
|
|
|
onClick(event) {
|
|
|
|
event.preventDefault(); // Don't follow link, but let event bubble and the row will handle it
|
2019-02-12 09:08:37 +01:00
|
|
|
},
|
|
|
|
itemType() {
|
|
|
|
let node_type = this.rowObject.getParent().node_type;
|
2019-03-13 13:53:40 +01:00
|
|
|
return node_type.replace('attract_', ''); // eg. attract_task to task
|
2019-02-12 09:08:37 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export { ParentNameCell }
|