MOBILE-3565 modules: Create a module for each page

main
Dani Palou 2020-10-26 14:17:27 +01:00
parent 3a831c3ef1
commit ded36482d7
17 changed files with 395 additions and 90 deletions

View File

@ -27,7 +27,7 @@ const routes: Routes = [
},
{
path: 'settings',
loadChildren: () => import('./core/settings/settings.module').then( m => m.CoreAppSettingsModule),
loadChildren: () => import('./core/settings/settings.module').then( m => m.CoreSettingsModule),
},
{
path: 'mainmenu',

View File

@ -12,29 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreMainMenuDelegate } from '@core/mainmenu/services/delegate';
import { CoreHomeMainMenuHandler } from './handlers/mainmenu';
import { CoreCoursesHomePage } from './pages/home/home.page';
@NgModule({
imports: [
CommonModule,
IonicModule,
TranslateModule.forChild(),
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreCoursesHomePage,
],
imports: [],
declarations: [],
})
export class CoreCoursesModule {

View File

@ -0,0 +1,47 @@
// (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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreCoursesHomePage } from './home.page';
const routes: Routes = [
{
path: '',
component: CoreCoursesHomePage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
CommonModule,
IonicModule,
TranslateModule.forChild(),
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreCoursesHomePage,
],
exports: [RouterModule],
})
export class CoreCoursesHomePageModule {}

View File

@ -15,11 +15,6 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CoreLoginCredentialsPage } from './pages/credentials/credentials.page';
import { CoreLoginInitPage } from './pages/init/init.page';
import { CoreLoginSitePage } from './pages/site/site.page';
import { CoreLoginSitesPage } from './pages/sites/sites.page';
const routes: Routes = [
{
path: '',
@ -28,19 +23,19 @@ const routes: Routes = [
},
{
path: 'init',
component: CoreLoginInitPage,
loadChildren: () => import('./pages/init/init.page.module').then( m => m.CoreLoginInitPageModule),
},
{
path: 'site',
component: CoreLoginSitePage,
loadChildren: () => import('./pages/site/site.page.module').then( m => m.CoreLoginSitePageModule),
},
{
path: 'credentials',
component: CoreLoginCredentialsPage,
loadChildren: () => import('./pages/credentials/credentials.page.module').then( m => m.CoreLoginCredentialsPageModule),
},
{
path: 'sites',
component: CoreLoginSitesPage,
loadChildren: () => import('./pages/sites/sites.page.module').then( m => m.CoreLoginSitesPageModule),
},
];

View File

@ -13,38 +13,12 @@
// limitations under the License.
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreLoginRoutingModule } from './login-routing.module';
import { CoreLoginCredentialsPage } from './pages/credentials/credentials.page';
import { CoreLoginInitPage } from './pages/init/init.page';
import { CoreLoginSitePage } from './pages/site/site.page';
import { CoreLoginSitesPage } from './pages/sites/sites.page';
@NgModule({
imports: [
CommonModule,
IonicModule,
CoreLoginRoutingModule,
CoreComponentsModule,
TranslateModule.forChild(),
FormsModule,
ReactiveFormsModule,
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreLoginCredentialsPage,
CoreLoginInitPage,
CoreLoginSitePage,
CoreLoginSitesPage,
],
declarations: [],
})
export class CoreLoginModule {}

View File

@ -7,7 +7,10 @@
<ion-title>{{ 'core.login.login' | translate }}</ion-title>
<ion-buttons slot="end">
<!-- @todo: Settings button. -->
<ion-button router-direction="forward" routerLink="/settings/app"
[attr.aria-label]="'core.settings.appsettings' | translate">
<core-icon slot="icon-only" name="fa-cog"></core-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

View File

@ -0,0 +1,50 @@
// (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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreLoginCredentialsPage } from './credentials.page';
const routes: Routes = [
{
path: '',
component: CoreLoginCredentialsPage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
CommonModule,
IonicModule,
TranslateModule.forChild(),
FormsModule,
ReactiveFormsModule,
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreLoginCredentialsPage,
],
exports: [RouterModule],
})
export class CoreLoginCredentialsPageModule {}

View File

@ -0,0 +1,38 @@
// (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 { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { CoreLoginInitPage } from './init.page';
const routes: Routes = [
{
path: '',
component: CoreLoginInitPage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
IonicModule,
],
declarations: [
CoreLoginInitPage,
],
exports: [RouterModule],
})
export class CoreLoginInitPageModule {}

View File

@ -0,0 +1,50 @@
// (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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreLoginSitePage } from './site.page';
const routes: Routes = [
{
path: '',
component: CoreLoginSitePage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
CommonModule,
IonicModule,
TranslateModule.forChild(),
FormsModule,
ReactiveFormsModule,
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreLoginSitePage,
],
exports: [RouterModule],
})
export class CoreLoginSitePageModule {}

