MOBILE-2310 course: Implement social format

main
Dani Palou 2018-01-18 10:02:47 +01:00
parent 514e9bf132
commit 46ad0912ea
4 changed files with 61 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import { CoreCourseModuleDelegate } from './providers/module-delegate';
import { CoreCourseModulePrefetchDelegate } from './providers/module-prefetch-delegate';
import { CoreCourseFormatDefaultHandler } from './providers/default-format';
import { CoreCourseFormatSingleActivityModule } from './formats/singleactivity/singleactivity.module';
import { CoreCourseFormatSocialModule } from './formats/social/social.module';
import { CoreCourseFormatTopicsModule} from './formats/topics/topics.module';
import { CoreCourseFormatWeeksModule } from './formats/weeks/weeks.module';
@ -28,7 +29,8 @@ import { CoreCourseFormatWeeksModule } from './formats/weeks/weeks.module';
imports: [
CoreCourseFormatSingleActivityModule,
CoreCourseFormatTopicsModule,
CoreCourseFormatWeeksModule
CoreCourseFormatWeeksModule,
CoreCourseFormatSocialModule
],
providers: [
CoreCourseProvider,

View File

@ -17,7 +17,7 @@ import { CoreCourseFormatHandler } from '../../../providers/format-delegate';
import { CoreCourseFormatSingleActivityComponent } from '../components/format';
/**
* Handler to support weeks course format.
* Handler to support singleactivity course format.
*/
@Injectable()
export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHandler {

View File

@ -0,0 +1,25 @@
// (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 { CoreCourseFormatSingleActivityHandler } from '../../singleactivity/providers/handler';
/**
* Handler to support social course format.
* This format is like singleactivity in the mobile app, so we'll use the same implementation for both.
*/
@Injectable()
export class CoreCourseFormatSocialHandler extends CoreCourseFormatSingleActivityHandler {
name = 'social';
}

View File

@ -0,0 +1,32 @@
// (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 { CoreCourseFormatSocialHandler } from './providers/handler';
import { CoreCourseFormatDelegate } from '../../providers/format-delegate';
@NgModule({
declarations: [],
imports: [
],
providers: [
CoreCourseFormatSocialHandler
],
exports: []
})
export class CoreCourseFormatSocialModule {
constructor(formatDelegate: CoreCourseFormatDelegate, handler: CoreCourseFormatSocialHandler) {
formatDelegate.registerHandler(handler);
}
}