MOBILE-3565 home: Move home component to mainmenu
parent
8a816561c7
commit
c1b7b10c5d
|
@ -14,17 +14,8 @@
|
||||||
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
import { CoreMainMenuDelegate } from '@core/mainmenu/services/delegate';
|
|
||||||
import { CoreHomeMainMenuHandler } from './handlers/mainmenu';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
declarations: [],
|
declarations: [],
|
||||||
})
|
})
|
||||||
export class CoreCoursesModule {
|
export class CoreCoursesModule { }
|
||||||
|
|
||||||
constructor(mainMenuDelegate: CoreMainMenuDelegate) {
|
|
||||||
mainMenuDelegate.registerHandler(new CoreHomeMainMenuHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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.
|
* Handler to add Home into main menu.
|
||||||
|
@ -51,7 +51,7 @@ export class CoreHomeMainMenuHandler implements CoreMainMenuHandler {
|
||||||
getDisplayData(): CoreMainMenuHandlerData {
|
getDisplayData(): CoreMainMenuHandlerData {
|
||||||
return {
|
return {
|
||||||
icon: 'fa-home',
|
icon: 'fa-home',
|
||||||
title: 'core.courses.mymoodle',
|
title: 'core.mainmenu.home',
|
||||||
page: 'home',
|
page: 'home',
|
||||||
class: 'core-home-handler',
|
class: 'core-home-handler',
|
||||||
};
|
};
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"changesite": "Change site",
|
"changesite": "Change site",
|
||||||
"help": "Help",
|
"help": "Help",
|
||||||
|
"home": "Home",
|
||||||
"logout": "Log out",
|
"logout": "Log out",
|
||||||
"website": "Website"
|
"website": "Website"
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@ const routes: Routes = [
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'home', // @todo: Add this route dynamically.
|
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',
|
path: 'more',
|
||||||
|
|
|
@ -18,12 +18,16 @@ import { CommonModule } from '@angular/common';
|
||||||
import { IonicModule } from '@ionic/angular';
|
import { IonicModule } from '@ionic/angular';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { CoreComponentsModule } from '@/app/components/components.module';
|
import { CoreComponentsModule } from '@components/components.module';
|
||||||
import { CoreDirectivesModule } from '@/app/directives/directives.module';
|
import { CoreDirectivesModule } from '@directives/directives.module';
|
||||||
|
|
||||||
|
import { CoreMainMenuDelegate } from './services/delegate';
|
||||||
|
|
||||||
import { CoreMainMenuRoutingModule } from './mainmenu-routing.module';
|
import { CoreMainMenuRoutingModule } from './mainmenu-routing.module';
|
||||||
import { CoreMainMenuPage } from './pages/menu/menu.page';
|
import { CoreMainMenuPage } from './pages/menu/menu.page';
|
||||||
import { CoreMainMenuMorePage } from './pages/more/more.page';
|
import { CoreMainMenuMorePage } from './pages/more/more.page';
|
||||||
|
import { CoreHomeMainMenuHandler } from './handlers/mainmenu';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -39,4 +43,10 @@ import { CoreMainMenuMorePage } from './pages/more/more.page';
|
||||||
CoreMainMenuMorePage,
|
CoreMainMenuMorePage,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class CoreMainMenuModule {}
|
export class CoreMainMenuModule {
|
||||||
|
|
||||||
|
constructor(mainMenuDelegate: CoreMainMenuDelegate) {
|
||||||
|
mainMenuDelegate.registerHandler(new CoreHomeMainMenuHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { CoreComponentsModule } from '@components/components.module';
|
import { CoreComponentsModule } from '@components/components.module';
|
||||||
import { CoreDirectivesModule } from '@directives/directives.module';
|
import { CoreDirectivesModule } from '@directives/directives.module';
|
||||||
|
|
||||||
import { CoreCoursesHomePage } from './home.page';
|
import { CoreHomePage } from './home.page';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: CoreCoursesHomePage,
|
component: CoreHomePage,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ const routes: Routes = [
|
||||||
CoreDirectivesModule,
|
CoreDirectivesModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
CoreCoursesHomePage,
|
CoreHomePage,
|
||||||
],
|
],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
})
|
})
|
||||||
export class CoreCoursesHomePageModule {}
|
export class CoreHomePageModule {}
|
|
@ -18,11 +18,11 @@ import { Component, OnInit } from '@angular/core';
|
||||||
* Page that displays the Home.
|
* Page that displays the Home.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'page-core-courses-home',
|
selector: 'page-core-home',
|
||||||
templateUrl: 'home.html',
|
templateUrl: 'home.html',
|
||||||
styleUrls: ['home.scss'],
|
styleUrls: ['home.scss'],
|
||||||
})
|
})
|
||||||
export class CoreCoursesHomePage implements OnInit {
|
export class CoreHomePage implements OnInit {
|
||||||
|
|
||||||
siteName = 'Hello world';
|
siteName = 'Hello world';
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<ion-spinner></ion-spinner>
|
<ion-spinner></ion-spinner>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item button *ngFor="let handler of handlers" [ngClass]="['core-moremenu-handler', handler.class || '']"
|
<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-icon [name]="handler.icon" slot="start"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ handler.title | translate}}</h2>
|
<h2>{{ handler.title | translate}}</h2>
|
||||||
|
@ -32,47 +32,47 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ng-container *ngFor="let item of customItems">
|
<ng-container *ngFor="let item of customItems">
|
||||||
<ion-item button *ngIf="item.type != 'embedded'" [href]="item.url" title="{{item.label}}" core-link
|
<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-icon [name]="item.icon" slot="start"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{item.label}}</h2>
|
<h2>{{item.label}}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item button *ngIf="item.type == 'embedded'" (click)="openItem(item)" title="{{item.label}}"
|
<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-icon [name]="item.icon" slot="start"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{item.label}}</h2>
|
<h2>{{item.label}}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ng-container>
|
</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-icon name="fa-qrcode" slot="start" aria-hidden="true"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'core.scanqr' | translate }}</h2>
|
<h2>{{ 'core.scanqr' | translate }}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item button *ngIf="showWeb && siteInfo" [href]="siteInfo.siteurl" core-link autoLogin="yes"
|
<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-icon name="globe" slot="start" aria-hidden="true"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'core.mainmenu.website' | translate }}</h2>
|
<h2>{{ 'core.mainmenu.website' | translate }}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item button *ngIf="showHelp" [href]="docsUrl" core-link autoLogin="no"
|
<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-icon name="help-buoy" slot="start" aria-hidden="true"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'core.mainmenu.help' | translate }}</h2>
|
<h2>{{ 'core.mainmenu.help' | translate }}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</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-icon name="fa-wrench" slot="start"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'core.settings.preferences' | translate }}</h2>
|
<h2>{{ 'core.settings.preferences' | translate }}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</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-icon name="log-out" slot="start" aria-hidden="true"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ logoutLabel | translate }}</h2>
|
<h2>{{ logoutLabel | translate }}</h2>
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item-divider></ion-item-divider>
|
<ion-item-divider></ion-item-divider>
|
||||||
<ion-item button router-direction="forward" routerLink="/settings/app"
|
<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-icon name="fa-cogs" slot="start"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'core.settings.appsettings' | translate }}</h2>
|
<h2>{{ 'core.settings.appsettings' | translate }}</h2>
|
||||||
|
|
|
@ -468,6 +468,7 @@
|
||||||
"core.login.yourenteredsite": "Connect to your site",
|
"core.login.yourenteredsite": "Connect to your site",
|
||||||
"core.mainmenu.changesite": "Change site",
|
"core.mainmenu.changesite": "Change site",
|
||||||
"core.mainmenu.help": "Help",
|
"core.mainmenu.help": "Help",
|
||||||
|
"core.mainmenu.home": "Home",
|
||||||
"core.mainmenu.logout": "Log out",
|
"core.mainmenu.logout": "Log out",
|
||||||
"core.mainmenu.website": "Website",
|
"core.mainmenu.website": "Website",
|
||||||
"core.needhelp": "Need help?",
|
"core.needhelp": "Need help?",
|
||||||
|
|
Loading…
Reference in New Issue