Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/admin/deposit.js
Show All 32 Lines | depositsTable = $('#swh-admin-deposit-list') | ||||
}, | }, | ||||
{ | { | ||||
data: 'swh_id_context', | data: 'swh_id_context', | ||||
name: 'swh_id_context', | name: 'swh_id_context', | ||||
render: (data, type, row) => { | render: (data, type, row) => { | ||||
if (data && type === 'display') { | if (data && type === 'display') { | ||||
let originPattern = ';origin='; | let originPattern = ';origin='; | ||||
let originPatternIdx = data.indexOf(originPattern); | let originPatternIdx = data.indexOf(originPattern); | ||||
if (originPatternIdx !== -1) { | let visitPattern = ';visit='; | ||||
let originUrl = data.slice(originPatternIdx + originPattern.length); | let visitPatternIdx = data.indexOf(visitPattern); | ||||
if (originPatternIdx !== -1 && visitPatternIds !== -1) { | |||||
let originUrl = data.slice(originPatternIdx + originPattern.length, visitPatternIdx); | |||||
rdicosmo: This is kind of fragile, as it assumes that the visit qualifiers will appear immediately after… | |||||
ardumontAuthorUnsubmitted Done Inline Actionsfragile, indeed. I will adapt accordingly. What'd be even greater is to test this and actually add the relevant tests. ardumont: fragile, indeed.
I like this approach better. Thanks.
I will adapt accordingly.
What'd be… | |||||
return `<a href="${originUrl}">${originUrl}</a>`; | return `<a href="${originUrl}">${originUrl}</a>`; | ||||
} | } | ||||
} | } | ||||
return data; | return data; | ||||
} | } | ||||
}, | }, | ||||
{ | { | ||||
data: 'reception_date', | data: 'reception_date', | ||||
name: 'reception_date', | name: 'reception_date', | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |
This is kind of fragile, as it assumes that the visit qualifiers will appear immediately after the origin qualifier.
It would be better to do something like: