Skip to content

Commit

Permalink
added the ability to view articles per group
Browse files Browse the repository at this point in the history
  • Loading branch information
DrumsnChocolate committed Nov 14, 2023
1 parent 2dccf1a commit a4e0fb2
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 41 deletions.
44 changes: 22 additions & 22 deletions app/components/cards/article-card.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<article
class='article-card {{if useMaxHeight "d-flex"}}'
class='article-card {{if @useMaxHeight "d-flex"}}'
itemscope
itemtype='https://schema.org/Article'
>
Expand All @@ -8,54 +8,54 @@
<img
itemprop='image'
class='card-img-top'
src={{article.coverPhotoUrlOrDefault}}
src={{@article.coverPhotoUrlOrDefault}}
/>

<div class='card-title-bar gradient-overlay'>
<div class='hidden-xs-down'>
<img
src='{{article.avatarThumbUrlOrDefault}}'
src='{{@article.avatarThumbUrlOrDefault}}'
class='profile-picture-medium profile-picture-margin'
alt='{{article.authorName}}'
alt='{{@article.authorName}}'
height='60px'
style='display: inline;'
/>
</div>

{{@title}}
<div class='card-titles'>
<LinkTo @route='articles.article' @model={{article.id}}>
<LinkTo @route='articles.article' @model={{@article.id}}>
<h2 class='card-title' itemprop='name headline'>
{{#if article.pinned}}<FaIcon @icon='thumbtack' />{{/if}}
{{article.title}}
{{#if @article.pinned}}<FaIcon @icon='thumbtack' />{{/if}}
{{this.args.article.title}}

Check failure on line 29 in app/components/cards/article-card.hbs

View workflow job for this annotation

GitHub Actions / Lint

Component templates should avoid "this.args.article.title" usage, try "@article.title" instead.
</h2>
</LinkTo>
<h3 class='card-subtitle'>
{{#if article.group}}
{{#if @article.group}}
<LinkTo
@route='groups.group'
@model={{article.group.id}}
@model={{@article.group.id}}
class='link-to card-subtitle-link'
>
<span
itemprop='author'
itemscope
itemtype='https://schema.org/Person'
>
<span itemprop='name'>{{article.authorName}}</span>
<span itemprop='name'>{{@article.authorName}}</span>
</span>
</LinkTo>
{{else}}
<LinkTo
@route='users.user'
@model={{article.author.id}}
@model={{@article.author.id}}
class='link-to card-subtitle-link'
>
<span
itemprop='author'
itemscope
itemtype='https://schema.org/Person'
>
<span itemprop='name'>{{article.authorName}}</span>
<span itemprop='name'>{{@article.authorName}}</span>
</span>
</LinkTo>
{{/if}}
Expand All @@ -66,18 +66,18 @@

<div class='card-body'>
<p class='card-text' itemprop='articleBody'>
{{#if showExcerpt}}
{{clean-markdown article.excerpt}}
{{#if @showExcerpt}}
{{clean-markdown @article.excerpt}}
{{else}}
{{markdown-to-html
article.contentCamofied
@article.contentCamofied
extensions='youtubeEmbed bootstrapTable'
}}
{{/if}}
</p>
<meta
itemprop='dateModified'
content={{moment-format article.updatedAt}}
content={{moment-format @article.updatedAt}}
/>
<meta
itemprop='publisher'
Expand All @@ -90,18 +90,18 @@
<div class='card-footer'>
<span
itemprop='datePublished'
content={{moment-format article.createdAt}}
content={{moment-format @article.createdAt}}
>
{{moment-calendar article.createdAt}}
{{moment-calendar @article.createdAt}}
</span>
<span>
{{t
'component.cards.articleCard.reactions'
count=article.amountOfComments
count=@article.amountOfComments
}}
</span>
{{#if useMaxHeight}}
<LinkTo @route='articles.article' @model={{article.id}} itemprop='url'>
{{#if @useMaxHeight}}
<LinkTo @route='articles.article' @model={{@article.id}} itemprop='url'>
<span class='float-md-end'> {{t 'tag.button.readMore'}} </span>
</LinkTo>
{{/if}}
Expand Down
14 changes: 0 additions & 14 deletions app/components/cards/article-card.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/controllers/application/group-memberships.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default class GroupMembershipsController extends Controller {
currentMembershipsTab = 'currentMemberships';
oldMembershipsTab = 'oldMemberships';
@tracked sortedAttribute = null;
@tracked filterableAttributes = null;
@tracked sortedAscending = true;

@tracked filter = '';
@tracked selectedTab = this.currentMembershipsTab;

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/groups/group/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

export default class GroupIndexController extends GroupMembershipsController {
@tracked sortedAttribute = 'user.firstName';

Check failure on line 6 in app/controllers/groups/group/index.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `⏎`
@tracked sortedAttribute = 'user.firstName';
filterableAttributes = ['user.username', 'user.fullName', 'function'];
sortableAttributes = [
{
Expand Down
4 changes: 2 additions & 2 deletions app/templates/articles/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
</EmberWormhole>

<div class='row'>
{{#each model as |article|}}
{{#each @model as |article|}}
<div class='article-col col-md-6'>
<LinkTo @route='articles.article' @model={{article.id}}>
{{cards/article-card article showExcerpt=true useMaxHeight=true}}
<Cards::ArticleCard @article={{article}} @showExcerpt={{true}} @useMaxHeight={{true}}/>
</LinkTo>
</div>
{{/each}}
Expand Down
31 changes: 30 additions & 1 deletion app/templates/groups/group/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</div>
</div>
<div class='card-body'>
<div class='row userlist'>
<div class='row'>
{{#each filteredModels as |membership|}}
<LinkTo
@route='users.user'
Expand Down Expand Up @@ -116,6 +116,35 @@
</div>
{{/if}}

{{#if (and (can 'show articles') @model.articles)}}
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col">
<h5>Artikelen gepubliceerd door {{@model.name}}</h5>
</div>
</div>
</div>
<div class="card-body">
<div class="row">
{{#each @model.articles as |article|}}
<LinkTo
@route='articles.article'
@model="{{article.id}}"
class="col-6 col-sm-4 col-md-3"
>
<Cards::ArticleCard @article={{article}}/>
</LinkTo>
{{/each}}
</div>
</div>
</div>
</div>
</div>
{{/if}}

{{#if (and (can 'show mail-aliases') @model.mailAliases)}}
<div class='row'>
<div class='col-sm-12'>
Expand Down

0 comments on commit a4e0fb2

Please sign in to comment.