زر عنوان الموضوع الجديد

:discourse2: ملخص يُضيف زر عنوان موضوع جديد زر “موضوع جديد” مريحًا في رأس جميع الصفحات
:eyeglasses: معاينة معاينة على منشئ سمات Discourse
:hammer_and_wrench: المستودع https://github.com/discourse/discourse-new-topic-button-theme-component
:question: دليل التثبيت كيفية تثبيت سمة أو مكون سمة
:open_book: جديد في سمات Discourse؟ دليل المبتدئين لاستخدام سمات Discourse

تثبيت مكون السمة هذا

الميزات

مكون سمة بسيط لإضافة زر + موضوع جديد إلى الرأس. سيظهر الزر على كل صفحة - حتى داخل المواضيع.

لقطات الشاشة:

سطح المكتب:

الجوال:

الإعدادات:

الاسم الوصف
أيقونة زر موضوع جديد اختر أيقونة للزر. يمكنك استخدام أي اسم لأيقونة مجانية من FontAwesome 6 مثل music أو star.
نص زر موضوع جديد أدخل النص الذي تريد أن يستخدمه الزر. يمكنك أيضًا ترك هذا الحقل فارغًا إذا كنت تريد استخدام أيقونة فقط.
عنوان زر موضوع جديد أدخل العنوان الذي تريد أن يستخدمه الزر. إذا تُرك هذا الحقل فارغًا، فسيكون العنوان هو نفسه نص الزر.
إخفاء الزر الافتراضي إخفاء زر “موضوع جديد” الافتراضي في قوائم المواضيع
إظهار للزوار المجهولين إظهار الزر للزوار غير المسجلين، وجعله يعيد التوجيه إلى تسجيل الدخول عند النقر عليه

:discourse2: مُستضاف لدينا؟ تتوفر مكونات السمات للاستخدام في خططنا القياسية والتجارية والمؤسسية.

57 إعجابًا

Pretty awesome. Now we’re talking!

FYI, we pushed the button yesterday and it was our 2nd biggest day in registrations for the past 30 days. Not sure if it was coincidence or not, but I have a feeling it’s a good way to onboard new users. Will keep an eye on the metrics

(Realizing now it must have been a coincidence, because the button only appears for users who have already logged in. Nonetheless, activity does seem to be higher)

5 إعجابات

Hi,

Is it possible to change the color of the button, but not change the color of all buttons in the site?

If so, which is the css code for the button only?

thanks!

إعجاب واحد (1)

Use this code, changing the color obviously.

#new-create-topic {
    background-color: red;
}
3 إعجابات

Hm, how about showing the new topic button for everyone and make it act like the default Reply-to-topic button, i.e. as the user to login/sign up if they’re not logged in?

In fact, this might be something to consider for the default new topic button too, but I guess this feature would be most effective in this theme component…

4 إعجابات

Inviting every random visitor to create a new topic… will end in tears :sob:

Nothing kills a site quicker than a page full of low-value or gibberish topics.

7 إعجابات

Well, they can’t create that topic unless they sign up. And encouraging people to sign up is obviously a good thing (and is being done by default via the sign-up button and the reply-to-topic button). So I don’t really see why the new topic button should cause any problems.

6 إعجابات

Is it possible to hide the button on mobile but show the floating button?

To hide the button on mobile add

.header-buttons #new-create-topic {
    display:none;
}

in your mobile > CSS tab

The floating button you are referring is the one used on the Material Design Theme component? If so you need to copy and paste the part of CSS relative to the floating button (New Topic Fab) from material-design-stock-theme/desktop/desktop.scss at main · discourse/material-design-stock-theme · GitHub to your mobile > CSS tab (deleting the lines that start with @include [...]).

However your requests are going off topic, it’s better if you open another topic.

4 إعجابات

Thanks, sorry for the offtopicing :slight_smile:

إعجاب واحد (1)

