I want to create a new th in the topic table <topic-list.ember-view> in the thead class . Can anyone tell me how can I do this.
Lhc_fl
(Linca)
September 26, 2023, 6:24am
2
You need to have some prior knowledge of handlebars. Then, go through the source code of discourse and find the corresponding path.
Then create a new file with the same name in your theme component according to the path to overwrite it, just like the example below
<td class="topic-list-data">
{{~raw-plugin-outlet name="topic-list-before-columns"}}
<div class='pull-left topic-list-avatar'>
{{#if bulkSelectEnabled}}
<label for="bulk-select-{{topic.id}}">
<input type="checkbox" class="bulk-select" id="bulk-select-{{topic.id}}">
</label>
{{else}}
{{!-- updated to show OP avatar --}}
<a href="{{topic.firstPostUrl}}" data-user-card="{{topic.creator.username}}">{{avatar topic.creator imageSize="large"}}</a>
{{/if}}
</div>
<div class='right topic-list-content'>
{{!--
The `~` syntax strip spaces between the elements, making it produce
`<a class=topic-post-badges>Some text</a><span class=topic-post-badges>`,
with no space between them.
This causes the topic-post-badge to be considered the same word as "text"
at the end of the link, preventing it from line wrapping onto its own line.
--}}
This file has been truncated. show original
5 Likes
Jagster
(Jakke Lehtonen)
September 26, 2023, 7:38am
4
Why not It is a valid answer AFAIK.
Lilly
September 26, 2023, 8:12am
5
That is unfortunate because it is the correct answer and @Lhc_fl is very helpful.
What part don’t you understand? What you are a asking is not necessarily an easy change to make for someone who is not familiar with Discourse development using handlebars templates.
hawm
(Hawm)
September 26, 2023, 9:10am
6
Or using the raw plugin outlet?
A quick question on this.
I noticed something interesting in TLT:
There is no passing of the model here.
Yet you manage to do this:
I can only assume this is a stable strategy for passing down the model properties because it’s being employed here - any caveats?
One of the reasons I was finding these available plugin outlets less useful was because they don’t often explicitly pass down the relevant model.
Is this pattern documented anywhere? I haven’t seen it in the Ember guides …
Welcome! sorry this wasn’t answered earlier, but hopefully this will help someone…
To use a raw plugin outlet you need to create an hbr file, like this:
/connectors/topic-list-before-status/my-content.hbr
If you’re adding static HTML you can add it within that file.
If you want to some custom logic, you can use this structure:
/raw-views/my-object.js
/templates/my-object.hbr
and within your /connectors/topic-list-before-status/my-content.hbr file you’d add:
{{my-object}}
Canapin
(Coin-coin le Canapin)
September 26, 2023, 10:10am
7
It feels to me that “this is not helpful” means here “I don’t know how to do that”.
Please read our official guide: Beginner's guide to developing Discourse Themes .
There are several ways to overrides templates (which is a solution for which you are trying to achieve). One is described in this section: https://meta.discourse.org/t/beginners-guide-to-developing-discourse-themes/93648#overriding-discourse-templates-23
3 Likes
I want to get the data from the <post_replies> table. and use it in the button which is present in the < topic-list-table> for every row it will different posts so according to the post id it will retrive the last reply and when click on the button present in the table it will paste the last reply in the container.
pfaffman
(Jay Pfaffman)
September 30, 2023, 12:25pm
9
I still don’t know what you want to happen. Maybe say what you want to happen without describing anything about how to do it.
2 Likes