omppatil
(Om Patil)
28 نوفمبر 2023، 12:34م
1
أهلاً!\nأنا جديد في مجال تطوير إضافات Discourse وأقدر أي مساعدة في إضافة زر تبديل إلى قائمة المشاركات وتنفيذ إجراءاته في الإضافة.
Lilly
(Lillian Louis)
28 نوفمبر 2023، 12:41م
2
مرحباً @omppatil ربما يساعدك هذا المنشور في التوجه الصحيح:
If you want to add a button to the post menu then you’ll need something a little bit different since posts are widgets .
You would need to add something like this to your theme / plugin.
api.addPostMenuButton("my-button", () => {
return {
action: "someAction",
icon: "someIcon",
className: "someClass",
title: "some title",
};
});
The plugin API has a method for adding new buttons that makes this relatively easy.
https://github.com/discourse/discourse/blob/7a2e8d3ead63c7d99e…
أيضًا إذا كنت جديدًا في برمجة إضافات Discourse:
I’ve only just started but here’s my ‘starter for 10’ to get you going:
Read:
these
this
Try and read the code on the simplest, but popular plugins and see if you can understand what they are doing (this is not always easy, especially with the complexity of dealing with multiple files and the sometimes brutal functional brevity of javasctipt, but persevere)
You need to learn:
Lots of Javascript (look no further than @mpj ’s Fun Fun Function excellent & fun (!) videos (thanks man!))
Lots of …
There are a few ‘how to start’ guides for working with Discourse already and a wealth of useful info on meta, but I thought it might help to give an insight to the mental processes of starting from little, if any, prior coding experience to building substantial Discourse plugins.
Discourse is written by experienced developers and has a large codebase. This can feel intimidating. This intimidation factor can be a significant barrier for novice developers. This is a kind of ‘psychological primer’…
إعجابَين (2)
مرحباً!
يمكنك استخدام addPostMenuButton
api.addPostMenuButton('coffee', () => {
return {
action: 'drinkCoffee',
icon: 'coffee',
className: 'hot-coffee',
title: 'coffee.title',
position: 'first' // يمكن أن تكون `first` أو `last` أو `second-last-hidden`
};
});
بعد ذلك، يمكنك إضافة الإجراء الخاص بك بهذه الطريقة:
api.attachWidgetAction("post", "drinkCoffee", function () {
//
}
تعديل: تم الحصول على ليليان :ابتسامة:. ستكون فكرة جيدة أيضًا اتباع الأدلة التي نشرتها ليلي!
3 إعجابات
omppatil
(Om Patil)
28 نوفمبر 2023، 12:53م
4
إذن، ما هو هيكل الملفات الذي يجب تنفيذه، وأين يجب وضع الكود أعلاه؟
Lilly
(Lillian Louis)
28 نوفمبر 2023، 1:26م
5
قراءة المواضيع المرتبطة أعلاه يجب أن تجيب على أسئلتك المتعلقة بالتطوير. من الممكن أن تحقق ما تريده باستخدام مكون سمة بدلاً من إضافة. لذلك، سأضيف هذه أيضًا إلى قائمة القراءة الخاصة بك:
This is a crash course in Discourse theme basics. The target audience is everyone who is not familiar with Discourse themes. If you’ve already used Discourse theme / theme components, this guide is probably not something you need to read.
What are themes and theme components?
A theme or theme component is a set of files packaged together designed to either modify Discourse visually or to add new features.
Let’s start with themes.
Themes
In general, themes are not supposed to be compatible …
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…
أيضًا، من الرابط الأول الذي نشرته:
3 إعجابات
system
(system)
تم إغلاقه في
28 ديسمبر 2023، 1:26م
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.