maaatt
28 בפברואר, 2024, 11:22am
1
I need to do little changes to some views:
Eg:
change the datetime format to extended one (DD/MM/YYY HH:MM)
add a tooltip to long category titles
view long category titles on two rows
Do I need to create a plugin for every change? even if is really small like only css?
Thanks for your help.
לייק 1
merefield
(Robert)
28 בפברואר, 2024, 11:35am
2
No, plugins are only required if you intend to change the back-end.
If it’s just a local change you can go to Admin → Customize → Theme and enter changes into a new Theme Component, then add it to your current Theme.
Take a look at theme developers - Discourse Meta , especially:
So, you want to create Discourse themes? Not sure where to start? Or maybe you have created Discourse themes before, but want to learn how to do even more cool things. Well, you’ve come to the right place
Developer’s guide to Discourse Themes
Subjects include a general overview of Discourse themes, creating and sharing Discourse themes, theme development examples, searching for and finding information / examples in the Discourse repository, and best practices.
Prerequisites:
…
8 לייקים
maaatt
28 בפברואר, 2024, 2:50pm
3
thanks!
So if I need to change a label or add a tooltip I need to create a theme but if I need to add a new column to a page (eg: the topic list) I need to create a plugin?
pfaffman
(Jay Pfaffman)
28 בפברואר, 2024, 5:28pm
5
And a gray area (which doesn’t apply here, I think) is if you need data that is not available (like user custom fields) you could either use AJAX to pull that data with javascript when you need it, or have a plugin that adds the data to the serializer.
5 לייקים
maaatt
1 במרץ, 2024, 3:05pm
6
ok thanks. In the guide I don’t undestand how can I setuo and import a TC locally, there’s only an example for a remote one.
I would suggest using this wonderful tool, to create TC easily locally:
The [discourse] Discourse Theme CLI is a ruby gem that allows you to use your editor of choice when developing Discourse themes and theme components. As you save files the CLI will update the remote theme or component and changes to it will appear live!
Installing
To play with it, make sure you have Ruby 2.5 or up installed.
[image]
If you are on Windows, you have 2 options:
Option 1: Windows Subsystem for Linux .
Windows 10 has access to a full Linux environment, you can use it to install…
2 לייקים
pfaffman
(Jay Pfaffman)
1 במרץ, 2024, 3:31pm
8
Unless you have a very small CSS change, I’d recommend using a remote theme or the CLI tool.
But if you click the “install theme” dialog will allow you to create a theme (or theme component if you do it on the component page)
maaatt
1 במרץ, 2024, 3:34pm
9
inside the category topics list I need to add a new column with the “created_at” column and change the date from “tiny” to extended (eg: DD/MM/YYYY HH:MM)
pfaffman
(Jay Pfaffman)
1 במרץ, 2024, 4:14pm
10
If you want to add new stuff to a template, I would start with GitHub - discourse/discourse-theme-skeleton: Template for Discourse themes , but I don’t know how to go about adding a column there. I guess there’s some javascript magic you could do, but that’s not my wheelhouse.
You know that you can see that information if you mouse-over, right?
Also see Plugin outlet locations theme component , but there’s no plugin outlet there.
2 לייקים
You have these plugin outlets: topic-list-after-columns
and topic-list-header-after
.
pfaffman
(Jay Pfaffman)
1 במרץ, 2024, 4:45pm
12
Good catch. It seemed wrong that there was no outlet there. I guess the theme component just doesn’t show it.
לייק 1
RGJ
(Richard - Communiteq)
1 במרץ, 2024, 5:26pm
13
The plugin outlet locations theme component does not show raw outlets at the moment.
This theme component shows you how to add a column GitHub - discourse/discourse-add-category-column
3 לייקים