Browse Source

Исправлен баг, ссылка на поиск доверительных свойств формируется динамически правильно #150

pull/150/head
Artur Galyamov 2 years ago
parent
commit
1ef18757de
  1. 2
      templates/repo/competences/list.tmpl
  2. 2
      templates/repo/resources/list.tmpl
  3. 8
      web_src/js/markup/trust_props.js

2
templates/repo/competences/list.tmpl

@ -3,7 +3,7 @@
{{template "repo/header" .}}
<div class="ui container">
<h1>{{.i18n.Tr "repo.competences"}}</h1>
<div class="render-content markup trust-props" data-can-edit="true">
<div class="render-content markup trust-props" data-can-edit="true" data-trust-prop-type="competences">
{{$.RenderedCompetences | Str2html}}
</div>
<div class="raw-content hide">{{$.TransformedTrustProps}}</div>

2
templates/repo/resources/list.tmpl

@ -3,7 +3,7 @@
{{template "repo/header" .}}
<div class="ui container">
<h1>{{.i18n.Tr "repo.resources"}}</h1>
<div class="render-content markup trust-props" data-can-edit="true">
<div class="render-content markup trust-props" data-can-edit="true" data-trust-prop-type="resources">
{{$.RenderedResources | Str2html}}
</div>
<div class="raw-content hide">{{$.TransformedTrustProps}}</div>

8
web_src/js/markup/trust_props.js

@ -1,7 +1,7 @@
export function initMarkupTrustProps() {
const renderSearchLink = (trustPropName) => {
const renderSearchLink = (trustPropName, trustPropType) => {
const safeName = trustPropName.replace(' ', '+');
return`&nbsp;<a target="blank" href="/explore/competences?tab=&amp;q=${safeName}" rel="nofollow">найти</a>`;
return`&nbsp;<a target="blank" href="/explore/${trustPropType}?tab=&amp;q=${safeName}" rel="nofollow">найти</a>`;
}
$('.trust-props input[type="checkbox"]').click((e) => {
@ -9,7 +9,9 @@ export function initMarkupTrustProps() {
$(e.target).parent().find('a').remove();
} else {
const $parent = $(e.target).parent();
const renderedSearchLink = renderSearchLink($parent.text());
const $listContainer = $parent.parents("div.render-content");
const trustPropType = $listContainer.attr("data-trust-prop-type");
const renderedSearchLink = renderSearchLink($parent.text(), trustPropType);
$parent.append(renderedSearchLink);
}
});

Loading…
Cancel
Save