diff --git a/src/addon/mod/chat/chat.module.ts b/src/addon/mod/chat/chat.module.ts index 05076c858..db9121dad 100644 --- a/src/addon/mod/chat/chat.module.ts +++ b/src/addon/mod/chat/chat.module.ts @@ -13,10 +13,12 @@ // limitations under the License. import { NgModule } from '@angular/core'; +import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; import { AddonModChatComponentsModule } from './components/components.module'; -import { AddonModChatModuleHandler } from './providers/module-handler'; import { AddonModChatProvider } from './providers/chat'; +import { AddonModChatLinkHandler } from './providers/link-handler'; +import { AddonModChatModuleHandler } from './providers/module-handler'; @NgModule({ declarations: [ @@ -26,11 +28,14 @@ import { AddonModChatProvider } from './providers/chat'; ], providers: [ AddonModChatProvider, + AddonModChatLinkHandler, AddonModChatModuleHandler, ] }) export class AddonModChatModule { - constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChatModuleHandler) { + constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChatModuleHandler, + contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModChatLinkHandler) { moduleDelegate.registerHandler(moduleHandler); + contentLinksDelegate.registerHandler(linkHandler); } } diff --git a/src/addon/mod/chat/components/index/index.html b/src/addon/mod/chat/components/index/index.html index 2feb0cfea..43432d53b 100644 --- a/src/addon/mod/chat/components/index/index.html +++ b/src/addon/mod/chat/components/index/index.html @@ -12,8 +12,8 @@ - - {{ 'addon.mod_chat.sessionstart' | translate:{$a: chatInfo} }} + + {{ 'addon.mod_chat.sessionstart' | translate:{$a: chatInfo} }}
diff --git a/src/addon/mod/chat/pages/chat/chat.ts b/src/addon/mod/chat/pages/chat/chat.ts index 59d4555ad..ba18844d4 100644 --- a/src/addon/mod/chat/pages/chat/chat.ts +++ b/src/addon/mod/chat/pages/chat/chat.ts @@ -221,6 +221,9 @@ export class AddonModChatChatPage { /** * Send a message to the chat. + * + * @param {string} text Text of the nessage. + * @param {number} [beep=0] ID of the user to beep. */ sendMessage(text: string, beep: number = 0): void { if (!this.isOnline) { diff --git a/src/addon/mod/chat/providers/link-handler.ts b/src/addon/mod/chat/providers/link-handler.ts new file mode 100644 index 000000000..a8f727d85 --- /dev/null +++ b/src/addon/mod/chat/providers/link-handler.ts @@ -0,0 +1,29 @@ +// (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 { Injectable } from '@angular/core'; +import { CoreContentLinksModuleIndexHandler } from '@core/contentlinks/classes/module-index-handler'; +import { CoreCourseHelperProvider } from '@core/course/providers/helper'; + +/** + * Handler to treat links to chat. + */ +@Injectable() +export class AddonModChatLinkHandler extends CoreContentLinksModuleIndexHandler { + name = 'AddonModChatLinkHandler'; + + constructor(courseHelper: CoreCourseHelperProvider) { + super(courseHelper, 'AddonModChat', 'chat'); + } +}