mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Hooked up recent mentions widget
refs https://github.com/TryGhost/Team/issues/2481
This commit is contained in:
parent
f0cf740df5
commit
03593805d5
2 changed files with 23 additions and 18 deletions
|
@ -148,25 +148,28 @@
|
|||
<div class="gh-dashboard-list-title">Time</div>
|
||||
</div>
|
||||
<div class="gh-dashboard-list-body">
|
||||
{{!-- TODO: Switch to LinkTo --}}
|
||||
<a href="#" class="gh-dashboard-list-item permalink">
|
||||
<div class="gh-dashboard-list-item-sub">
|
||||
<img src="https://blog.mozilla.org/wp-content/themes/foxtail/assets/images/favicons/apple-touch-icon.png" alt="Mozilla" class="w5 h5 mr2 flex-shrink-0" />
|
||||
<span class="gh-dashboard-list-text">Mozilla</span>
|
||||
{{#if this.mentions}}
|
||||
{{#each this.mentions as |mention|}}
|
||||
<a href="#" class="gh-dashboard-list-item permalink">
|
||||
<div class="gh-dashboard-list-item-sub">
|
||||
<img src="{{mention.sourceFavicon}}" alt="{{mention.sourceSiteTitle}}" class="w5 h5 mr2 flex-shrink-0" />
|
||||
<span class="gh-dashboard-list-text">{{if mention.sourceSiteTitle mention.sourceSiteTitle mention.source}}</span>
|
||||
</div>
|
||||
<div class="gh-dashboard-list-item-sub">
|
||||
<span class="gh-dashboard-list-subtext gh-dashboard-recent-mentioned">
|
||||
{{mention.target}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="gh-dashboard-list-item-sub gh-dashboard-list gh-dashboard-list-item-date">
|
||||
<span class="gh-dashboard-list-subtext">{{gh-format-post-time mention.timestamp}}</span>
|
||||
</div>
|
||||
</a>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<div class="gh-dashboard-list-empty">
|
||||
<p>No mentions yet.</p>
|
||||
</div>
|
||||
<div class="gh-dashboard-list-item-sub">
|
||||
<span class="gh-dashboard-list-subtext gh-dashboard-recent-mentioned">
|
||||
Norway’s Ambitious Plan to Designate 10 New National Parks
|
||||
</span>
|
||||
</div>
|
||||
<div class="gh-dashboard-list-item-sub gh-dashboard-list gh-dashboard-list-item-date">
|
||||
<span class="gh-dashboard-list-subtext">2 hours ago</span>
|
||||
</div>
|
||||
</a>
|
||||
{{!-- Empty state --}}
|
||||
{{!-- <div class="gh-dashboard-list-empty">
|
||||
<p>No mentions yet.</p>
|
||||
</div> --}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="gh-dashboard-list-footer">
|
||||
<LinkTo @route="posts" @query={{reset-query-params "posts"}}>View all mentions →</LinkTo>
|
||||
|
|
|
@ -9,11 +9,13 @@ export default class Recents extends Component {
|
|||
|
||||
@tracked selected = 'posts';
|
||||
@tracked posts = [];
|
||||
@tracked mentions = [];
|
||||
excludedEventTypes = ['aggregated_click_event'];
|
||||
|
||||
@action
|
||||
async loadPosts() {
|
||||
this.posts = await this.store.query('post', {limit: 5, filter: 'status:[published,sent]', order: 'published_at desc'});
|
||||
this.mentions = await this.store.query('mention', {limit: 5, order: 'created_at desc'});
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
Loading…
Add table
Reference in a new issue