Merge pull request #2319 from dpalou/MOBILE-3269

Mobile 3269
main
Juan Leyva 2020-03-16 16:09:41 +01:00 committed by GitHub
commit 61fc58e0c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 72 additions and 74 deletions

View File

@ -497,7 +497,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
this.calendarProvider.submitEvent(this.eventId, data).then((result) => {
event = result.event;
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent, this.currentSite.getId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.currentSite.getId());
if (result.sent) {
// Event created or edited, invalidate right days & months.
@ -561,7 +561,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
this.domUtils.showConfirm(this.translate.instant('core.areyousure')).then(() => {
this.calendarOffline.deleteEvent(this.eventId).then(() => {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.currentSite.getId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
this.returnToList();
}).catch(() => {
@ -584,7 +584,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
}
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.currentSite.getId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
}
/**

View File

@ -71,7 +71,7 @@ export class AddonModAssignEditFeedbackModalPage {
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
}
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@ -92,7 +92,7 @@ export class AddonModAssignEditFeedbackModalPage {
e.preventDefault();
e.stopPropagation();
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
// Close the modal, sending the input data.
this.forceLeave = true;

View File

@ -99,7 +99,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy {
// Nothing has changed or user confirmed to leave. Clear temporary data from plugins.
this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, this.getInputData());
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@ -318,7 +318,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy {
await this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, inputData);
// Submission saved, trigger events.
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
const params = {
assignmentId: this.assign.id,

View File

@ -114,7 +114,7 @@ export class AddonModDataEditPage {
const files = await this.dataHelper.getEditTmpFiles(inputData, this.fieldsArray, this.data.id, this.entry.contents);
this.fileUploaderProvider.clearTmpFiles(files);
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@ -215,7 +215,7 @@ export class AddonModDataEditPage {
// This is done if entry is updated when editing or creating if not.
if ((this.entryId && result.updated) || (!this.entryId && result.newentryid)) {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent, this.siteId);
this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.siteId);
const promises = [];

View File

@ -187,9 +187,9 @@ export class AddonModDataSearchPage {
*/
closeModal(data?: any): void {
if (typeof data == 'undefined') {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
} else {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
}
this.viewCtrl.dismiss(data);

View File

@ -109,9 +109,9 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
* Detect changes on input properties.
*/
ngOnChanges(changes: {[name: string]: SimpleChange}): void {
if (changes.leavingPage && this.leavingPage && this.formElement) {
if (changes.leavingPage && this.leavingPage) {
// Download all courses is enabled now, initialize it.
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
}
@ -423,7 +423,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
this.onPostChange.emit();
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
if (this.syncId) {
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);
@ -443,7 +443,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
// Reset data.
this.setReplyFormData();
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
if (this.syncId) {
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);

View File

@ -120,9 +120,9 @@ export class AddonModForumEditPostPage {
*/
closeModal(data: any, ): void {
if (data) {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
} else {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
this.viewCtrl.dismiss(data);

View File

@ -480,8 +480,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
this.domUtils.showErrorModalDefault(null, 'addon.mod_forum.errorposttoallgroups', true);
}
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!discussionIds,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!discussionIds, this.sitesProvider.getCurrentSiteId());
this.returnToDiscussions(discussionIds, discTimecreated);
}).catch((message) => {
@ -504,7 +503,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
}));
return Promise.all(promises).then(() => {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.returnToDiscussions();
});
@ -539,7 +538,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
this.uploaderProvider.clearTmpFiles(this.newDiscussion.files);
if (this.formElement) {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
}

View File

@ -160,7 +160,7 @@ export class AddonModGlossaryEditPage implements OnInit {
// Delete the local files from the tmp folder.
this.uploaderProvider.clearTmpFiles(this.attachments);
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@ -253,8 +253,7 @@ export class AddonModGlossaryEditPage implements OnInit {
};
this.eventsProvider.trigger(AddonModGlossaryProvider.ADD_ENTRY_EVENT, data, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!entryId,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!entryId, this.sitesProvider.getCurrentSiteId());
this.saved = true;
this.navCtrl.pop();

View File

@ -586,7 +586,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
this.refreshIcon = 'refresh';
this.syncIcon = 'sync';
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true, this.siteId);
this.domUtils.triggerFormSubmittedEvent(this.formElement, true, this.siteId);
});
}

View File

@ -44,7 +44,7 @@ export class AddonModLessonPasswordModalPage {
e.preventDefault();
e.stopPropagation();
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss(password.value);
}
@ -53,7 +53,7 @@ export class AddonModLessonPasswordModalPage {
* Close modal.
*/
closeModal(): void {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss();
}

View File

@ -149,7 +149,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
}
}
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@ -552,8 +552,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
return this.callFunction(this.lessonProvider.processPage.bind(this.lessonProvider), args, 6, 8).then((result) => {
if (formSubmitted) {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.sitesProvider.getCurrentSiteId());
}
if (!this.offline && !this.review && this.lessonProvider.isLessonOffline(this.lesson)) {

View File

@ -154,9 +154,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
await this.domUtils.showConfirm(this.translate.instant('addon.mod_quiz.confirmleavequizonerror'));
if (this.formElement) {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
}
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
} finally {
modal.dismiss();
}
@ -592,8 +590,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
this.autoSave.hideAutoSaveError();
if (this.formElement) {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !this.offline,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, !this.offline, this.sitesProvider.getCurrentSiteId());
}
});
}

