commit
7aac07a251
|
@ -75,18 +75,10 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ion-item class="addon-blog-entry-buttons">
|
<ion-button class="ion-margin" expand="block" [attr.aria-label]="'core.save' | translate"
|
||||||
<ion-label>
|
[disabled]="form.invalid || (entry && !hasDataChangedForEdit)" (click)="save()">
|
||||||
<ion-row>
|
{{ 'core.save' | translate }}
|
||||||
<ion-col>
|
</ion-button>
|
||||||
<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>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</core-loading>
|
</core-loading>
|
||||||
|
|
|
@ -60,7 +60,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
||||||
subject: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
subject: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
||||||
summary: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
summary: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
||||||
publishState: new FormControl<AddonBlogPublishState>(
|
publishState: new FormControl<AddonBlogPublishState>(
|
||||||
ADDON_BLOG_PUBLISH_STATE.draft,
|
ADDON_BLOG_PUBLISH_STATE.site,
|
||||||
{ nonNullable: true, validators: [Validators.required] },
|
{ nonNullable: true, validators: [Validators.required] },
|
||||||
),
|
),
|
||||||
associateWithCourse: new FormControl<boolean>(false, { 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 !== '' ||
|
return form.subject.value !== '' ||
|
||||||
form.summary.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);
|
CoreFileUploader.areFileListDifferent(this.files, this.initialFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
||||||
this.form.setValue({
|
this.form.setValue({
|
||||||
subject: this.entry?.subject ?? '',
|
subject: this.entry?.subject ?? '',
|
||||||
summary: this.entry?.summary ?? '',
|
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,
|
associateWithCourse: this.form.controls.associateWithCourse.value,
|
||||||
associateWithModule: this.form.controls.associateWithModule.value,
|
associateWithModule: this.form.controls.associateWithModule.value,
|
||||||
});
|
});
|
||||||
|
|
|
@ -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) {
|
@if (entry.lastmodified > entry.created || (entry.userid === currentUserId && entry.publishstate !== 'draft')) {
|
||||||
<div class="entry-last-modification flex ion-justify-content-between border-bottom ion-padding-top ion-padding-bottom">
|
<ion-item class="entry-last-modification">
|
||||||
<ion-note class="flex ion-align-items-center">
|
@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" />
|
<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" />
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 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 "Publish to" in the app
|
||||||
And I press "Anyone on this site" 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
|
Then I should find "Blog entries" in the app
|
||||||
And I should find "New blog entry" 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 press "Add file" in the app
|
||||||
And I upload "stub7.txt" to "File" ".action-sheet-button" 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
|
Then I should find "Blog entries" in the app
|
||||||
And I should find "Entry with attachments" in the app
|
And I should find "Entry with attachments" in the app
|
||||||
|
|
Loading…
Reference in New Issue