From c1b7b10c5d04d9933aa3b01e07aa66b966b2faf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 29 Oct 2020 12:55:11 +0100 Subject: [PATCH] MOBILE-3565 home: Move home component to mainmenu --- src/app/core/courses/courses.module.ts | 11 +---------- .../{courses => mainmenu}/handlers/mainmenu.ts | 4 ++-- src/app/core/mainmenu/lang/en.json | 3 ++- .../core/mainmenu/mainmenu-routing.module.ts | 2 +- src/app/core/mainmenu/mainmenu.module.ts | 16 +++++++++++++--- .../{courses => mainmenu}/pages/home/home.html | 0 .../pages/home/home.page.module.ts | 8 ++++---- .../pages/home/home.page.ts | 4 ++-- .../{courses => mainmenu}/pages/home/home.scss | 0 src/app/core/mainmenu/pages/more/more.html | 18 +++++++++--------- src/assets/lang/en.json | 1 + 11 files changed, 35 insertions(+), 32 deletions(-) rename src/app/core/{courses => mainmenu}/handlers/mainmenu.ts (92%) rename src/app/core/{courses => mainmenu}/pages/home/home.html (100%) rename src/app/core/{courses => mainmenu}/pages/home/home.page.module.ts (89%) rename src/app/core/{courses => mainmenu}/pages/home/home.page.ts (90%) rename src/app/core/{courses => mainmenu}/pages/home/home.scss (100%) diff --git a/src/app/core/courses/courses.module.ts b/src/app/core/courses/courses.module.ts index 38449fa0a..4dd76b82a 100644 --- a/src/app/core/courses/courses.module.ts +++ b/src/app/core/courses/courses.module.ts @@ -14,17 +14,8 @@ import { NgModule } from '@angular/core'; -import { CoreMainMenuDelegate } from '@core/mainmenu/services/delegate'; -import { CoreHomeMainMenuHandler } from './handlers/mainmenu'; - @NgModule({ imports: [], declarations: [], }) -export class CoreCoursesModule { - - constructor(mainMenuDelegate: CoreMainMenuDelegate) { - mainMenuDelegate.registerHandler(new CoreHomeMainMenuHandler()); - } - -} +export class CoreCoursesModule { } diff --git a/src/app/core/courses/handlers/mainmenu.ts b/src/app/core/mainmenu/handlers/mainmenu.ts similarity index 92% rename from src/app/core/courses/handlers/mainmenu.ts rename to src/app/core/mainmenu/handlers/mainmenu.ts index 337ddaed5..a4c2d1fad 100644 --- a/src/app/core/courses/handlers/mainmenu.ts +++ b/src/app/core/mainmenu/handlers/mainmenu.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@core/mainmenu/services/delegate'; +import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '../services/delegate'; /** * Handler to add Home into main menu. @@ -51,7 +51,7 @@ export class CoreHomeMainMenuHandler implements CoreMainMenuHandler { getDisplayData(): CoreMainMenuHandlerData { return { icon: 'fa-home', - title: 'core.courses.mymoodle', + title: 'core.mainmenu.home', page: 'home', class: 'core-home-handler', }; diff --git a/src/app/core/mainmenu/lang/en.json b/src/app/core/mainmenu/lang/en.json index 4ff96fbf7..a6558e06e 100644 --- a/src/app/core/mainmenu/lang/en.json +++ b/src/app/core/mainmenu/lang/en.json @@ -1,6 +1,7 @@ { "changesite": "Change site", "help": "Help", + "home": "Home", "logout": "Log out", "website": "Website" -} \ No newline at end of file +} diff --git a/src/app/core/mainmenu/mainmenu-routing.module.ts b/src/app/core/mainmenu/mainmenu-routing.module.ts index 9633807c5..9e45e3e5e 100644 --- a/src/app/core/mainmenu/mainmenu-routing.module.ts +++ b/src/app/core/mainmenu/mainmenu-routing.module.ts @@ -25,7 +25,7 @@ const routes: Routes = [ children: [ { path: 'home', // @todo: Add this route dynamically. - loadChildren: () => import('../courses/pages/home/home.page.module').then( m => m.CoreCoursesHomePageModule), + loadChildren: () => import('./pages/home/home.page.module').then( m => m.CoreHomePageModule), }, { path: 'more', diff --git a/src/app/core/mainmenu/mainmenu.module.ts b/src/app/core/mainmenu/mainmenu.module.ts index 1cd8f561e..8e4e5fde5 100644 --- a/src/app/core/mainmenu/mainmenu.module.ts +++ b/src/app/core/mainmenu/mainmenu.module.ts @@ -18,12 +18,16 @@ import { CommonModule } from '@angular/common'; import { IonicModule } from '@ionic/angular'; import { TranslateModule } from '@ngx-translate/core'; -import { CoreComponentsModule } from '@/app/components/components.module'; -import { CoreDirectivesModule } from '@/app/directives/directives.module'; +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; + +import { CoreMainMenuDelegate } from './services/delegate'; import { CoreMainMenuRoutingModule } from './mainmenu-routing.module'; import { CoreMainMenuPage } from './pages/menu/menu.page'; import { CoreMainMenuMorePage } from './pages/more/more.page'; +import { CoreHomeMainMenuHandler } from './handlers/mainmenu'; + @NgModule({ imports: [ @@ -39,4 +43,10 @@ import { CoreMainMenuMorePage } from './pages/more/more.page'; CoreMainMenuMorePage, ], }) -export class CoreMainMenuModule {} +export class CoreMainMenuModule { + + constructor(mainMenuDelegate: CoreMainMenuDelegate) { + mainMenuDelegate.registerHandler(new CoreHomeMainMenuHandler()); + } + +} diff --git a/src/app/core/courses/pages/home/home.html b/src/app/core/mainmenu/pages/home/home.html similarity index 100% rename from src/app/core/courses/pages/home/home.html rename to src/app/core/mainmenu/pages/home/home.html diff --git a/src/app/core/courses/pages/home/home.page.module.ts b/src/app/core/mainmenu/pages/home/home.page.module.ts similarity index 89% rename from src/app/core/courses/pages/home/home.page.module.ts rename to src/app/core/mainmenu/pages/home/home.page.module.ts index 9397ce678..ef2e8f653 100644 --- a/src/app/core/courses/pages/home/home.page.module.ts +++ b/src/app/core/mainmenu/pages/home/home.page.module.ts @@ -21,12 +21,12 @@ import { TranslateModule } from '@ngx-translate/core'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; -import { CoreCoursesHomePage } from './home.page'; +import { CoreHomePage } from './home.page'; const routes: Routes = [ { path: '', - component: CoreCoursesHomePage, + component: CoreHomePage, }, ]; @@ -40,8 +40,8 @@ const routes: Routes = [ CoreDirectivesModule, ], declarations: [ - CoreCoursesHomePage, + CoreHomePage, ], exports: [RouterModule], }) -export class CoreCoursesHomePageModule {} +export class CoreHomePageModule {} diff --git a/src/app/core/courses/pages/home/home.page.ts b/src/app/core/mainmenu/pages/home/home.page.ts similarity index 90% rename from src/app/core/courses/pages/home/home.page.ts rename to src/app/core/mainmenu/pages/home/home.page.ts index 1664c9d14..b5b2410b2 100644 --- a/src/app/core/courses/pages/home/home.page.ts +++ b/src/app/core/mainmenu/pages/home/home.page.ts @@ -18,11 +18,11 @@ import { Component, OnInit } from '@angular/core'; * Page that displays the Home. */ @Component({ - selector: 'page-core-courses-home', + selector: 'page-core-home', templateUrl: 'home.html', styleUrls: ['home.scss'], }) -export class CoreCoursesHomePage implements OnInit { +export class CoreHomePage implements OnInit { siteName = 'Hello world'; diff --git a/src/app/core/courses/pages/home/home.scss b/src/app/core/mainmenu/pages/home/home.scss similarity index 100% rename from src/app/core/courses/pages/home/home.scss rename to src/app/core/mainmenu/pages/home/home.scss diff --git a/src/app/core/mainmenu/pages/more/more.html b/src/app/core/mainmenu/pages/more/more.html index be3de959f..5edaa06e7 100644 --- a/src/app/core/mainmenu/pages/more/more.html +++ b/src/app/core/mainmenu/pages/more/more.html @@ -22,7 +22,7 @@ + (click)="openHandler(handler)" title="{{ handler.title | translate }}" detail="true" details>

{{ handler.title | translate}}

@@ -32,47 +32,47 @@
+ [capture]="item.type == 'app'" [inApp]="item.type == 'inappbrowser'" class="core-moremenu-customitem" details>

{{item.label}}

+ class="core-moremenu-customitem" details>

{{item.label}}

- +

{{ 'core.scanqr' | translate }}

+ title="{{ 'core.mainmenu.website' | translate }}" details>

{{ 'core.mainmenu.website' | translate }}

+ title="{{ 'core.mainmenu.help' | translate }}" details>

{{ 'core.mainmenu.help' | translate }}

- +

{{ 'core.settings.preferences' | translate }}

- +

{{ logoutLabel | translate }}

@@ -80,7 +80,7 @@
+ title="{{ 'core.settings.appsettings' | translate }}" details>

{{ 'core.settings.appsettings' | translate }}

diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index 1f1eb0b64..5b7aed812 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -468,6 +468,7 @@ "core.login.yourenteredsite": "Connect to your site", "core.mainmenu.changesite": "Change site", "core.mainmenu.help": "Help", + "core.mainmenu.home": "Home", "core.mainmenu.logout": "Log out", "core.mainmenu.website": "Website", "core.needhelp": "Need help?",