View File

@ -120,7 +120,7 @@ export class AddonModQuizPreflightModalPage implements OnInit {
this.domUtils.showErrorModal('core.errorinvalidform', true);
}
} else {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.siteId);
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.siteId);
this.viewCtrl.dismiss(this.preflightForm.value);
}
@ -130,7 +130,7 @@ export class AddonModQuizPreflightModalPage implements OnInit {
* Close modal.
*/
closeModal(): void {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
this.viewCtrl.dismiss();
}

View File

@ -356,7 +356,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
}
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@ -426,8 +426,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
// Edit existing page.
promise = this.wikiProvider.editPage(this.pageId, text, this.section).then(() => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, true, this.sitesProvider.getCurrentSiteId());
// Invalidate page since it changed.
return this.wikiProvider.invalidatePage(this.pageId).then(() => {
@ -463,8 +462,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
return this.wikiProvider.newPage(title, text, this.subwikiId, wikiId, this.userId, this.groupId).then((id) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, id > 0,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, id > 0, this.sitesProvider.getCurrentSiteId());
if (id > 0) {
// Page was created, get its data and go to the page.

View File

@ -304,7 +304,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit {
assessmentData, false, allowOffline);
}).then((grade) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!grade, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!grade, this.sitesProvider.getCurrentSiteId());
const promises = [];

View File

@ -132,7 +132,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy {
// Show confirmation if some data has been modified.
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@ -346,7 +346,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy {
return this.workshopProvider.evaluateAssessment(this.workshopId, this.assessmentId, this.courseId, inputData.text,
inputData.weight, inputData.grade).then((result) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!result, this.siteId);
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!result, this.siteId);
const data = {
workshopId: this.workshopId,

View File

@ -128,7 +128,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy {
this.fileUploaderProvider.clearTmpFiles(this.submission.attachmentfiles);
}
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@ -374,7 +374,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy {
attachmentsId, undefined, submissionId, allowOffline);
}).then((newSubmissionId) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!newSubmissionId, this.siteId);
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!newSubmissionId, this.siteId);
const data = {
workshopId: this.workshopId,

View File

@ -153,7 +153,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
// Show confirmation if some data has been modified.
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@ -449,7 +449,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
return this.workshopProvider.evaluateSubmission(this.workshopId, this.submissionId, this.courseId, inputData.text,
inputData.published, inputData.grade).then((result) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!result, this.siteId);
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!result, this.siteId);
const data = {
workshopId: this.workshopId,

View File

@ -65,7 +65,7 @@ export class AddonNotesAddPage {
this.processing = true;
this.notesProvider.addNote(this.userId, this.courseId, this.type, this.text).then((sent) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss({type: this.type, sent: true}).finally(() => {
this.domUtils.showToast(sent ? 'addon.notes.eventnotecreated' : 'core.datastoredoffline', true, 3000);
@ -82,7 +82,7 @@ export class AddonNotesAddPage {
* Close modal.
*/
closeModal(): void {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss({type: this.type});
}

View File

@ -143,7 +143,7 @@ export class CoreLocalFileComponent implements OnInit {
if (newName == this.file.name) {
// Name hasn't changed, stop.
this.editMode = false;
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
return;
}
@ -160,8 +160,7 @@ export class CoreLocalFileComponent implements OnInit {
// File doesn't exist, move it.
return this.fileProvider.moveFile(this.relativePath, newPath).then((fileEntry) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.editMode = false;
this.file = fileEntry;

View File

@ -90,7 +90,7 @@ export class CoreSendMessageFormComponent implements OnInit {
this.message = ''; // Reset the form.
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
value = this.textUtils.replaceNewLines(value, '<br>');
this.onSubmit.emit(value);

View File

@ -71,8 +71,7 @@ export class CoreCommentsAddPage {
this.commentsProvider.addComment(this.content, this.contextLevel, this.instanceId, this.componentName, this.itemId,
this.area).then((commentsResponse) => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!commentsResponse,
this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!commentsResponse, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss({comments: commentsResponse}).finally(() => {
this.domUtils.showToast(commentsResponse ? 'core.comments.eventcommentcreated' : 'core.datastoredoffline', true,
@ -90,7 +89,7 @@ export class CoreCommentsAddPage {
* Close modal.
*/
closeModal(): void {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss();
}
}

View File

@ -1258,7 +1258,7 @@ export class CoreCourseHelperProvider {
} else {
modal.dismiss();
return this.getAndOpenCourse(undefined, courseId, params, siteId);
return this.getAndOpenCourse(navCtrl, courseId, params, siteId);
}
}).catch((error) => {
modal.dismiss();

View File

@ -39,7 +39,7 @@ export class CoreCoursesSelfEnrolPasswordPage {
* Close help modal.
*/
close(): void {
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss();
}
@ -53,7 +53,7 @@ export class CoreCoursesSelfEnrolPasswordPage {
e.preventDefault();
e.stopPropagation();
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss(password);
}

View File

@ -246,7 +246,7 @@ export class CoreLoginCredentialsPage {
}).finally(() => {
modal.dismiss();
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
});
}

View File

@ -277,7 +277,7 @@ export class CoreLoginEmailSignupPage {
}).then((result) => {
if (result.success) {
this.domUtils.triggerFormSubmittedEvent(this.signupFormElement.nativeElement, true);
this.domUtils.triggerFormSubmittedEvent(this.signupFormElement, true);
// Show alert and ho back.
const message = this.translate.instant('core.login.emailconfirmsent', { $a: params.email });
@ -349,7 +349,7 @@ export class CoreLoginEmailSignupPage {
this.wsProvider.callAjax('core_auth_is_minor', params, {siteUrl: this.siteUrl}).then((result) => {
this.domUtils.triggerFormSubmittedEvent(this.ageFormElement.nativeElement, true);
this.domUtils.triggerFormSubmittedEvent(this.ageFormElement, true);
if (!result.status) {
if (this.countryControl.value) {

View File

@ -82,7 +82,7 @@ export class CoreLoginForgottenPasswordPage {
this.domUtils.showErrorModal(response.notice);
} else {
// Success.
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
this.domUtils.showAlert(this.translate.instant('core.success'), response.notice);
this.navCtrl.pop();

View File

@ -181,7 +181,7 @@ export class CoreLoginReconnectPage {
this.sitesProvider.getUserToken(siteUrl, username, password).then((data) => {
return this.sitesProvider.updateSiteToken(this.infoSiteUrl, username, data.token, data.privateToken).then(() => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
// Update site info too because functions might have changed (e.g. unisntall local_mobile).
return this.sitesProvider.updateSiteInfoByUrl(this.infoSiteUrl, username).then(() => {

View File

@ -107,7 +107,7 @@ export class CoreLoginSitePage {
this.sitesProvider.getUserToken(siteData.url, siteData.username, siteData.password).then((data) => {
return this.sitesProvider.newSite(data.siteUrl, data.token, data.privateToken).then(() => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
return this.loginHelper.goToSiteInitialPage();
}, (error) => {
@ -189,7 +189,7 @@ export class CoreLoginSitePage {
protected async login(response: CoreSiteCheckResponse): Promise<void> {
return this.sitesProvider.checkRequiredMinimumVersion(response.config).then(() => {
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
if (response.warning) {
this.domUtils.showErrorModal(response.warning, true, 4000);

View File

@ -98,7 +98,7 @@ export class CoreSearchBoxComponent implements OnInit {
this.saveSearchToHistory(this.searchText);
}
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.searched = this.searchText;
this.onSubmit.emit(this.searchText);

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Injectable, SimpleChange } from '@angular/core';
import { Injectable, SimpleChange, ElementRef } from '@angular/core';
import {
LoadingController, Loading, ToastController, Toast, AlertController, Alert, Platform, Content, PopoverController,
ModalController,
@ -1635,10 +1635,14 @@ export class CoreDomUtilsProvider {
* @param form Form element.
* @param siteId The site affected. If not provided, no site affected.
*/
triggerFormCancelledEvent(form: HTMLElement, siteId?: string): void {
triggerFormCancelledEvent(formRef: ElementRef, siteId?: string): void {
if (!formRef) {
return;
}
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
action: 'cancel',
form: form,
form: formRef.nativeElement,
}, siteId);
}
@ -1649,10 +1653,14 @@ export class CoreDomUtilsProvider {
* @param online Whether the action was done in offline or not.
* @param siteId The site affected. If not provided, no site affected.
*/
triggerFormSubmittedEvent(form: HTMLElement, online?: boolean, siteId?: string): void {
triggerFormSubmittedEvent(formRef: ElementRef, online?: boolean, siteId?: string): void {
if (!formRef) {
return;
}
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
action: 'submit',
form: form,
form: formRef.nativeElement,
online: !!online,
}, siteId);
}