MOBILE-4470 blog: trigger form submitted event
parent
05e6bcb0b0
commit
53e346d7ae
|
@ -11,7 +11,7 @@
|
|||
</ion-header>
|
||||
<ion-content>
|
||||
<core-loading [hideUntil]="loaded">
|
||||
<form [formGroup]="form">
|
||||
<form [formGroup]="form" #editEntryForm>
|
||||
<ion-item>
|
||||
<ion-input labelPlacement="stacked" formControlName="subject" type="text"
|
||||
[placeholder]="'addon.blog.entrytitle' | translate" name="title" [label]="'addon.blog.entrytitle' | translate" />
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
AddonBlogProvider,
|
||||
AddonBlogPublishState,
|
||||
} from '@addons/blog/services/blog';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { CoreCommentsComponentsModule } from '@features/comments/components/components.module';
|
||||
|
@ -40,6 +40,7 @@ import { CoreUtils } from '@services/utils/utils';
|
|||
import { CoreWSFile } from '@services/ws';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { CoreForms } from '@singletons/form';
|
||||
|
||||
@Component({
|
||||
selector: 'addon-blog-edit-entry',
|
||||
|
@ -54,6 +55,8 @@ import { CoreEvents } from '@singletons/events';
|
|||
})
|
||||
export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
||||
|
||||
@ViewChild('editEntryForm') formElement!: ElementRef;
|
||||
|
||||
publishState = AddonBlogPublishState;
|
||||
form = new FormGroup({
|
||||
subject: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
||||
|
@ -316,6 +319,8 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
|||
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
|
||||
}
|
||||
|
||||
CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -360,6 +365,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
|||
|
||||
CoreEvents.trigger(ADDON_BLOG_ENTRY_UPDATED);
|
||||
this.forceLeave = true;
|
||||
CoreForms.triggerFormSubmittedEvent(this.formElement, true, CoreSites.getCurrentSiteId());
|
||||
|
||||
return CoreNavigator.back();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue