كما ورد في:
ماذا أضع في action، إذا كنت أرغب في تسجيل DButton هناك، والذي ربما يقوم بإجراء كما هو محدد في @action الخاص بـ DButton؟
كما ورد في:
ماذا أضع في action، إذا كنت أرغب في تسجيل DButton هناك، والذي ربما يقوم بإجراء كما هو محدد في @action الخاص بـ DButton؟
انسخ GitHub - discourse/all-the-themes
شغّل ./reset-all-repos
grep -r registerTopicFooterButton
ابحث عن هذه الأمثلة:
official/discourse-custom-topic-button-component/common/head_tag.html: api.registerTopicFooterButton({
official/discourse-quick-whisper/javascripts/discourse/initializers/discourse-quick-whisper.js: api.registerTopicFooterButton({
official/discourse-topic-group-button-component/javascripts/discourse/api-initializers/topic-group-button.js: api.registerTopicFooterButton({
ماذا تريد أن يحدث عندما ينقرون على الزر؟
لنقل، إعادة توجيه المستخدم إلى /about؟
انتظر: هل أضع @action الذي حددته هناك؟ فإذا كان لدي إجراء يسمى redirectUserToAbout، هل أضع action: action(context) { this.redirectUserToAbout() }؟
تعديل: يبدو أن لدينا مثالاً رائعًا هنا:
https://github.com/discourse/discourse-custom-topic-button-component/blob/main/common/head_tag.html