This is good, but it has two drawbacks from my point of view.
First is the location of the button in the top bar. We already have other stuff added to the top bar and this makes it a bit crowded.
Second is the fact it appears on every page, even where it is a bit illogical (eg on my profile page, or the groups list).
The primary use case from my point of view is to make it slightly easier for users not to make off-topic replies when viewing a thread. The place I find it is really needed and useful is when viewing a topic/thread and ideally I would like it to appear both at the top (in line with the topic title) and at the bottom next to the main blue Reply button.
A halfway house would be to show it in the current position but only on /t/xxx pages.
Is this possible?

I don’t want to display it on mobile, how do I do it?

I also want to show it to the unregistered user, clicking the button will ask you to login

Oh. Bummer. I don’t know what “wrong position” means (it seems OK on my test site), but did assume that the button would work, which I see now that it doesn’t. It looks like it’s not as simple as I thought. :frowning_face:

إعجاب واحد (1)

Create a new theme component and add this in the Mobile > CSS tab

.mobile-view #new-create-topic {
    display:none
}
4 إعجابات

good idea - you did it ?

Can someone help me know what CSS to target to get this + New Topic button to look/function exactly as the colorful “Reply” button on my site? (i.e. the standard state, as well as the hover and clicked-on state - active?)

Here’s a visual explanation of what I’d like to do…

change its class to btn-primary ?
(not sure if you can have two btn-primary items on a page)
If you want to have a pure css solution then inspect the styling of the blue primary button (in all its states) and replicate that.

شكرًا لك على هذا المكون @Joe.
يعمل بشكل مثالي مع استثناء بسيط :slight_smile:
على الجوال، لا يزال لدي زران: الزر الجديد والزر الافتراضي + موضوع جديد.

جعلت الزر الافتراضي يختفي عن طريق تغيير تعريف النمط التالي:


الآن يعمل بشكل جيد على أجهزة سطح المكتب وعلى الجوال، ولكن سيكون من الجميل لو قام مكونك بالاهتمام بهذا الأمر. خاصة أنه إذا قام المسؤول بإيقاف تشغيل مكونك لسبب ما، فلن يكون أي زر + موضوع جديد مرئيًا.

4 إعجابات

@Johani لقد قمت بإنشاء طلب دمج يحتوي على التغيير المذكور أعلاه.

هل يمكنك الرجاء الاطلاع عليه؟

إعجابَين (2)

شكرًا لك على المكون! أعتقد أن هناك حالات استخدام جيدة تجعل من المفيد دائمًا وجود خيار إنشاء موضوع جديد في الرأس. لكنني أواجه صعوبة في تفصيل واحد من تفاصيل التنفيذ وأتساءل كيف يتعامل الآخرون مع هذا:

في الوقت الحالي، يعكس المكون التصنيف الذي يتواجد فيه المستخدم ويفتح المحرر مع تعبئة هذا التصنيف مسبقًا. لكنه لا يعكس ما إذا كان المستخدم لديه صلاحية الكتابة في ذلك التصنيف المحدد. لذا، سيتم تعبئة المحرر مسبقًا بهذا التصنيف (على الرغم من أن المستخدم لا يمكنه اختيار هذا التصنيف يدويًا في الظروف العادية)، مما يؤدي إلى حدوث خطأ عند محاولة حفظ الموضوع.

زر “موضوع جديد” الافتراضي يتعامل مع هذه المشكلة من خلال تعطيله في مثل هذه التصنيفات. لكنني أعتقد أن نسخ هذا السلوك قد لا يكون بديهيًا أيضًا، لأن فكرة الزر في الرأس هي توفير وصول عالمي لإنشاء مواضيع جديدة. وبالتالي، سيكون غريبًا إذا كان الزر غير فعال في بعض الأحيان.

ما الذي يمكن اعتباره نهجًا عامًا جيدًا لهذه الحالة؟ أو كيف يتعامل الآخرون الذين يستخدمون هذا المكون مع الأمر؟ هل يجب التخلي عن التعبئة المسبقة تمامًا؟

3 إعجابات