diff --git a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html
index ed9bba085..56e361736 100644
--- a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html
+++ b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html
@@ -37,32 +37,34 @@
-
+
{{ 'addon.block_myoverview.allincludinghidden' | translate }}
-
+
{{ 'addon.block_myoverview.all' | translate }}
-
{{ 'addon.block_myoverview.inprogress' | translate }}
-
+
{{ 'addon.block_myoverview.future' | translate }}
-
+
{{ 'addon.block_myoverview.past' | translate }}
- {{ customOption.name }}
+ {{ customOption.name }}
-
{{ 'addon.block_myoverview.favourites' | translate }}
-
+
{{ 'addon.block_myoverview.hiddencourses' | translate }}
diff --git a/src/addons/block/timeline/components/timeline/addon-block-timeline.html b/src/addons/block/timeline/components/timeline/addon-block-timeline.html
index 2249fac9e..6635ba016 100644
--- a/src/addons/block/timeline/components/timeline/addon-block-timeline.html
+++ b/src/addons/block/timeline/components/timeline/addon-block-timeline.html
@@ -12,13 +12,27 @@
- {{ 'core.all' | translate }}
- {{ 'addon.block_timeline.overdue' | translate }}
- {{ 'addon.block_timeline.duedate' | translate }}
- {{ 'addon.block_timeline.next7days' | translate }}
- {{ 'addon.block_timeline.next30days' | translate }}
- {{ 'addon.block_timeline.next3months' | translate }}
- {{ 'addon.block_timeline.next6months' | translate }}
+
+ {{ 'core.all' | translate }}
+
+
+ {{ 'addon.block_timeline.overdue' | translate }}
+
+
+ {{ 'addon.block_timeline.duedate' | translate }}
+
+
+ {{ 'addon.block_timeline.next7days' | translate }}
+
+
+ {{ 'addon.block_timeline.next30days' | translate }}
+
+
+ {{ 'addon.block_timeline.next3months' | translate }}
+
+
+ {{ 'addon.block_timeline.next6months' | translate }}
+
diff --git a/src/addons/calendar/calendar-lazy.module.ts b/src/addons/calendar/calendar-lazy.module.ts
index c8058bd01..941f0449d 100644
--- a/src/addons/calendar/calendar-lazy.module.ts
+++ b/src/addons/calendar/calendar-lazy.module.ts
@@ -32,10 +32,16 @@ function buildRoutes(injector: Injector): Routes {
return [
{
path: 'index',
+ data: {
+ isMainMenuRoot: true,
+ },
loadChildren: () => import('@/addons/calendar/pages/index/index.module').then(m => m.AddonCalendarIndexPageModule),
},
{
path: 'list',
+ data: {
+ isMainMenuRoot: true,
+ },
loadChildren: () => import('@/addons/calendar/pages/list/list.module').then(m => m.AddonCalendarListPageModule),
},
{
diff --git a/src/addons/calendar/pages/edit-event/edit-event.html b/src/addons/calendar/pages/edit-event/edit-event.html
index fb22f3bd9..d6d001ebd 100644
--- a/src/addons/calendar/pages/edit-event/edit-event.html
+++ b/src/addons/calendar/pages/edit-event/edit-event.html
@@ -76,7 +76,7 @@
{{ 'core.course' | translate }}
+ (ionChange)="groupCourseSelected()">
{{ course.fullname }}
diff --git a/src/addons/calendar/pages/edit-event/edit-event.page.ts b/src/addons/calendar/pages/edit-event/edit-event.page.ts
index 5d826a466..c33b55f81 100644
--- a/src/addons/calendar/pages/edit-event/edit-event.page.ts
+++ b/src/addons/calendar/pages/edit-event/edit-event.page.ts
@@ -396,10 +396,9 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
/**
* A course was selected, get its groups.
- *
- * @param courseId Course ID.
*/
- async groupCourseSelected(courseId: number): Promise {
+ async groupCourseSelected(): Promise {
+ const courseId = this.form.controls.groupcourseid.value;
if (!courseId) {
return;
}
diff --git a/src/addons/calendar/pages/event/event.html b/src/addons/calendar/pages/event/event.html
index a226b8144..c4e94afc9 100644
--- a/src/addons/calendar/pages/event/event.html
+++ b/src/addons/calendar/pages/event/event.html
@@ -73,7 +73,8 @@
{{ 'addon.calendar.when' | translate }}
-
+
{{ 'core.deletedoffline' | translate }}
diff --git a/src/addons/calendar/pages/event/event.page.ts b/src/addons/calendar/pages/event/event.page.ts
index e18344707..987a9b4b3 100644
--- a/src/addons/calendar/pages/event/event.page.ts
+++ b/src/addons/calendar/pages/event/event.page.ts
@@ -103,8 +103,6 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
this.canEdit = AddonCalendar.canEditEventsInSite();
this.canDelete = AddonCalendar.canDeleteEventsInSite();
- this.asyncConstructor();
-
// Listen for event edited. If current event is edited, reload the data.
this.editEventObserver = CoreEvents.on(AddonCalendarProvider.EDIT_EVENT_EVENT, (data) => {
if (data && data.eventId == this.eventId) {
@@ -136,7 +134,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
});
}
- protected async asyncConstructor(): Promise {
+ protected async initReminders(): Promise {
if (this.notificationsEnabled) {
this.monthNames = CoreLang.getMonthNames();
@@ -159,6 +157,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
this.syncIcon = CoreConstants.ICON_LOADING;
this.fetchEvent();
+ this.initReminders();
}
/**
diff --git a/src/addons/calendar/pages/settings/settings.html b/src/addons/calendar/pages/settings/settings.html
index 570ee55a4..7c0a539a2 100644
--- a/src/addons/calendar/pages/settings/settings.html
+++ b/src/addons/calendar/pages/settings/settings.html
@@ -8,17 +8,17 @@
-
+
{{ 'addon.calendar.defaultnotificationtime' | translate }}
-
- {{ 'core.settings.disabled' | translate }}
- {{ 600 | coreDuration }}
- {{ 1800 | coreDuration }}
- {{ 3600 | coreDuration }}
- {{ 7200 | coreDuration }}
- {{ 21600 | coreDuration }}
- {{ 43200 | coreDuration }}
- {{ 86400 | coreDuration }}
+
+ {{ 'core.settings.disabled' | translate }}
+ {{ 600 | coreDuration }}
+ {{ 1800 | coreDuration }}
+ {{ 3600 | coreDuration }}
+ {{ 7200 | coreDuration }}
+ {{ 21600 | coreDuration }}
+ {{ 43200 | coreDuration }}
+ {{ 86400 | coreDuration }}
diff --git a/src/addons/calendar/pages/settings/settings.ts b/src/addons/calendar/pages/settings/settings.ts
index 91dede6e4..a42184f2d 100644
--- a/src/addons/calendar/pages/settings/settings.ts
+++ b/src/addons/calendar/pages/settings/settings.ts
@@ -26,7 +26,7 @@ import { CoreSites } from '@services/sites';
})
export class AddonCalendarSettingsPage implements OnInit {
- defaultTime = 0;
+ defaultTime = -1;
/**
* View loaded.
diff --git a/src/addons/messages/guards/index.ts b/src/addons/messages/guards/index.ts
new file mode 100644
index 000000000..8d09ab80b
--- /dev/null
+++ b/src/addons/messages/guards/index.ts
@@ -0,0 +1,44 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import { Injectable } from '@angular/core';
+import { CanActivate, UrlTree } from '@angular/router';
+import { Router } from '@singletons';
+import { AddonMessagesMainMenuHandlerService } from '../services/handlers/mainmenu';
+import { AddonMessages } from '../services/messages';
+
+/**
+ * Guard to redirect to the right page based on the current Moodle site version.
+ */
+@Injectable({ providedIn: 'root' })
+export class AddonMessagesIndexGuard implements CanActivate {
+
+ /**
+ * @inheritdoc
+ */
+ canActivate(): UrlTree {
+ return this.guard();
+ }
+
+ /**
+ * Check if there is a pending redirect and trigger it.
+ */
+ private guard(): UrlTree {
+ const enabled = AddonMessages.isGroupMessagingEnabled();
+ const path = `/main/${AddonMessagesMainMenuHandlerService.PAGE_NAME}/` + ( enabled ? 'group-conversations' : 'index');
+
+ return Router.parseUrl(path);
+ }
+
+}
diff --git a/src/addons/messages/messages-lazy.module.ts b/src/addons/messages/messages-lazy.module.ts
index c606a6ae0..9d3af46bf 100644
--- a/src/addons/messages/messages-lazy.module.ts
+++ b/src/addons/messages/messages-lazy.module.ts
@@ -16,6 +16,7 @@ import { Injector, NgModule } from '@angular/core';
import { Route, RouterModule, ROUTES, Routes } from '@angular/router';
import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module';
+import { AddonMessagesIndexGuard } from './guards';
export const AddonMessagesDiscussionRoute: Route = {
path: 'discussion',
@@ -51,8 +52,7 @@ function buildRoutes(injector: Injector): Routes {
.then(m => m.AddonMessagesContactsPageModule),
},
...buildTabMainRoutes(injector, {
- redirectTo: 'index',
- pathMatch: 'full',
+ canActivate: [AddonMessagesIndexGuard],
}),
];
}
diff --git a/src/addons/messages/pages/discussions-35/discussions.module.ts b/src/addons/messages/pages/discussions-35/discussions.module.ts
index 2406cee87..e5b0b56b1 100644
--- a/src/addons/messages/pages/discussions-35/discussions.module.ts
+++ b/src/addons/messages/pages/discussions-35/discussions.module.ts
@@ -26,6 +26,9 @@ import { AddonMessagesDiscussions35Page } from './discussions.page';
const mobileRoutes: Routes = [
{
path: '',
+ data: {
+ isMainMenuRoot: true,
+ },
component: AddonMessagesDiscussions35Page,
},
AddonMessagesDiscussionRoute,
@@ -34,6 +37,9 @@ const mobileRoutes: Routes = [
const tabletRoutes: Routes = [
{
path: '',
+ data: {
+ isMainMenuRoot: true,
+ },
component: AddonMessagesDiscussions35Page,
children: [
AddonMessagesDiscussionRoute,
diff --git a/src/addons/messages/pages/group-conversations/group-conversations.module.ts b/src/addons/messages/pages/group-conversations/group-conversations.module.ts
index 33f437be7..57b851b41 100644
--- a/src/addons/messages/pages/group-conversations/group-conversations.module.ts
+++ b/src/addons/messages/pages/group-conversations/group-conversations.module.ts
@@ -25,6 +25,9 @@ import { AddonMessagesGroupConversationsPage } from './group-conversations.page'
const mobileRoutes: Routes = [
{
path: '',
+ data: {
+ isMainMenuRoot: true,
+ },
component: AddonMessagesGroupConversationsPage,
},
AddonMessagesDiscussionRoute,
@@ -33,6 +36,9 @@ const mobileRoutes: Routes = [
const tabletRoutes: Routes = [
{
path: '',
+ data: {
+ isMainMenuRoot: true,
+ },
component: AddonMessagesGroupConversationsPage,
children: [
AddonMessagesDiscussionRoute,
diff --git a/src/addons/messages/services/handlers/index-link.ts b/src/addons/messages/services/handlers/index-link.ts
index e528bce36..d552a6886 100644
--- a/src/addons/messages/services/handlers/index-link.ts
+++ b/src/addons/messages/services/handlers/index-link.ts
@@ -18,6 +18,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons';
import { AddonMessages } from '../messages';
+import { AddonMessagesMainMenuHandlerService } from './mainmenu';
/**
* Content links handler for messaging index.
@@ -37,9 +38,7 @@ export class AddonMessagesIndexLinkHandlerService extends CoreContentLinksHandle
getActions(): CoreContentLinksAction[] | Promise {
return [{
action: async (siteId): Promise => {
- const pageName = await AddonMessages.getMainMessagesPagePathInSite(siteId);
-
- CoreNavigator.navigateToSitePath(pageName, {
+ CoreNavigator.navigateToSitePath(AddonMessagesMainMenuHandlerService.PAGE_NAME, {
siteId,
preferCurrentTab: false,
});
diff --git a/src/addons/messages/services/handlers/mainmenu.ts b/src/addons/messages/services/handlers/mainmenu.ts
index 2f8021415..45349eef3 100644
--- a/src/addons/messages/services/handlers/mainmenu.ts
+++ b/src/addons/messages/services/handlers/mainmenu.ts
@@ -43,7 +43,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler,
protected handler: CoreMainMenuHandlerToDisplay = {
icon: 'fas-comments',
title: 'addon.messages.messages',
- page: AddonMessages.getMainMessagesPagePath(),
+ page: AddonMessagesMainMenuHandlerService.PAGE_NAME,
class: 'addon-messages-handler',
showBadge: true, // Do not check isMessageCountEnabled because we'll use fallback it not enabled.
badge: '',
@@ -108,8 +108,6 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler,
* @return Data needed to render the handler.
*/
getDisplayData(): CoreMainMenuHandlerToDisplay {
- this.handler.page = AddonMessages.getMainMessagesPagePath();
-
if (this.handler.loading) {
this.refreshBadge();
}
diff --git a/src/addons/messages/services/handlers/push-click.ts b/src/addons/messages/services/handlers/push-click.ts
index 4363fa90c..f90495ab4 100644
--- a/src/addons/messages/services/handlers/push-click.ts
+++ b/src/addons/messages/services/handlers/push-click.ts
@@ -20,6 +20,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreUtils } from '@services/utils/utils';
import { makeSingleton } from '@singletons';
import { AddonMessages } from '../messages';
+import { AddonMessagesMainMenuHandlerService } from './mainmenu';
/**
* Handler for messaging push notifications clicks.
@@ -61,7 +62,6 @@ export class AddonMessagesPushClickHandlerService implements CorePushNotificatio
// Check if group messaging is enabled, to determine which page should be loaded.
const enabled = await AddonMessages.isGroupMessagingEnabledInSite(notification.site);
- const pageName = await AddonMessages.getMainMessagesPagePathInSite(notification.site);
let nextPageParams: Params | undefined;
@@ -76,7 +76,7 @@ export class AddonMessagesPushClickHandlerService implements CorePushNotificatio
};
}
- await CoreNavigator.navigateToSitePath(pageName, {
+ await CoreNavigator.navigateToSitePath(AddonMessagesMainMenuHandlerService.PAGE_NAME, {
siteId: notification.site,
preferCurrentTab: false,
nextNavigation: nextPageParams ?
diff --git a/src/addons/messages/services/messages.ts b/src/addons/messages/services/messages.ts
index e987af5e7..d845f73ad 100644
--- a/src/addons/messages/services/messages.ts
+++ b/src/addons/messages/services/messages.ts
@@ -30,7 +30,6 @@ import { CoreSite, CoreSiteWSPreSets } from '@classes/site';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
-import { AddonMessagesMainMenuHandlerService } from './handlers/mainmenu';
import { AddonMessagesSyncEvents, AddonMessagesSyncProvider } from './messages-sync';
const ROOT_CACHE_KEY = 'mmaMessages:';
@@ -1411,29 +1410,6 @@ export class AddonMessagesProvider {
throw new CoreError('Error getting message preferences');
}
- /**
- * Gets the site main messages page path for a site.
- *
- * @param siteId Site ID. If not defined, use current site.
- * @return Main messages page path of the site.
- */
- async getMainMessagesPagePathInSite(siteId?: string): Promise {
- const enabled = await this.isGroupMessagingEnabledInSite(siteId);
-
- return AddonMessagesMainMenuHandlerService.PAGE_NAME + ( enabled ? '/group-conversations' : '');
- }
-
- /**
- * Gets the site main messages page path.
- *
- * @return Main messages page path of the site.
- */
- getMainMessagesPagePath(): string {
- const enabled = this.isGroupMessagingEnabled();
-
- return AddonMessagesMainMenuHandlerService.PAGE_NAME + ( enabled ? '/group-conversations' : '');
- }
-
/**
* Get messages according to the params.
*
diff --git a/src/addons/mod/quiz/services/quiz-sync.ts b/src/addons/mod/quiz/services/quiz-sync.ts
index 77ce8beff..a6741fae5 100644
--- a/src/addons/mod/quiz/services/quiz-sync.ts
+++ b/src/addons/mod/quiz/services/quiz-sync.ts
@@ -188,11 +188,11 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider
/**
* Sync all quizzes on a site.
*
- * @param siteId Site ID to sync.
* @param force Wether to force sync not depending on last execution.
+ * @param siteId Site ID to sync.
* @param Promise resolved if sync is successful, rejected if sync fails.
*/
- protected async syncAllQuizzesFunc(siteId: string, force: boolean): Promise {
+ protected async syncAllQuizzesFunc(force: boolean, siteId: string): Promise {
// Get all offline attempts.
const attempts = await AddonModQuizOffline.getAllAttempts(siteId);
diff --git a/src/addons/notes/pages/list/list.html b/src/addons/notes/pages/list/list.html
index 0d5f1c048..2b4d264e7 100644
--- a/src/addons/notes/pages/list/list.html
+++ b/src/addons/notes/pages/list/list.html
@@ -36,9 +36,15 @@
- {{ 'addon.notes.sitenotes' | translate }}
- {{ 'addon.notes.coursenotes' | translate }}
- {{ 'addon.notes.personalnotes' | translate }}
+
+ {{ 'addon.notes.sitenotes' | translate }}
+
+
+ {{ 'addon.notes.coursenotes' | translate }}
+
+
+ {{ 'addon.notes.personalnotes' | translate }}
+
diff --git a/src/addons/notifications/notifications-lazy.module.ts b/src/addons/notifications/notifications-lazy.module.ts
index 890e8df7c..eac71a80f 100644
--- a/src/addons/notifications/notifications-lazy.module.ts
+++ b/src/addons/notifications/notifications-lazy.module.ts
@@ -21,6 +21,9 @@ function buildRoutes(injector: Injector): Routes {
return [
{
path: 'list',
+ data: {
+ isMainMenuRoot: true,
+ },
loadChildren: () => import('./pages/list/list.module').then(m => m.AddonNotificationsListPageModule),
},
...buildTabMainRoutes(injector, {
diff --git a/src/addons/notifications/pages/settings/settings.html b/src/addons/notifications/pages/settings/settings.html
index b343928fc..b8c711b94 100644
--- a/src/addons/notifications/pages/settings/settings.html
+++ b/src/addons/notifications/pages/settings/settings.html
@@ -43,7 +43,7 @@
0"
[selection]="currentProcessor!.name" (onChange)="changeProcessor($event)">
-
+
{{ processor.displayname }}
diff --git a/src/addons/privatefiles/pages/index/index.html b/src/addons/privatefiles/pages/index/index.html
index c35695fcb..2f145c520 100644
--- a/src/addons/privatefiles/pages/index/index.html
+++ b/src/addons/privatefiles/pages/index/index.html
@@ -15,8 +15,12 @@
- {{ 'addon.privatefiles.privatefiles' | translate }}
- {{ 'addon.privatefiles.sitefiles' | translate }}
+
+ {{ 'addon.privatefiles.privatefiles' | translate }}
+
+
+ {{ 'addon.privatefiles.sitefiles' | translate }}
+
diff --git a/src/addons/privatefiles/privatefiles-lazy.module.ts b/src/addons/privatefiles/privatefiles-lazy.module.ts
index 405d9ff9d..79e5096b3 100644
--- a/src/addons/privatefiles/privatefiles-lazy.module.ts
+++ b/src/addons/privatefiles/privatefiles-lazy.module.ts
@@ -19,12 +19,19 @@ import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.modu
function buildRoutes(injector: Injector): Routes {
return [
+ {
+ path: 'root',
+ data: {
+ isMainMenuRoot: true,
+ },
+ loadChildren: () => import('./pages/index/index.module').then(m => m.AddonPrivateFilesIndexPageModule),
+ },
{
path: ':hash',
loadChildren: () => import('./pages/index/index.module').then(m => m.AddonPrivateFilesIndexPageModule),
},
...buildTabMainRoutes(injector, {
- redirectTo: 'root', // Fake "hash".
+ redirectTo: 'root',
pathMatch: 'full',
}),
];
diff --git a/src/addons/privatefiles/services/handlers/mainmenu.ts b/src/addons/privatefiles/services/handlers/mainmenu.ts
index 5b8015217..0ec18da4c 100644
--- a/src/addons/privatefiles/services/handlers/mainmenu.ts
+++ b/src/addons/privatefiles/services/handlers/mainmenu.ts
@@ -48,7 +48,6 @@ export class AddonPrivateFilesMainMenuHandlerService implements CoreMainMenuHand
icon: 'fas-folder',
title: 'addon.privatefiles.files',
page: AddonPrivateFilesMainMenuHandlerService.PAGE_NAME,
- subPage: 'root',
class: 'addon-privatefiles-handler',
};
}
diff --git a/src/core/directives/auto-focus.ts b/src/core/directives/auto-focus.ts
index 4d4857a82..190f90d19 100644
--- a/src/core/directives/auto-focus.ts
+++ b/src/core/directives/auto-focus.ts
@@ -30,7 +30,7 @@ import { CoreUtils } from '@services/utils/utils';
})
export class CoreAutoFocusDirective implements AfterViewInit {
- @Input('core-auto-focus') showKeyboard: boolean | string = true;
+ @Input('core-auto-focus') autoFocus: boolean | string = true;
protected element: HTMLElement;
@@ -42,7 +42,7 @@ export class CoreAutoFocusDirective implements AfterViewInit {
* @inheritdoc
*/
ngAfterViewInit(): void {
- if (this.showKeyboard === 'nofocus') {
+ if (CoreUtils.isFalseOrZero(this.autoFocus)) {
return;
}
@@ -78,8 +78,7 @@ export class CoreAutoFocusDirective implements AfterViewInit {
return;
}
- const showKeyboard = this.showKeyboard === '' || CoreUtils.isTrueOrOne(this.showKeyboard);
- CoreDomUtils.focusElement(element, showKeyboard);
+ CoreDomUtils.focusElement(element);
if (element != document.activeElement) {
this.setFocus(retries - 1);
diff --git a/src/core/features/login/pages/credentials/credentials.html b/src/core/features/login/pages/credentials/credentials.html
index b801b643c..e124b7293 100644
--- a/src/core/features/login/pages/credentials/credentials.html
+++ b/src/core/features/login/pages/credentials/credentials.html
@@ -33,7 +33,7 @@
{{ 'core.login.username' | translate }}
+ required="true">
diff --git a/src/core/features/login/pages/forgotten-password/forgotten-password.html b/src/core/features/login/pages/forgotten-password/forgotten-password.html
index b7ddc1d03..c25d7e423 100644
--- a/src/core/features/login/pages/forgotten-password/forgotten-password.html
+++ b/src/core/features/login/pages/forgotten-password/forgotten-password.html
@@ -31,7 +31,7 @@
+ formControlName="value" autocapitalize="none" autocorrect="off" [core-auto-focus]="autoFocus">
diff --git a/src/core/features/login/pages/forgotten-password/forgotten-password.ts b/src/core/features/login/pages/forgotten-password/forgotten-password.ts
index 5e54a3ce6..e6aa8a6b0 100644
--- a/src/core/features/login/pages/forgotten-password/forgotten-password.ts
+++ b/src/core/features/login/pages/forgotten-password/forgotten-password.ts
@@ -35,7 +35,7 @@ export class CoreLoginForgottenPasswordPage implements OnInit {
myForm!: FormGroup;
siteUrl!: string;
- showKeyboard!: boolean;
+ autoFocus!: boolean;
constructor(
protected formBuilder: FormBuilder,
@@ -55,7 +55,7 @@ export class CoreLoginForgottenPasswordPage implements OnInit {
}
this.siteUrl = siteUrl;
- this.showKeyboard = Platform.is('tablet');
+ this.autoFocus = Platform.is('tablet');
this.myForm = this.formBuilder.group({
field: ['username', Validators.required],
value: [CoreNavigator.getRouteParam('username') || '', Validators.required],
diff --git a/src/core/features/login/pages/reconnect/reconnect.html b/src/core/features/login/pages/reconnect/reconnect.html
index 631aa99f4..a0b93d75f 100644
--- a/src/core/features/login/pages/reconnect/reconnect.html
+++ b/src/core/features/login/pages/reconnect/reconnect.html
@@ -42,7 +42,7 @@
+ autocomplete="current-password" enterkeyhint="go" required="true">
diff --git a/src/core/features/login/pages/site/site.html b/src/core/features/login/pages/site/site.html
index 7b509ee74..58e5818a7 100644
--- a/src/core/features/login/pages/site/site.html
+++ b/src/core/features/login/pages/site/site.html
@@ -26,7 +26,7 @@
{{ 'core.login.siteaddress' | translate }}
+ formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR">
@@ -36,7 +36,7 @@
{{ 'core.login.siteaddress' | translate }}
+ [core-auto-focus]="showKeyboard && !showScanQR" (ionChange)="searchSite($event, siteForm.value.siteUrl)">
diff --git a/src/core/features/mainmenu/pages/home/home.module.ts b/src/core/features/mainmenu/pages/home/home.module.ts
index 2160d8709..2ad028009 100644
--- a/src/core/features/mainmenu/pages/home/home.module.ts
+++ b/src/core/features/mainmenu/pages/home/home.module.ts
@@ -28,6 +28,9 @@ function buildRoutes(injector: Injector): Routes {
return [
...buildTabMainRoutes(injector, {
path: '',
+ data: {
+ isMainMenuRoot: true,
+ },
component: CoreMainMenuHomePage,
children: routes.children,
}),
diff --git a/src/core/features/mainmenu/pages/menu/menu.ts b/src/core/features/mainmenu/pages/menu/menu.ts
index 36a197501..233749b89 100644
--- a/src/core/features/mainmenu/pages/menu/menu.ts
+++ b/src/core/features/mainmenu/pages/menu/menu.ts
@@ -13,13 +13,12 @@
// limitations under the License.
import { Component, OnInit, OnDestroy, ViewChild, ChangeDetectorRef } from '@angular/core';
-import { ActivatedRoute, Router } from '@angular/router';
+import { ActivatedRoute } from '@angular/router';
import { IonTabs } from '@ionic/angular';
import { BackButtonEvent } from '@ionic/core';
import { Subscription } from 'rxjs';
import { CoreApp } from '@services/app';
-import { CoreTextUtils } from '@services/utils/text';
import { CoreEvents, CoreEventObserver } from '@singletons/events';
import { CoreMainMenu, CoreMainMenuProvider } from '../../services/mainmenu';
import { CoreMainMenuDelegate, CoreMainMenuHandlerToDisplay } from '../../services/mainmenu-delegate';
@@ -27,6 +26,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { Translate } from '@singletons';
import { CoreUtils } from '@services/utils/utils';
import { CoreAriaRoleTab, CoreAriaRoleTabFindable } from '@classes/aria-role-tab';
+import { CoreNavigator } from '@services/navigator';
/**
* Page that displays the main menu of the app.
@@ -61,7 +61,6 @@ export class CoreMainMenuPage implements OnInit, OnDestroy {
constructor(
protected route: ActivatedRoute,
protected changeDetector: ChangeDetectorRef,
- protected router: Router,
) {
this.resizeFunction = this.initHandlers.bind(this);
this.backButtonFunction = this.backButtonClicked.bind(this);
@@ -172,28 +171,26 @@ export class CoreMainMenuPage implements OnInit, OnDestroy {
return;
}
- const trimmedUrl = CoreTextUtils.trimCharacter(this.router.url, '/');
+ e.preventDefault();
+ e.stopPropagation();
+ e.stopImmediatePropagation();
// Current tab was clicked. Check if user is already at root level.
- if (trimmedUrl == CoreTextUtils.trimCharacter(page, '/')) {
- // Already at root level, nothing to do.
- return;
+ const mainMenuRootRoute = CoreNavigator.getCurrentRoute({ routeData: { isMainMenuRoot: true } });
+ if (mainMenuRootRoute) {
+ return; // Already at root level, nothing to do.
+ }
+
+ // Current route doesn't define isMainMenuRoot. Check if the current path is the tab one.
+ const currentPath = CoreNavigator.getCurrentPath();
+ if (currentPath == `/main/${page}`) {
+ return; // Already at root level, nothing to do.
}
// Ask the user if he wants to go back to the root page of the tab.
- e.preventDefault();
- e.stopPropagation();
-
try {
const tab = this.tabs.find((tab) => tab.page == page);
- // Use tab's subPage to check if user is already at root level.
- if (tab?.subPage && trimmedUrl ==
- CoreTextUtils.trimCharacter(CoreTextUtils.concatenatePaths(tab.page, tab.subPage), '/')) {
- // Already at root level, nothing to do.
- return;
- }
-
if (tab?.title) {
await CoreDomUtils.showConfirm(Translate.instant('core.confirmgotabroot', {
name: Translate.instant(tab.title),
diff --git a/src/core/features/mainmenu/pages/more/more.ts b/src/core/features/mainmenu/pages/more/more.ts
index 4e48698dc..42dafbdfb 100644
--- a/src/core/features/mainmenu/pages/more/more.ts
+++ b/src/core/features/mainmenu/pages/more/more.ts
@@ -136,7 +136,6 @@ export class CoreMainMenuMorePage implements OnInit, OnDestroy {
* Open a handler.
*
* @param handler Handler to open.
- * @todo: use subPage?
*/
openHandler(handler: CoreMainMenuHandlerData): void {
const params = handler.pageParams;
diff --git a/src/core/features/mainmenu/services/handlers/mainmenu.ts b/src/core/features/mainmenu/services/handlers/mainmenu.ts
index aff6cdb9d..45c6bd8ba 100644
--- a/src/core/features/mainmenu/services/handlers/mainmenu.ts
+++ b/src/core/features/mainmenu/services/handlers/mainmenu.ts
@@ -42,7 +42,6 @@ export class CoreMainMenuHomeHandlerService implements CoreMainMenuHandler {
icon: 'fas-tachometer-alt',
title: 'core.mainmenu.home',
page: CoreMainMenuHomeHandlerService.PAGE_NAME,
- // @todo: subPage? The page can change due to core-tabs.
class: 'core-home-handler',
};
}
diff --git a/src/core/features/mainmenu/services/mainmenu-delegate.ts b/src/core/features/mainmenu/services/mainmenu-delegate.ts
index 998550f49..2ecbb542d 100644
--- a/src/core/features/mainmenu/services/mainmenu-delegate.ts
+++ b/src/core/features/mainmenu/services/mainmenu-delegate.ts
@@ -33,13 +33,6 @@ export interface CoreMainMenuHandlerData {
*/
page: string;
- /**
- * Sub page loaded when the handler page is loaded.
- * If your module performs a redirect when it's opened you need to specify the sub page in here.
- * E.g. if page is 'foo' but it redirects to 'foo/bar' when opened, this value must be 'bar'.
- */
- subPage?: string;
-
/**
* Title to display for the handler.
*/
diff --git a/src/core/features/search/components/search-box/core-search-box.html b/src/core/features/search/components/search-box/core-search-box.html
index 8438c6237..9d71300f2 100644
--- a/src/core/features/search/components/search-box/core-search-box.html
+++ b/src/core/features/search/components/search-box/core-search-box.html
@@ -3,7 +3,7 @@
1">
- {{ 'core.tag.inalltagcoll' | translate }}
-
+
+ {{ 'core.tag.inalltagcoll' | translate }}
+
+
{{ collection.name }}
diff --git a/src/core/features/tag/tag-lazy.module.ts b/src/core/features/tag/tag-lazy.module.ts
index dc6ed32c1..3156dc8c6 100644
--- a/src/core/features/tag/tag-lazy.module.ts
+++ b/src/core/features/tag/tag-lazy.module.ts
@@ -31,6 +31,9 @@ function buildRoutes(injector: Injector): Routes {
},
{
path: 'search',
+ data: {
+ isMainMenuRoot: true,
+ },
loadChildren: () => import('@features/tag//pages/search/search.page.module').then(m => m.CoreTagSearchPageModule),
},
CoreTagIndexAreaRoute,
diff --git a/src/core/services/navigator.ts b/src/core/services/navigator.ts
index d543aac00..da03518ff 100644
--- a/src/core/services/navigator.ts
+++ b/src/core/services/navigator.ts
@@ -519,6 +519,31 @@ export class CoreNavigatorService {
return path;
}
+ /**
+ * Get the full path of a certain route, including parent routes paths.
+ *
+ * @param route Route.
+ * @return Path.
+ */
+ getRouteFullPath(route: ActivatedRoute | null): string {
+ if (!route) {
+ return '';
+ }
+
+ const parentPath = this.getRouteFullPath(route.parent);
+ const routePath = route.snapshot.url.join('/');
+
+ if (!parentPath && !routePath) {
+ return '';
+ } else if (parentPath && !routePath) {
+ return parentPath;
+ } else if (!parentPath && routePath) {
+ return '/' + routePath;
+ } else {
+ return parentPath + '/' + routePath;
+ }
+ }
+
}
export const CoreNavigator = makeSingleton(CoreNavigatorService);
diff --git a/src/core/services/utils/dom.ts b/src/core/services/utils/dom.ts
index acd5ed3a5..18419faca 100644
--- a/src/core/services/utils/dom.ts
+++ b/src/core/services/utils/dom.ts
@@ -391,12 +391,11 @@ export class CoreDomUtilsProvider {
* Focus an element and open keyboard.
*
* @param el HTML element to focus.
- * @param showKeyboard Show keyboard when focusing the element.
*/
- focusElement(el: HTMLElement, showKeyboard = true): void {
+ focusElement(el: HTMLElement): void {
if (el?.focus) {
el.focus();
- if (showKeyboard && CoreApp.isAndroid() && this.supportsInputKeyboard(el)) {
+ if (CoreApp.isAndroid() && this.supportsInputKeyboard(el)) {
// On some Android versions the keyboard doesn't open automatically.
CoreApp.openKeyboard();
}