diff --git a/src/addons/blog/pages/edit-entry/edit-entry.html b/src/addons/blog/pages/edit-entry/edit-entry.html index 5d2ab8f7c..842cf3400 100644 --- a/src/addons/blog/pages/edit-entry/edit-entry.html +++ b/src/addons/blog/pages/edit-entry/edit-entry.html @@ -75,18 +75,10 @@ } - - - - - - {{ (entry ? 'core.save' : 'addon.blog.addnewentry') | translate }} - - - - - + + {{ 'core.save' | translate }} + diff --git a/src/addons/blog/pages/edit-entry/edit-entry.ts b/src/addons/blog/pages/edit-entry/edit-entry.ts index cf43e9ccf..6fa0b40f2 100644 --- a/src/addons/blog/pages/edit-entry/edit-entry.ts +++ b/src/addons/blog/pages/edit-entry/edit-entry.ts @@ -60,7 +60,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit { subject: new FormControl('', { nonNullable: true, validators: [Validators.required] }), summary: new FormControl('', { nonNullable: true, validators: [Validators.required] }), publishState: new FormControl( - ADDON_BLOG_PUBLISH_STATE.draft, + ADDON_BLOG_PUBLISH_STATE.site, { nonNullable: true, validators: [Validators.required] }, ), associateWithCourse: new FormControl(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, }); diff --git a/src/addons/blog/pages/index/index.html b/src/addons/blog/pages/index/index.html index 7baa5871f..ce9ec0f9d 100644 --- a/src/addons/blog/pages/index/index.html +++ b/src/addons/blog/pages/index/index.html @@ -28,7 +28,6 @@ } @for (entry of entries; track entry.id) { - @if (!onlyMyEntries || entry.userid === currentUserId) {

@@ -56,10 +55,13 @@ + @if (entry.user?.fullname && entry.created) { - + '$a': { name: '' + entry.user?.fullname + '', date: (entry.created | coreDateDayOrTime) } + }"> + } @else if (!entry.user?.fullname && entry.created) { + {{ entry.created | coreDateDayOrTime }} + }

@@ -92,20 +94,22 @@
- @if (entry.lastmodified > entry.created) { -
- + @if (entry.lastmodified > entry.created || (entry.userid === currentUserId && entry.publishstate !== 'draft')) { + + @if (entry.lastmodified > entry.created) { + {{ entry.lastmodified | coreTimeAgo }} + } @if (entry.userid === currentUserId && entry.publishstate !== 'draft') { - + {{ 'addon.blog.' + entry.publishTranslated | translate }} } -
+ } @if (commentsEnabled) { @@ -114,7 +118,6 @@ } - } } @empty { } diff --git a/src/addons/blog/pages/index/index.scss b/src/addons/blog/pages/index/index.scss index ab579b29e..16cd7210f 100644 --- a/src/addons/blog/pages/index/index.scss +++ b/src/addons/blog/pages/index/index.scss @@ -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; } diff --git a/src/addons/blog/pages/index/index.ts b/src/addons/blog/pages/index/index.ts index 186c5b25c..b1b3d4b8e 100644 --- a/src/addons/blog/pages/index/index.ts +++ b/src/addons/blog/pages/index/index.ts @@ -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(); } + } /** diff --git a/src/addons/blog/tests/behat/edit-entry.feature b/src/addons/blog/tests/behat/edit-entry.feature index 2dae7244b..23ee7020e 100644 --- a/src/addons/blog/tests/behat/edit-entry.feature +++ b/src/addons/blog/tests/behat/edit-entry.feature @@ -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