Ok, I just pushed an update that should fix the icons that weren’t working. I specifically checked it against all three of those icons and they work now. I also made the badge names case-insensitive while I was digging into the code.
Locale support will be #1 priority next time I get a chance to look at this.
This was very confusing to me, because it implies it is searching the list of site badges and not finding it. Tried a hard refresh to get it to find my new badges, etc. Glad it works, but maybe the UI can be changed to make it just a plain text box, rather than doing that non-functional search? I think that would make it less confusing to use.
Is it normal to get a “These local changes will be erased by the update. Are you sure you want to continue?” message when updating a theme component? I’m 99.9% sure I haven’t made any changes, and the git commit info looks like it is stuff related to the update, not to local changes:
diff --git a/discourse-post-badges/about.json b/discourse-post-badges/about.json
new file mode 100644
index 0000000..eb86c4b
--- /dev/null
+++ b/discourse-post-badges/about.json
@@ -0,0 +1,15 @@
+{
+ "name": "Post Badges",
+ "component": true,
+ "license_url": "https://github.com/tshenry/discourse-post-badges/blob/master/LICENSE",
+ "about_url": "https://meta.discourse.org/t/post-badges-component/114722",
+ "authors": null,
+ "theme_version": null,
+ "minimum_discourse_version": null,
+ "maximum_discourse_version": null,
+ "assets": {
+ },
+ "color_schemes": {
+ },
+ "learn_more": "https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966"
+}
\ No newline at end of file
diff --git a/common/common.scss b/discourse-post-badges/common/common.scss
similarity index 100%
rename from common/common.scss
rename to discourse-post-badges/common/common.scss
diff --git a/common/head_tag.html b/discourse-post-badges/common/head_tag.html
similarity index 100%
rename from common/head_tag.html
rename to discourse-post-badges/common/head_tag.html
diff --git a/discourse-post-badges/settings.yml b/discourse-post-badges/settings.yml
new file mode 100644
index 0000000..7e7e250
--- /dev/null
+++ b/discourse-post-badges/settings.yml
@@ -0,0 +1,21 @@
+badges:
+ type: list
+ default: ""
+ description:
+ en: 'Use the name of the badge as it appears on the
+ <a href="/admin/badges">list of badges</a>.
+ Post badges will appear in the order they are
+ added to this setting.'
+badge_link_destination:
+ type: enum
+ default: "user's badge page"
+ choices:
+ - "badge overview page"
+ description:
+ en: "Where a user will be taken when they click on a post badge."
+only_show_highest_trust_level:
+ type: bool
+ default: false
+ description:
+ en: "When including trust level badges (Basic, Member, Regular, Leader),
+ only show the highest trust level a user has earned."
Edited to add: I ran the update and it works fine. So…
The theme setting UI is common to core Discourse, so I can’t do anything to improve that setting in the component itself. It’s definitely something I’d like to see become a little more intuitive, or perhaps even have the ability to dynamically populate a searchable list at some point.
이 코드는 컴포넌트가 업데이트되면 사라질 것임을 알고 있습니다. 따라서 이보다 더 나은 방법이 있는지 궁금합니다. 예를 들어, buildBadge 함수를 어떻게든 오버라이드할 수 있을까요?
배경 정보: 우리는 실제로 포트폴리오가 있는 사용자, 즉 Artwork 카테고리에 최소 한 개의 토픽을 생성한 사용자에게만 이 아이콘을 표시하기를 원합니다. 이는 배지 쿼리를 통해 쉽게 수행할 수 있으며, 이미 사이트에 Post Badges 컴포넌트를 사용 중이므로 합리적인 접근 방식이라고 생각했습니다.
@bartv, 가까운 시일 내에 이 컴포넌트에 대한 개선/리팩토링을 진행하는 것이 좋겠습니다. 오버라이드를 별도의 테마 컴포넌트로 처리할 수 있도록 구조를 재편성하는 방법에 대해 살펴보겠습니다. 언제 진행할지는 아직 정확히 알 수 없지만, 소식이 있을 때 이 토픽을 반드시 업데이트하겠습니다.
현재는 불가능하지만, 다음에 이 컴포넌트를 작업할 때 이 부분을 염두에 두겠습니다.
맞습니다. 아래를 참고하세요:
이 컴포넌트를 업데이트하는 작업을 진행할 때, 이 문제에 대해 더 우아한 해결책을 찾아보겠습니다.