Skip to content

Commit

Permalink
fix(ui): fix favoriteLinkTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
miniJoker committed Mar 20, 2024
1 parent de7264e commit 546314f
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions ontology/generic-function/templates/v-s_FavoriteLinkTemplate.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import IndividualModel from '/js/common/individual_model.js';

export const pre = function (individual, template, container, mode, extra) {
export const pre = async function (individual, template, container, mode, extra) {

const subscriptionPath = individual.hasValue('v-s:subscriptionPath') ? individual['v-s:subscriptionPath'][0] : '/';

try {
template.querySelector('a.label-template').setAttribute('href', `${subscriptionPath}#/@`);
if (!individual.hasValue('rdfs:label')) {
const spanLabel = template.querySelector('#label');
spanLabel.removeAttribute('about');
spanLabel.removeAttribute('property');
spanLabel.textContent = individual.id;
template.querySelector('a.label-template').setAttribute('href', `${subscriptionPath}#/@`);
if (individual.hasValue('v-s:onDocument')) {
try {
const doc = await individual['v-s:onDocument'][0].load();
if (!doc.hasValue('rdfs:label')) {
const spanLabel = template.querySelector('#label');
spanLabel.removeAttribute('about');
spanLabel.removeAttribute('property');
spanLabel.textContent = individual.id;
}
} catch (error) {
console.log(error);
alert('Ошибка загрузки объекта: ' + error.message);
}
} catch (exp) {
console.log(exp);
alert('123');
}

};

export const html = `
Expand Down

0 comments on commit 546314f

Please sign in to comment.