Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
COMPATIBILITY: completely rework Featured Topics and move to Glimmer
- Loading branch information
Showing
10 changed files
with
121 additions
and
157 deletions.
There are no files selected for viewing
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
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,19 @@ | ||
<a href="{{this.href}}" class="tlp-featured-topic {{this.featuredTag}}"> | ||
<div class="featured-details"> | ||
{{preview-unbound this.args.topic.thumbnails currentUser=this.currentUser opts=(hash featured=true)}} | ||
<div class="content"> | ||
<div class="title"> | ||
{{this.args.topic.title}} | ||
</div> | ||
{{#if featuredExcerpt}} | ||
<div class="excerpt"> | ||
{{{this.featuredExcerpt}}} | ||
</div> | ||
{{/if}} | ||
<span class="user"> | ||
{{this.featuredUsername}} | ||
{{avatar this.featuredUser imageSize="small"}} | ||
</span> | ||
</div> | ||
</div> | ||
</a> |
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,37 @@ | ||
import { inject as service } from "@ember/service"; | ||
import { computed } from "@ember/object"; | ||
import Component from '@glimmer/component'; | ||
|
||
export default class TlpFeaturedTopicComponent extends Component { | ||
@service currentUser; | ||
|
||
@computed | ||
get featuredUser() { | ||
return this.args.topic.posters[0].user; | ||
}; | ||
|
||
@computed | ||
get featuredUsername() { | ||
return this.args.topic.posters[0].user.username; | ||
}; | ||
|
||
@computed | ||
get featuredExcerpt() { | ||
return (settings.topic_list_featured_excerpt > 0 && this.args.topic.excerpt) ? this.args.topic.excerpt.slice(0,settings.topic_list_featured_excerpt) : false; | ||
}; | ||
|
||
@computed | ||
get featuredTags() { | ||
return settings.topic_list_featured_images_tag.split('|'); | ||
}; | ||
|
||
@computed('args.topic.tags') | ||
get featuredTag() { | ||
return this.args.topic.tags.filter(tag => this.featuredTags.indexOf(tag) > -1)[0]; | ||
}; | ||
|
||
@computed('args.topic.id') | ||
get href() { | ||
return `/t/${this.args.topic.id}`; | ||
}; | ||
}; |
77 changes: 0 additions & 77 deletions
77
javascripts/discourse/components/tlp-featured-topic.js.es6
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,21 @@ | ||
<div class="tlp-featured-topics {{if this.hasTopics 'has-topics'}}"> | ||
{{#if this.hasTopics}} | ||
{{#if this.showFeaturedTitle}} | ||
<div class="featured-title"> | ||
{{this.featuredTitle}} | ||
</div> | ||
{{/if}} | ||
<div class="topics"> | ||
{{#each this.args.featuredTopics as |t|}} | ||
<TlpFeaturedTopic @topic={{t}}/> | ||
{{/each}} | ||
</div> | ||
{{#if this.showFeaturedTags}} | ||
<div class="featured-tags"> | ||
{{#each this.featuredTags as |tag|}} | ||
{{discourse-tag tag}} | ||
{{/each}} | ||
</div> | ||
{{/if}} | ||
{{/if}} | ||
</div> |
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,41 @@ | ||
import { cookAsync } from 'discourse/lib/text'; | ||
import { computed } from "@ember/object"; | ||
import Component from '@glimmer/component'; | ||
import { tracked } from "@glimmer/tracking"; | ||
import { inject as service } from "@ember/service"; | ||
|
||
export default class TlpFeaturedTopicsComponent extends Component { | ||
@service appEvents; | ||
@tracked featuredTitle = ""; | ||
|
||
constructor() { | ||
super(...arguments); | ||
this.appEvents.trigger('topic:refresh-timeline-position'); | ||
|
||
if (this.showFeaturedTitle) { | ||
const raw = settings.topic_list_featured_title; | ||
cookAsync(raw).then((cooked) => this.featuredTitle = cooked); | ||
} | ||
}; | ||
|
||
@computed | ||
get hasTopics() { | ||
return this.args.featuredTopics.length > 0; | ||
}; | ||
|
||
@computed | ||
get showFeaturedTitle() { | ||
return settings.topic_list_featured_title; | ||
}; | ||
|
||
@computed | ||
get featuredTags() { | ||
return settings.topic_list_featured_images_tag.split('|'); | ||
}; | ||
|
||
@computed | ||
get showFeaturedTags() { | ||
return this.featuredTags && | ||
settings.topic_list_featured_images_tag_show; | ||
}; | ||
}; |
41 changes: 0 additions & 41 deletions
41
javascripts/discourse/components/tlp-featured-topics.js.es6
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
javascripts/discourse/connectors/discovery-list-container-top/featured-topics-discovery.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,5 +1,5 @@ | ||
{{#if showFeaturedImages}} | ||
{{#if featuredTopics}} | ||
{{tlp-featured-topics featuredTopics=featuredTopics}} | ||
<TlpFeaturedTopics @featuredTopics={{featuredTopics}}/> | ||
{{/if}} | ||
{{/if}} | ||
{{/if}} |
17 changes: 0 additions & 17 deletions
17
javascripts/discourse/templates/components/tlp-featured-topic.hbs
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
javascripts/discourse/templates/components/tlp-featured-topics.hbs
This file was deleted.
Oops, something went wrong.