From 823aba0467cc7e8ddfba9ec4ac4897bc959382f3 Mon Sep 17 00:00:00 2001 From: Alfonso Salces Date: Mon, 25 Mar 2024 14:57:57 +0100 Subject: [PATCH] MOBILE-4219 edit-entry: Change save button and default publishstate --- src/addons/blog/pages/edit-entry/edit-entry.html | 16 ++++------------ src/addons/blog/pages/edit-entry/edit-entry.ts | 6 +++--- src/addons/blog/tests/behat/edit-entry.feature | 4 ++-- 3 files changed, 9 insertions(+), 17 deletions(-) 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/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