Actualmente utilizo el siguiente widget para mostrar un banner/enlace después de la primera publicación de un hilo. Esto funciona bien hasta ahora:
const { iconNode } = require("discourse-common/lib/icon-library");
api.decorateWidget("post:after", helper => {
const firstPost = helper.attrs.firstPost;
const h = helper.h;
if (firstPost) {
return h("div#support", [
h(
'a.icon', {
href:'link',
title: 'Support-Icon'
}, iconNode('heart')),
h(
'a.link', {
href: "link",
title: 'Support-Link'
}, 'some text',
),
]);
}
});
Sin embargo, me gustaría integrar el banner/enlace en un lugar diferente, concretamente antes del botón de respuesta. He marcado la posición en rojo a continuación:
¿Alguien puede darme un consejo sobre cómo realizar esto?
Sé que la posición/trabajo se define por esto. La pregunta es cómo encuentro este NOMBRE:UBICACIÓN:
api.decorateWidget("NOMBRE:UBICACIÓN", helper => {
Moin
12 Enero, 2024 08:17
2
OrkoGrayskull:
La posición que marcaste en la imagen está después de todas las publicaciones del tema. Por lo tanto, cuando haya respuestas, tu banner estaría debajo de estas y no directamente debajo de la primera publicación.
2 Me gusta
piffy
12 Enero, 2024 08:17
3
Hay una salida de plugin allí llamada topic-above-footer-buttons
Esto te ayuda a verlos:
(deprecated) Plugin outlet locations theme component
Luego sigue esta guía:
Discourse includes hundreds of Plugin Outlets which can be used to inject new content or replace existing contend in the Discourse UI. ‘Outlet arguments’ are made available so that content can be customized based on the context.
Choosing an outlet
To find the name of a plugin outlet, search Discourse core for “<PluginOutlet”, or use the plugin outlet locations theme component. (e.g. topic-above-posts).
Wrapper outlets
Some outlets in core look like <PluginOutlet @name="foo" />. These allow you…
4 Me gusta
Gracias. Funcionó.
Ejemplo de código para Head:
<script type='text/x-handlebars' data-template-name='/connectors/topic-footer-main-buttons-before-create/team-support'>
<div id="support">
<a href="link" title="Support-Icon" class="icon">
<svg class="fa d-icon d-icon-heart svg-icon svg-node" aria-hidden="true"><use xlink:href="#heart"></use></svg>
</a>
<a href="link" title="Support-Link" class="link">texto</a>
</div>
</script>
1 me gusta
Lamentablemente, el botón/banner solo se muestra cuando el usuario ha iniciado sesión. ¿Cómo puedo asegurar que el botón/banner también se muestre para los usuarios no registrados?
Estoy usando esta posición del tema: topic-footer-main-buttons-before-create
system
(system)
Cerrado
18 Febrero, 2024 06:56
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.