MOBILE-4219 blog: Fix empty blog entries page and some styles

main
Alfonso Salces 2024-03-25 14:58:55 +01:00
parent 823aba0467
commit 521964cf4f
3 changed files with 28 additions and 10 deletions

View File

@ -28,7 +28,6 @@
} }
@for (entry of entries; track entry.id) { @for (entry of entries; track entry.id) {
@if (!onlyMyEntries || entry.userid === currentUserId) {
<div class="entry ion-padding-start ion-padding-top ion-padding-end" [id]="'entry-' + entry.id"> <div class="entry ion-padding-start ion-padding-top ion-padding-end" [id]="'entry-' + entry.id">
<div class="entry-subject flex ion-text-wrap ion-justify-content-between ion-align-items-center"> <div class="entry-subject flex ion-text-wrap ion-justify-content-between ion-align-items-center">
<h3> <h3>
@ -56,10 +55,13 @@
<core-user-avatar [user]="entry.user" [courseId]="entry.courseid" /> <core-user-avatar [user]="entry.user" [courseId]="entry.courseid" />
</span> </span>
@if (entry.user?.fullname && entry.created) {
<span [innerHTML]="'core.bynameondate' | translate: { <span [innerHTML]="'core.bynameondate' | translate: {
'$a': { name: '<strong>' + entry?.user?.fullname + '</strong>', date: (entry.created | coreDateDayOrTime) } '$a': { name: '<strong>' + entry.user?.fullname + '</strong>', date: (entry.created | coreDateDayOrTime) }
}"> }"></span>
</span> } @else if (!entry.user?.fullname && entry.created) {
<span>{{ entry.created | coreDateDayOrTime }}</span>
}
</div> </div>
@ -92,20 +94,22 @@
</div> </div>
</ion-label> </ion-label>
@if (entry.lastmodified > entry.created || (entry.userid === currentUserId && entry.publishstate !== 'draft')) {
<ion-item class="entry-last-modification">
@if (entry.lastmodified > entry.created) { @if (entry.lastmodified > entry.created) {
<div class="entry-last-modification flex ion-justify-content-between border-bottom ion-padding-top ion-padding-bottom"> <ion-note class="flex ion-align-items-center" slot="start">
<ion-note class="flex ion-align-items-center">
<ion-icon name="fas-clock" [attr.aria-label]="'core.lastmodified' | translate" /> <ion-icon name="fas-clock" [attr.aria-label]="'core.lastmodified' | translate" />
{{ entry.lastmodified | coreTimeAgo }} {{ entry.lastmodified | coreTimeAgo }}
</ion-note> </ion-note>
}
@if (entry.userid === currentUserId && entry.publishstate !== 'draft') { @if (entry.userid === currentUserId && entry.publishstate !== 'draft') {
<ion-badge class="entry-visibility-permission" color="success"> <ion-badge class="entry-visibility-permission" color="success" slot="end">
<ion-icon name="fas-eye" /> <ion-icon name="fas-eye" />
{{ 'addon.blog.' + entry.publishTranslated | translate }} {{ 'addon.blog.' + entry.publishTranslated | translate }}
</ion-badge> </ion-badge>
} }
</div> </ion-item>
} }
@if (commentsEnabled) { @if (commentsEnabled) {
@ -114,7 +118,6 @@
} }
</div> </div>
}
} @empty { } @empty {
<core-empty-box icon="far-newspaper" [message]="'addon.blog.noentriesyet' | translate" /> <core-empty-box icon="far-newspaper" [message]="'addon.blog.noentriesyet' | translate" />
} }

View File

@ -45,6 +45,18 @@
} }
&-last-modification { &-last-modification {
--border-width: 0 0 1px 0;
&::part(native) {
padding: 0;
}
ion-note {
padding-top: 0.9rem;
font-size: 0.875rem;
font-weight: 500;
}
ion-icon { ion-icon {
margin-right: .3rem; margin-right: .3rem;
} }

View File

@ -229,6 +229,8 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
.sort((a, b) => b.created - a.created); .sort((a, b) => b.created - a.created);
} }
this.entries = this.entries.filter(entry => !this.onlyMyEntries || entry.userid === this.currentUserId);
if (this.onlyMyEntries) { if (this.onlyMyEntries) {
const count = this.entries.filter((entry) => entry.userid == this.currentUserId).length; const count = this.entries.filter((entry) => entry.userid == this.currentUserId).length;
this.canLoadMoreUserEntries = result.totalentries > count; this.canLoadMoreUserEntries = result.totalentries > count;
@ -273,6 +275,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
// First time but no entry loaded. Try to load some. // First time but no entry loaded. Try to load some.
this.loadMore(); this.loadMore();
} }
} }
/** /**