Skip to content

Commit c64cc8e

Browse files
committed
enhancement: Enhance Release tree titles and pass record to Model field convert method (#8402, #8403)
1 parent e0b3f69 commit c64cc8e

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

apps/portal/model/Release.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,19 @@ class Release extends Model {
4141
}, {
4242
// Computed field for TreeList display
4343
name: 'name',
44-
type: 'String'
44+
type: 'html',
45+
/**
46+
* @param {String} value
47+
* @param {Object} record
48+
* @returns {String}
49+
*/
50+
convert(value, record) {
51+
if (record.date) {
52+
return `<b>${value}</b> <span class="release-date">[${new Date(record.date).toLocaleDateString()}]</span>`
53+
}
54+
55+
return value
56+
}
4557
}, {
4658
// Computed field for TreeList id
4759
name: 'id',

resources/scss/src/apps/portal/shared/content/TreeList.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,12 @@
9494
}
9595
}
9696
}
97+
98+
.release-date {
99+
font-size : 90%;
100+
margin-left : 5px;
101+
opacity : 0.8;
102+
position : relative;
103+
top : -1px;
104+
}
97105
}

src/data/RecordFactory.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class RecordFactory extends Base {
317317
}
318318

319319
if (field.convert) {
320-
value = field.convert(value)
320+
value = field.convert(value, record)
321321
}
322322

323323
let fieldName = field.name,

0 commit comments

Comments
 (0)