MOBILE-2491 filter: Implement algebra filter

main
Dani Palou 2019-10-09 15:02:53 +02:00
parent 0d41e7206c
commit 926e786688
3 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,34 @@
// (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 { IonicModule } from 'ionic-angular';
import { CoreFilterDelegate } from '@core/filter/providers/delegate';
import { AddonFilterAlgebraHandler } from './providers/handler';
@NgModule({
declarations: [
],
imports: [
IonicModule
],
providers: [
AddonFilterAlgebraHandler
]
})
export class AddonFilterAlgebraModule {
constructor(filterDelegate: CoreFilterDelegate, handler: AddonFilterAlgebraHandler) {
filterDelegate.registerHandler(handler);
}
}

View File

@ -0,0 +1,45 @@
// (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 { Injectable } from '@angular/core';
import { CoreFilterDefaultHandler } from '@core/filter/providers/default-filter';
import { CoreFilterFormatTextOptions } from '@core/filter/providers/filter';
import { CoreSite } from '@classes/site';
/**
* Handler to support the Algebra notation filter.
*/
@Injectable()
export class AddonFilterAlgebraHandler extends CoreFilterDefaultHandler {
name = 'AddonFilterAlgebraHandler';
filterName = 'algebra';
constructor() {
super();
// This filter is handled by Moodle, nothing to do in the app.
}
/**
* Check if the filter should be applied in a certain site based on some filter options.
*
* @param options Options.
* @param site Site.
* @return Whether filter should be applied.
*/
shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean {
return false;
}
}

View File

@ -14,6 +14,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { AddonFilterActivityNamesModule } from './activitynames/activitynames.module'; import { AddonFilterActivityNamesModule } from './activitynames/activitynames.module';
import { AddonFilterAlgebraModule } from './algebra/algebra.module';
import { AddonFilterCensorModule } from './censor/censor.module'; import { AddonFilterCensorModule } from './censor/censor.module';
import { AddonFilterDataModule } from './data/data.module'; import { AddonFilterDataModule } from './data/data.module';
import { AddonFilterEmailProtectModule } from './emailprotect/emailprotect.module'; import { AddonFilterEmailProtectModule } from './emailprotect/emailprotect.module';
@ -29,6 +30,7 @@ import { AddonFilterUrlToLinkModule } from './urltolink/urltolink.module';
declarations: [], declarations: [],
imports: [ imports: [
AddonFilterActivityNamesModule, AddonFilterActivityNamesModule,
AddonFilterAlgebraModule,
AddonFilterCensorModule, AddonFilterCensorModule,
AddonFilterDataModule, AddonFilterDataModule,
AddonFilterEmailProtectModule, AddonFilterEmailProtectModule,