MOBILE-4219 edit-entry: Change save button and default publishstate

main
Alfonso Salces 2024-03-25 14:57:57 +01:00
parent b38b77edd9
commit 823aba0467
3 changed files with 9 additions and 17 deletions

View File

@ -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"
<ion-button class="ion-margin" expand="block" [attr.aria-label]="'core.save' | translate"
[disabled]="form.invalid || (entry && !hasDataChangedForEdit)" (click)="save()">
{{ (entry ? 'core.save' : 'addon.blog.addnewentry') | translate }}
{{ 'core.save' | translate }}
</ion-button>
</ion-col>
</ion-row>
</ion-label>
</ion-item>
</form>
</core-loading>

View File

@ -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,
});

View File

@ -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