-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: integration with category banners (#9)
- Loading branch information
1 parent
28fa1c6
commit 87fbe45
Showing
15 changed files
with
152 additions
and
218 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Discourse Theme | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
ci: | ||
uses: discourse/.github/.github/workflows/discourse-theme.yml@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
javascripts/discourse/components/discourse-tag-banners-presentation.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div | ||
class={{concat-class | ||
"tag-title-header" | ||
(concat "tag-banner-" @formattedTagName) | ||
@additionalClass | ||
}} | ||
> | ||
<div class="tag-title-contents"> | ||
<h1> | ||
<span>{{@formattedTagName}}</span> | ||
{{#if @formattedAdditionalTagNames}} | ||
& | ||
{{@formattedAdditionalTagNames}} | ||
{{/if}} | ||
</h1> | ||
{{#unless @isIntersection}} | ||
{{! hide descriptions on tag intersections}} | ||
{{#if (theme-setting "show_tag_description")}} | ||
<p>{{@tag.description}}</p> | ||
{{/if}} | ||
{{/unless}} | ||
</div> | ||
</div> |
5 changes: 5 additions & 0 deletions
5
javascripts/discourse/components/discourse-tag-banners-presentation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Component from "@ember/component"; | ||
|
||
export default class DiscourseTagBannersPresentation extends Component { | ||
tagName = ""; // removing an extra tag that is added by default | ||
} |
10 changes: 10 additions & 0 deletions
10
javascripts/discourse/components/discourse-tag-banners-text-only.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="tag-banner__text-only"> | ||
{{#if (eq this.site.siteSettings.tag_style "simple")}} | ||
{{d-icon "tag"}} | ||
{{/if}} | ||
{{discourse-tag @formattedTagName}} | ||
{{#if @formattedAdditionalTagNames}} | ||
& | ||
{{@formattedAdditionalTagNames}} | ||
{{/if}} | ||
</div> |
5 changes: 5 additions & 0 deletions
5
javascripts/discourse/components/discourse-tag-banners-text-only.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Component from "@ember/component"; | ||
|
||
export default class DiscourseTagBannersTextOnly extends Component { | ||
tagName = ""; // removing an extra tag that is added by default | ||
} |
37 changes: 16 additions & 21 deletions
37
javascripts/discourse/components/discourse-tag-banners.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
{{#if (not (and this.site.mobileView (not (theme-setting "show_on_mobile"))))}} | ||
{{#if (not (and this.site.mobileView (theme-setting "show_on_mobile")))}} | ||
{{#if this.shouldRender}} | ||
<div | ||
class="tag-banner-container" | ||
{{did-insert this.getTagInfo}} | ||
{{did-update this.getTagInfo this.shouldRender}} | ||
{{will-destroy this.resetTag}} | ||
class={{concat-class | ||
"tag-title-header" | ||
(concat "tag-banner-" this.formattedTagName) | ||
this.additionalClass | ||
}} | ||
> | ||
<div class="tag-title-contents"> | ||
<h1> | ||
<span>{{this.formattedTagName}}</span> | ||
{{#if this.formattedAdditionalTagNames}} | ||
& | ||
{{this.formattedAdditionalTagNames}} | ||
{{/if}} | ||
</h1> | ||
{{#unless this.isIntersection}} | ||
{{! hide descriptions on tag intersections}} | ||
{{#if (theme-setting "show_tag_description")}} | ||
<p>{{this.tag.description}}</p> | ||
{{/if}} | ||
{{/unless}} | ||
</div> | ||
{{#if this.categoryBannerPresence.isPresent}} | ||
<DiscourseTagBannersTextOnly | ||
@formattedTagName={{this.formattedTagName}} | ||
@formattedAdditionalTagNames={{this.formattedAdditionalTagNames}} | ||
/> | ||
{{else}} | ||
<DiscourseTagBannersPresentation | ||
@formattedTagName={{this.formattedTagName}} | ||
@formattedAdditionalTagNames={{this.formattedAdditionalTagNames}} | ||
@isIntersection={{this.isIntersection}} | ||
@tag={{this.tag}} | ||
@additionalClass={{this.additionalClass}} | ||
/> | ||
{{/if}} | ||
</div> | ||
{{/if}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
javascripts/discourse/connectors/above-site-header/tag-header-widget.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{{#if (theme-setting "show_above_site_header")}} | ||
<DiscourseTagBanners /> | ||
{{#unless this.categoryBannerPresence.isPresent}} | ||
<DiscourseTagBanners /> | ||
{{/unless}} | ||
{{/if}} |
16 changes: 16 additions & 0 deletions
16
javascripts/discourse/connectors/above-site-header/tag-header-widget.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Component from "@ember/component"; | ||
import { tracked } from "@glimmer/tracking"; | ||
import { getOwner } from "discourse-common/lib/get-owner"; | ||
|
||
export default class extends Component { | ||
@tracked categoryBannerPresence = null; | ||
|
||
constructor() { | ||
super(...arguments); | ||
|
||
// this prevents a failure if the category banner component is not installed | ||
this.categoryBannerPresence = getOwner(this).lookup( | ||
"service:categoryBannerPresence" | ||
); | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
javascripts/discourse/connectors/below-site-header/tag-header-widget.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{{#if (theme-setting "show_below_site_header")}} | ||
<DiscourseTagBanners /> | ||
{{#unless this.categoryBannerPresence.isPresent}} | ||
<DiscourseTagBanners /> | ||
{{/unless}} | ||
{{/if}} |
Oops, something went wrong.