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.
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 https://meta.discourse.org/c/documentation/theme-developers/127 , especially:
Discourse Themes and Theme Components can be used to customize the look, feel and functionality of Discourse’s frontend. This section of the developer guides aims to provide all the reference materials you need to develop simple themes for a single site, right up to complex open-source theme components.
This introduction aims to provide a map of all the tools and APIs for theme development. If you prefer a step-by-step tutorial for theme development, jump straight to:
Themes vs. Theme Compon…
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.
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 …
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 · GitHub , 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.
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.
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 · GitHub