View File

@ -0,0 +1,47 @@
// (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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreLoginSitesPage } from './sites.page';
const routes: Routes = [
{
path: '',
component: CoreLoginSitesPage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
CommonModule,
IonicModule,
TranslateModule.forChild(),
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreLoginSitesPage,
],
exports: [RouterModule],
})
export class CoreLoginSitesPageModule {}

View File

@ -17,7 +17,6 @@ import { RouterModule, Routes } from '@angular/router';
import { CoreMainMenuPage } from './pages/menu/menu.page';
import { CoreMainMenuMorePage } from './pages/more/more.page';
import { CoreCoursesHomePage } from '../courses/pages/home/home.page';
const routes: Routes = [
{
@ -26,7 +25,7 @@ const routes: Routes = [
children: [
{
path: 'home', // @todo: Add this route dynamically.
component: CoreCoursesHomePage,
loadChildren: () => import('../courses/pages/home/home.page.module').then( m => m.CoreCoursesHomePageModule),
},
{
path: 'more',

View File

@ -0,0 +1,47 @@
// (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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreSettingsAboutPage } from './about.page';
const routes: Routes = [
{
path: '',
component: CoreSettingsAboutPage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
CommonModule,
IonicModule,
TranslateModule.forChild(),
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreSettingsAboutPage,
],
exports: [RouterModule],
})
export class CoreSettingsAboutPageModule {}

View File

@ -0,0 +1,47 @@
// (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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreSettingsAppPage } from './app.page';
const routes: Routes = [
{
path: '',
component: CoreSettingsAppPage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
CommonModule,
IonicModule,
TranslateModule.forChild(),
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreSettingsAppPage,
],
exports: [RouterModule],
})
export class CoreSettingsAppPageModule {}

View File

@ -20,7 +20,7 @@ import { ActivatedRoute, Params, Router } from '@angular/router';
selector: 'app-settings',
templateUrl: 'app.html',
})
export class CoreAppSettingsPage {
export class CoreSettingsAppPage {
// @ViewChild(CoreSplitViewComponent) splitviewCtrl?: CoreSplitViewComponent;

View File

@ -0,0 +1,47 @@
// (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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreSettingsDeviceInfoPage } from './deviceinfo.page';
const routes: Routes = [
{
path: '',
component: CoreSettingsDeviceInfoPage,
},
];
@NgModule({
imports: [
RouterModule.forChild(routes),
CommonModule,
IonicModule,
TranslateModule.forChild(),
CoreComponentsModule,
CoreDirectivesModule,
],
declarations: [
CoreSettingsDeviceInfoPage,
],
exports: [RouterModule],
})
export class CoreSettingsDeviceInfoPageModule {}

View File

@ -14,22 +14,19 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CoreAppSettingsPage } from './pages/app/app.page';
import { CoreSettingsAboutPage } from './pages/about/about.page';
import { CoreSettingsDeviceInfoPage } from './pages/deviceinfo/deviceinfo.page';
const routes: Routes = [
{
path: 'about',
component: CoreSettingsAboutPage,
loadChildren: () => import('./pages/about/about.page.module').then( m => m.CoreSettingsAboutPageModule),
},
{
path: 'deviceinfo',
component: CoreSettingsDeviceInfoPage,
loadChildren: () => import('./pages/deviceinfo/deviceinfo.page.module').then( m => m.CoreSettingsDeviceInfoPageModule),
},
{
path: 'app',
component: CoreAppSettingsPage,
loadChildren: () => import('./pages/app/app.page.module').then( m => m.CoreSettingsAppPageModule),
},
{
path: '',
@ -42,4 +39,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class CoreAppSettingsRoutingModule {}
export class CoreSettingsRoutingModule {}

View File

@ -13,34 +13,13 @@
// limitations under the License.
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreAppSettingsRoutingModule } from './settings-routing.module';
import { CorePipesModule } from '@pipes/pipes.module';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreAppSettingsPage } from './pages/app/app.page';
import { CoreSettingsAboutPage } from './pages/about/about.page';
import { CoreSettingsDeviceInfoPage } from './pages/deviceinfo/deviceinfo.page';
import { CoreSettingsRoutingModule } from './settings-routing.module';
@NgModule({
imports: [
CommonModule,
IonicModule,
CoreAppSettingsRoutingModule,
CorePipesModule,
CoreComponentsModule,
CoreDirectivesModule,
TranslateModule.forChild(),
],
declarations: [
CoreAppSettingsPage,
CoreSettingsAboutPage,
CoreSettingsDeviceInfoPage,
CoreSettingsRoutingModule,
],
declarations: [],
})
export class CoreAppSettingsModule {}
export class CoreSettingsModule {}