I guess best behaviour would be to start the composer with empty category if the user does not have the permission to create new topic in the current one? Potentially with a modal and a notice about such.
私もこの機能が欲しかったので、リポジトリをフォークして、「新規トピック」ボタンを匿名ユーザーとログイン済みユーザーの両方に表示されるようにしました。匿名ユーザーがボタンをクリックすると、ログイン/サインアップモーダルにリダイレクトされます。
クラス名が古くなっているため、スタイルが意図したとおりに表示されません。それらを更新するためのプルリクエストを追加しました: FIX: update declarations by nolosb · Pull Request #6 · discourse/discourse-new-topic-button-theme-component · GitHub
このプラグインを新バージョンにアップデートすることは可能ですか?
このコンポーネントのリファクタリングをマージしました。これにより、次の更新に対応できるようになります: Upcoming Header Changes - Preparing Themes and Plugins
コンポーネントは、以前と同様に機能するはずですが、いくつかの小さな機能強化が加えられています(下書き状態を反映し、現在のカテゴリとタグの権限に反応するようになります)。新しい問題に気づいた場合はお知らせください。
私もこの機能が欲しかったので、リポジトリをフォークして、匿名ユーザーとログイン済みユーザーの両方に「新規トピック」ボタンが表示されるようにしました。匿名ユーザーがボタンをクリックすると、ログイン/サインアップモーダルにリダイレクトされます。
この機能を実現するため、新しい show_to_anon 設定(デフォルトでは無効)を追加しました。
「nolo’s dropdown wizard component」(https://github.com/nolosb/discourse-wizards-dropdown-button.git)のようなドロップダウンメニューを追加することは、どの程度「実現可能」でしょうか?
カスタムウィザードを使用して特定のカテゴリに新しいトピックを作成しているため、基本的にそれらをドロップダウンメニューにリンクしたいと考えています。さらに、ボタンに「新しいカテゴリ」や「新しいグループ」などのスタッフ専用リンクも追加したいと考えています。
こんにちは、「Font Awesome Free」の「pencil」アイコンを「SVG アイコンサブセット」設定に追加した後でも、このコンポーネントで使用できないのですが、何か原因はわかりますか?
“pencil” fontawesome free icon
v5には無料のpencilアイコンはないと思います
We’re not on Font Awesome 6 yet, so you’ll need to search the version 5 set for available icons here: Find the Perfect Icon for Your Project in Font Awesome 5 | Font Awesome It looks like that icon was renamed shop in version 6, but it did exist in version 5 with a different name: store-alt. So if you update additional icons and custom tab icon to use store-alt it should work!
v5のpencilもpencil-altと同じだと思います
v5の鉛筆も同様に
pencil-altだと思います
ありがとうございます!動作しました!
投稿が新しいトピックに分割されました: No New Topic button
リクエスト:ライトテーマとダークテーマの両方で、ボタンの色(背景、テキスト+アイコン)を定義するオプションを追加してください。新しいトピックはコミュニティの成長の一部であるため、色付きのボタンはよりインパクトがあります。
ありがとうございます
CSSを使えば簡単にできます。
Use this code, changing the color obviously. #new-create-topic { background-color: red; }
(CSSでダークテーマとライトテーマを対象にできます)
編集:適切な例を追加します
#new-create-topic {
background-color: light-dark(red,green);
}
これにより、ライトテーマではボタンの色が赤に、ダークテーマでは緑になります。
Discourse の CSS にはまだ慣れていません。CSS 自体は知っていますが、Discourse の中で CSS を探求したことはありません。
これをどこに追加すればよいですか?
これは、複雑さを増やすことを避けるための機能になり得ると、私はまだ考えています。CSS に全く慣れていない人にとっては、コンポーネントをより簡単にカスタマイズできるようになります。
ボタンとテキストでは :hover をテストしましたが、アイコンでは、アイコン自体にカーソルを合わせない限り機能しません。マウスがアイコンの上にない場合でも、ボタンのホバー時にアイコンをターゲットにする方法を知っていますか?
#new-create-topic:hover {
background-color: light-dark(red,red);
color: light-dark(red,white);
}
#new-create-topic .d-icon:hover {
color: light-dark(red,white);
}
Your 2nd rule means that you’re targeting the icon when you hover the icon, not the button.
Using the SCSS syntax, which
#new-create-topic:hover {
background-color: light-dark(red,red);
color: light-dark(red,white);
}
#new-create-topic:hover .d-icon {
color: light-dark(red,white);
}
(also there’s no need for light-dark(red,red); if you use the same color for light and dark)
I'd recommend SCSS since it’s easier to tidy up our nifty code, but that's something new to learn 😄
#new-create-topic:hover {
background-color: light-dark(red,red);
.d-icon, & {
color: light-dark(red,white);
}
}
あなたの2番目のルールは、ボタンではなく、アイコンにホバーしていることを意味します。
おっしゃる通りです。私のミスです…ありがとうございます!
また、ライトとダークで同じ色を使用する場合、
light-dark(red,red);は不要です。
これらは単なるテストです。実際にはデフォルトのテーマを使用しており、そのテーマに両方のオプションがあるかどうかはわかりません。
SCSSについては、数年前に学習しましたが、開発者ではないため、実際に使用したことはありませんでした。HTMLとCSSはかなり頻繁に使用するため、これら2つにはもう少し慣れています。
この変更を行うためのコードを見つけましたが、これが最善の方法かどうかはわかりません。
<script type="text/discourse-plugin" version="0.8">
api.onPageChange(() => {
const newTopicButton = document.querySelector('.header-create-topic');
const draftsButton = document.querySelector('.topic-drafts-menu-trigger');
if (newTopicButton && draftsButton && !document.querySelector('.fk-header-buttons')) {
const wrapper = document.createElement('div');
wrapper.className = 'fk-header-buttons';
const parent = newTopicButton.parentNode;
parent.insertBefore(wrapper, newTopicButton);
wrapper.appendChild(newTopicButton);
wrapper.appendChild(draftsButton);
}
});
</script>

