+
+
diff --git a/src/addon/mod/book/components/toc-popover/toc-popover.ts b/src/addon/mod/book/components/toc-popover/toc-popover.ts
new file mode 100644
index 000000000..01ce767ab
--- /dev/null
+++ b/src/addon/mod/book/components/toc-popover/toc-popover.ts
@@ -0,0 +1,41 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// 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 { Component } from '@angular/core';
+import { NavParams, ViewController } from 'ionic-angular';
+import { AddonModBookTocChapter } from '../../providers/book';
+
+/**
+ * Component to display the TOC of a book.
+ */
+@Component({
+ selector: 'addon-mod-book-toc-popover',
+ templateUrl: 'toc-popover.html'
+})
+export class AddonModBookTocPopoverComponent {
+ chapters: AddonModBookTocChapter[];
+
+ constructor(navParams: NavParams, private viewCtrl: ViewController) {
+ this.chapters = navParams.get('chapters') || [];
+ }
+
+ /**
+ * Function called when a course is clicked.
+ *
+ * @param {string} id ID of the clicked chapter.
+ */
+ loadChapter(id: string): void {
+ this.viewCtrl.dismiss(id);
+ }
+}
diff --git a/src/addon/mod/book/pages/index/index.html b/src/addon/mod/book/pages/index/index.html
new file mode 100644
index 000000000..c0a0d5fa3
--- /dev/null
+++ b/src/addon/mod/book/pages/index/index.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/addon/mod/book/pages/index/index.module.ts b/src/addon/mod/book/pages/index/index.module.ts
new file mode 100644
index 000000000..02b409af8
--- /dev/null
+++ b/src/addon/mod/book/pages/index/index.module.ts
@@ -0,0 +1,33 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// 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 { IonicPageModule } from 'ionic-angular';
+import { TranslateModule } from '@ngx-translate/core';
+import { CoreDirectivesModule } from '../../../../../directives/directives.module';
+import { AddonModBookComponentsModule } from '../../components/components.module';
+import { AddonModBookIndexPage } from './index';
+
+@NgModule({
+ declarations: [
+ AddonModBookIndexPage,
+ ],
+ imports: [
+ CoreDirectivesModule,
+ AddonModBookComponentsModule,
+ IonicPageModule.forChild(AddonModBookIndexPage),
+ TranslateModule.forChild()
+ ],
+})
+export class AddonModBookIndexPageModule {}
diff --git a/src/addon/mod/book/pages/index/index.ts b/src/addon/mod/book/pages/index/index.ts
new file mode 100644
index 000000000..a45a34e1d
--- /dev/null
+++ b/src/addon/mod/book/pages/index/index.ts
@@ -0,0 +1,48 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// 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 { Component, ViewChild } from '@angular/core';
+import { IonicPage, NavParams } from 'ionic-angular';
+import { AddonModBookIndexComponent } from '../../components/index/index';
+
+/**
+ * Page that displays a book.
+ */
+@IonicPage({ segment: 'addon-mod-book-index' })
+@Component({
+ selector: 'page-addon-mod-book-index',
+ templateUrl: 'index.html',
+})
+export class AddonModBookIndexPage {
+ @ViewChild(AddonModBookIndexComponent) bookComponent: AddonModBookIndexComponent;
+
+ title: string;
+ module: any;
+ courseId: number;
+
+ constructor(navParams: NavParams) {
+ this.module = navParams.get('module') || {};
+ this.courseId = navParams.get('courseId');
+ this.title = this.module.name;
+ }
+
+ /**
+ * Update some data based on the book instance.
+ *
+ * @param {any} book Book instance.
+ */
+ updateData(book: any): void {
+ this.title = book.name || this.title;
+ }
+}
diff --git a/src/addon/mod/book/providers/module-handler.ts b/src/addon/mod/book/providers/module-handler.ts
index 179b6e536..495bdbbd3 100644
--- a/src/addon/mod/book/providers/module-handler.ts
+++ b/src/addon/mod/book/providers/module-handler.ts
@@ -50,7 +50,7 @@ export class AddonModBookModuleHandler implements CoreCourseModuleHandler {
title: module.name,
class: 'addon-mod_book-handler',
action(event: Event, navCtrl: NavController, module: any, courseId: number, options: NavOptions): void {
- // @todo
+ navCtrl.push('AddonModBookIndexPage', {module: module, courseId: courseId}, options);
}
};
}