MOBILE-3565 home: Move home component to mainmenu

main
Pau Ferrer Ocaña 2020-10-29 12:55:11 +01:00
parent 8a816561c7
commit c1b7b10c5d
11 changed files with 35 additions and 32 deletions

View File

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

View File

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

View File

@ -1,6 +1,7 @@
{
"changesite": "Change site",
"help": "Help",
"home": "Home",
"logout": "Log out",
"website": "Website"
}

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
<ion-spinner></ion-spinner>
</ion-item>
<ion-item button *ngFor="let handler of handlers" [ngClass]="['core-moremenu-handler', handler.class || '']"
(click)="openHandler(handler)" title="{{ handler.title | translate }}" detail="true">
(click)="openHandler(handler)" title="{{ handler.title | translate }}" detail="true" details>
<ion-icon [name]="handler.icon" slot="start"></ion-icon>
<ion-label>
<h2>{{ handler.title | translate}}</h2>
@ -32,47 +32,47 @@
</ion-item>
<ng-container *ngFor="let item of customItems">
<ion-item button *ngIf="item.type != 'embedded'" [href]="item.url" title="{{item.label}}" core-link
[capture]="item.type == 'app'" [inApp]="item.type == 'inappbrowser'" class="core-moremenu-customitem">
[capture]="item.type == 'app'" [inApp]="item.type == 'inappbrowser'" class="core-moremenu-customitem" details>
<ion-icon [name]="item.icon" slot="start"></ion-icon>
<ion-label>
<h2>{{item.label}}</h2>
</ion-label>
</ion-item>
<ion-item button *ngIf="item.type == 'embedded'" (click)="openItem(item)" title="{{item.label}}"
class="core-moremenu-customitem">
class="core-moremenu-customitem" details>
<ion-icon [name]="item.icon" slot="start"></ion-icon>
<ion-label>
<h2>{{item.label}}</h2>
</ion-label>
</ion-item>
</ng-container>
<ion-item button *ngIf="showScanQR" (click)="scanQR()">
<ion-item button *ngIf="showScanQR" (click)="scanQR()" details>
<ion-icon name="fa-qrcode" slot="start" aria-hidden="true"></ion-icon>
<ion-label>
<h2>{{ 'core.scanqr' | translate }}</h2>
</ion-label>
</ion-item>
<ion-item button *ngIf="showWeb && siteInfo" [href]="siteInfo.siteurl" core-link autoLogin="yes"
title="{{ 'core.mainmenu.website' | translate }}">
title="{{ 'core.mainmenu.website' | translate }}" details>
<ion-icon name="globe" slot="start" aria-hidden="true"></ion-icon>
<ion-label>
<h2>{{ 'core.mainmenu.website' | translate }}</h2>
</ion-label>
</ion-item>
<ion-item button *ngIf="showHelp" [href]="docsUrl" core-link autoLogin="no"
title="{{ 'core.mainmenu.help' | translate }}">
title="{{ 'core.mainmenu.help' | translate }}" details>
<ion-icon name="help-buoy" slot="start" aria-hidden="true"></ion-icon>
<ion-label>
<h2>{{ 'core.mainmenu.help' | translate }}</h2>
</ion-label>
</ion-item>
<ion-item button (click)="openSitePreferences()" title="{{ 'core.settings.preferences' | translate }}">
<ion-item button (click)="openSitePreferences()" title="{{ 'core.settings.preferences' | translate }}" details>
<ion-icon name="fa-wrench" slot="start"></ion-icon>
<ion-label>
<h2>{{ 'core.settings.preferences' | translate }}</h2>
</ion-label>
</ion-item>
<ion-item button (click)="logout()" title="{{ logoutLabel | translate }}">
<ion-item button (click)="logout()" title="{{ logoutLabel | translate }}" details>
<ion-icon name="log-out" slot="start" aria-hidden="true"></ion-icon>
<ion-label>
<h2>{{ logoutLabel | translate }}</h2>
@ -80,7 +80,7 @@
</ion-item>
<ion-item-divider></ion-item-divider>
<ion-item button router-direction="forward" routerLink="/settings/app"
title="{{ 'core.settings.appsettings' | translate }}">
title="{{ 'core.settings.appsettings' | translate }}" details>
<ion-icon name="fa-cogs" slot="start"></ion-icon>
<ion-label>
<h2>{{ 'core.settings.appsettings' | translate }}</h2>

View File

@ -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?",