CSS not applied to resource-related threads

Old Nick

Well-known member
Hello,
I added this code to extra.less template (via the template modification system):
Less:
[data-template="thread_view"],
[data-template="thread_view_type_question"],
[data-template="thread_view_type_suggestion"],
[data-template="thread_view_type_article"],
[data-template="thread_view_type_poll"] {
    .message-name {
        margin-right: 10px;
    }
}
This correctly applies to all thread types except resource-related threads.
 
Solution
The code you have provided should only apply to the thread_view template and nothing else.

Can you repro the issue on a demo so I can take a look.
Back on this...
Knowing that all thread_view_xxx are extensions of the thread_view template, as Resource threads...
HTML:
<xf:extends template="thread_view" />

<xf:extension name="content_top">
    <xf:if is="$resource">
        <xf:set var="$originalH1"><xf:h1 /></xf:set>
        <xf:set var="$originalDescription"><xf:description /></xf:set>

        <xf:h1 hidden="true" />
        <xf:description></xf:description>

        <xf:macro template="xfrm_resource_wrapper_macros" name="header"
            arg-resource="{$resource}"
            arg-titleHtml="{$originalH1}"
            arg-metaHtml="{$originalDescription}" />

        <xf:macro template="xfrm_resource_wrapper_macros" name="tabs"
            arg-resource="{$resource}"
            arg-selected="discussion" />
    </xf:if>
</xf:extension>
...And knowing that the part of code including the message-name class is common to thread_view and xfrm_thread_view_type_resource templates, why the modification does not apply here?

For another add-on I have a template modification that i only apply to thread_view but it also impacts all its variants (poll, suggestion, question, article) because the modification concerns the "common code".

By the way the first code I posted I can change it to
Less:
[data-template="thread_view"],
[data-template="thread_view_type_question"],
[data-template="thread_view_type_suggestion"] {
    .message-name {
        margin-right: 10px;
    }
}
The code will still apply to thread_view_type_article and thread_view_type_poll templates.
 
Last edited:
Thanks Brogan, this will be useful in many cases.

But i would like to understand why this CSS code
Less:
[data-template="thread_view"] {
    .message-name {
        margin-right: 10px;
    }
}
is not applied to xfrm_thread_view_type_resource while it applies to thread_view_type_article ?
I understand why it is not applied to thread_view_type_question and thread_view_type_suggestion because the concerned part code in thread_view is edited in those two template but it is not the case for xfrm_thread_view_type_resource.

If someone can take time to explain me.
Thanks.
 
The code you have provided should only apply to the thread_view template and nothing else.

Can you repro the issue on a demo so I can take a look.
 
Solution
Ok, again I wasted your time, here is my confusion: if I edit the thread_view template, this change will apply to all templates that contains <xf:extends template="thread_view" />. But a modification via extra.less targeting the thread_view template effectively only applies to him and no others.
 
Back
Top Bottom