Платформа ЦРНП "Мирокод" для разработки проектов
https://git.mirocod.ru
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
755 B
18 lines
755 B
export function initMarkupTrustProps() { |
|
const renderSearchLink = (trustPropName, trustPropType) => { |
|
const safeName = trustPropName.replace(' ', '+'); |
|
return` <a target="blank" href="/explore/${trustPropType}?tab=&q=${safeName}" rel="nofollow">найти</a>`; |
|
} |
|
|
|
$('.trust-props input[type="checkbox"]').click((e) => { |
|
if (e.target.checked) { |
|
$(e.target).parent().find('a').remove(); |
|
} else { |
|
const $parent = $(e.target).parent(); |
|
const $listContainer = $parent.parents("div.render-content"); |
|
const trustPropType = $listContainer.attr("data-trust-prop-type"); |
|
const renderedSearchLink = renderSearchLink($parent.text(), trustPropType); |
|
$parent.append(renderedSearchLink); |
|
} |
|
}); |
|
}
|
|
|