commit
7aac07a251
|
@ -75,18 +75,10 @@
|
|||
</div>
|
||||
}
|
||||
|
||||
<ion-item class="addon-blog-entry-buttons">
|
||||
<ion-label>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-button expand="block" [attr.aria-label]="(entry ? 'core.save' : 'addon.blog.addnewentry') | translate"
|
||||
[disabled]="form.invalid || (entry && !hasDataChangedForEdit)" (click)="save()">
|
||||
{{ (entry ? 'core.save' : 'addon.blog.addnewentry') | translate }}
|
||||
</ion-button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
<ion-button class="ion-margin" expand="block" [attr.aria-label]="'core.save' | translate"
|
||||
[disabled]="form.invalid || (entry && !hasDataChangedForEdit)" (click)="save()">
|
||||
{{ 'core.save' | translate }}
|
||||
</ion-button>
|
||||
|
||||
</form>
|
||||
</core-loading>
|
||||
|
|
|
@ -60,7 +60,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
|||
subject: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
||||
summary: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
||||
publishState: new FormControl<AddonBlogPublishState>(
|
||||
ADDON_BLOG_PUBLISH_STATE.draft,
|
||||
ADDON_BLOG_PUBLISH_STATE.site,
|
||||
{ nonNullable: true, validators: [Validators.required] },
|
||||
),
|
||||
associateWithCourse: new FormControl<boolean>(false, { nonNullable: true, validators: [Validators.required] }),
|
||||
|
@ -110,7 +110,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
|||
|
||||
return form.subject.value !== '' ||
|
||||
form.summary.value !== '' ||
|
||||
form.publishState.value !== ADDON_BLOG_PUBLISH_STATE.draft ||
|
||||
form.publishState.value !== ADDON_BLOG_PUBLISH_STATE.site ||
|
||||
CoreFileUploader.areFileListDifferent(this.files, this.initialFiles);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
|||
this.form.setValue({
|
||||
subject: this.entry?.subject ?? '',
|
||||
summary: this.entry?.summary ?? '',
|
||||
publishState: this.entry?.publishstate ?? ADDON_BLOG_PUBLISH_STATE.draft,
|
||||
publishState: this.entry?.publishstate ?? ADDON_BLOG_PUBLISH_STATE.site,
|
||||
associateWithCourse: this.form.controls.associateWithCourse.value,
|
||||
associateWithModule: this.form.controls.associateWithModule.value,
|
||||
});
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
}
|
||||
|
||||
@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-subject flex ion-text-wrap ion-justify-content-between ion-align-items-center">
|
||||
<h3>
|
||||
|
@ -56,10 +55,13 @@
|
|||
<core-user-avatar [user]="entry.user" [courseId]="entry.courseid" />
|
||||
</span>
|
||||
|
||||
@if (entry.user?.fullname && entry.created) {
|
||||
<span [innerHTML]="'core.bynameondate' | translate: {
|
||||
'$a': { name: '<strong>' + entry?.user?.fullname + '</strong>', date: (entry.created | coreDateDayOrTime) }
|
||||
}">
|
||||
</span>
|
||||
'$a': { name: '<strong>' + entry.user?.fullname + '</strong>', date: (entry.created | coreDateDayOrTime) }
|
||||
}"></span>
|
||||
} @else if (!entry.user?.fullname && entry.created) {
|
||||
<span>{{ entry.created | coreDateDayOrTime }}</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -92,20 +94,22 @@
|
|||
</div>
|
||||
</ion-label>
|
||||
|
||||
@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">
|
||||
@if (entry.lastmodified > entry.created || (entry.userid === currentUserId && entry.publishstate !== 'draft')) {
|
||||
<ion-item class="entry-last-modification">
|
||||
@if (entry.lastmodified > entry.created) {
|
||||
<ion-note class="flex ion-align-items-center" slot="start">
|
||||
<ion-icon name="fas-clock" [attr.aria-label]="'core.lastmodified' | translate" />
|
||||
{{ entry.lastmodified | coreTimeAgo }}
|
||||
</ion-note>
|
||||
}
|
||||
|
||||
@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" />
|
||||
{{ 'addon.blog.' + entry.publishTranslated | translate }}
|
||||
</ion-badge>
|
||||
}
|
||||
</div>
|
||||
</ion-item>
|
||||
}
|
||||
|
||||
@if (commentsEnabled) {
|
||||
|
@ -114,7 +118,6 @@
|
|||
}
|
||||
|
||||
</div>
|
||||
}
|
||||
} @empty {
|
||||
<core-empty-box icon="far-newspaper" [message]="'addon.blog.noentriesyet' | translate" />
|
||||
}
|
||||
|
|
|
@ -45,6 +45,18 @@
|
|||
}
|
||||
|
||||
&-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 {
|
||||
margin-right: .3rem;
|
||||
}
|
||||
|
|
|
@ -229,6 +229,8 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
|
|||
.sort((a, b) => b.created - a.created);
|
||||
}
|
||||
|
||||
this.entries = this.entries.filter(entry => !this.onlyMyEntries || entry.userid === this.currentUserId);
|
||||
|
||||
if (this.onlyMyEntries) {
|
||||
const count = this.entries.filter((entry) => entry.userid == this.currentUserId).length;
|
||||
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.
|
||||
this.loadMore();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ Feature: Edit blog entries
|
|||
And I set the field "Blog entry body" to "This is a new blog entry." in the app
|
||||
And I press "Publish to" in the app
|
||||
And I press "Anyone on this site" in the app
|
||||
And I press "Add a new entry" "button" in the app
|
||||
And I press "Save" "button" in the app
|
||||
|
||||
Then I should find "Blog entries" in the app
|
||||
And I should find "New blog entry" in the app
|
||||
|
@ -60,7 +60,7 @@ Feature: Edit blog entries
|
|||
And I press "Add file" in the app
|
||||
And I upload "stub7.txt" to "File" ".action-sheet-button" in the app
|
||||
|
||||
And I press "Add a new entry" "button" in the app
|
||||
And I press "Save" "button" in the app
|
||||
|
||||
Then I should find "Blog entries" in the app
|
||||
And I should find "Entry with attachments" in the app
|
||||
|
|
Loading…
Reference in New Issue