MOBILE-2201 wiki: Tag area handler for wiki pages
parent
0a770f8528
commit
353c6823db
|
@ -843,6 +843,7 @@
|
|||
"addon.mod_wiki.pageexists": "wiki",
|
||||
"addon.mod_wiki.pagename": "wiki",
|
||||
"addon.mod_wiki.subwiki": "local_moodlemobileapp",
|
||||
"addon.mod_wiki.tagarea_wiki_pages": "wiki",
|
||||
"addon.mod_wiki.titleshouldnotbeempty": "local_moodlemobileapp",
|
||||
"addon.mod_wiki.viewpage": "local_moodlemobileapp",
|
||||
"addon.mod_wiki.wikipage": "local_moodlemobileapp",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"pageexists": "This page already exists.",
|
||||
"pagename": "Page name",
|
||||
"subwiki": "Sub-wiki",
|
||||
"tagarea_wiki_pages": "Wiki pages",
|
||||
"titleshouldnotbeempty": "The title should not be empty",
|
||||
"viewpage": "View page",
|
||||
"wikipage": "Wiki page",
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
// (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, Injector } from '@angular/core';
|
||||
import { CoreTagAreaHandler } from '@core/tag/providers/area-delegate';
|
||||
import { CoreTagHelperProvider } from '@core/tag/providers/helper';
|
||||
import { CoreTagFeedComponent } from '@core/tag/components/feed/feed';
|
||||
|
||||
/**
|
||||
* Handler to support tags.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AddonModWikiTagAreaHandler implements CoreTagAreaHandler {
|
||||
name = 'AddonModWikiTagAreaHandler';
|
||||
type = 'mod_wiki/wiki_pages';
|
||||
|
||||
constructor(private tagHelper: CoreTagHelperProvider) {}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled on a site level.
|
||||
* @return {boolean|Promise<boolean>} Whether or not the handler is enabled on a site level.
|
||||
*/
|
||||
isEnabled(): boolean | Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the rendered content of a tag index and returns the items.
|
||||
*
|
||||
* @param {string} content Rendered content.
|
||||
* @return {any[]|Promise<any[]>} Area items (or promise resolved with the items).
|
||||
*/
|
||||
parseContent(content: string): any[] | Promise<any[]> {
|
||||
return this.tagHelper.parseFeedContent(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the component to use to display items.
|
||||
*
|
||||
* @param {Injector} injector Injector.
|
||||
* @return {any|Promise<any>} The component (or promise resolved with component) to use, undefined if not found.
|
||||
*/
|
||||
getComponent(injector: Injector): any | Promise<any> {
|
||||
return CoreTagFeedComponent;
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ import { CoreCronDelegate } from '@providers/cron';
|
|||
import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate';
|
||||
import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate';
|
||||
import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate';
|
||||
import { CoreTagAreaDelegate } from '@core/tag/providers/area-delegate';
|
||||
import { AddonModWikiComponentsModule } from './components/components.module';
|
||||
import { AddonModWikiProvider } from './providers/wiki';
|
||||
import { AddonModWikiOfflineProvider } from './providers/wiki-offline';
|
||||
|
@ -29,6 +30,7 @@ import { AddonModWikiPageOrMapLinkHandler } from './providers/page-or-map-link-h
|
|||
import { AddonModWikiCreateLinkHandler } from './providers/create-link-handler';
|
||||
import { AddonModWikiEditLinkHandler } from './providers/edit-link-handler';
|
||||
import { AddonModWikiListLinkHandler } from './providers/list-link-handler';
|
||||
import { AddonModWikiTagAreaHandler } from './providers/tag-area-handler';
|
||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
||||
|
||||
// List of providers (without handlers).
|
||||
|
@ -55,7 +57,8 @@ export const ADDON_MOD_WIKI_PROVIDERS: any[] = [
|
|||
AddonModWikiPageOrMapLinkHandler,
|
||||
AddonModWikiCreateLinkHandler,
|
||||
AddonModWikiEditLinkHandler,
|
||||
AddonModWikiListLinkHandler
|
||||
AddonModWikiListLinkHandler,
|
||||
AddonModWikiTagAreaHandler
|
||||
]
|
||||
})
|
||||
export class AddonModWikiModule {
|
||||
|
@ -64,7 +67,8 @@ export class AddonModWikiModule {
|
|||
cronDelegate: CoreCronDelegate, syncHandler: AddonModWikiSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
||||
indexHandler: AddonModWikiIndexLinkHandler, pageOrMapHandler: AddonModWikiPageOrMapLinkHandler,
|
||||
createHandler: AddonModWikiCreateLinkHandler, editHandler: AddonModWikiEditLinkHandler,
|
||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModWikiListLinkHandler) {
|
||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModWikiListLinkHandler,
|
||||
tagAreaDelegate: CoreTagAreaDelegate, tagAreaHandler: AddonModWikiTagAreaHandler) {
|
||||
|
||||
moduleDelegate.registerHandler(moduleHandler);
|
||||
prefetchDelegate.registerHandler(prefetchHandler);
|
||||
|
@ -74,6 +78,7 @@ export class AddonModWikiModule {
|
|||
linksDelegate.registerHandler(createHandler);
|
||||
linksDelegate.registerHandler(editHandler);
|
||||
linksDelegate.registerHandler(listLinkHandler);
|
||||
tagAreaDelegate.registerHandler(tagAreaHandler);
|
||||
|
||||
// Allow migrating the tables from the old app to the new schema.
|
||||
updateManager.registerSiteTableMigration({
|
||||
|
|
|
@ -843,6 +843,7 @@
|
|||
"addon.mod_wiki.pageexists": "This page already exists.",
|
||||
"addon.mod_wiki.pagename": "Page name",
|
||||
"addon.mod_wiki.subwiki": "Sub-wiki",
|
||||
"addon.mod_wiki.tagarea_wiki_pages": "Wiki pages",
|
||||
"addon.mod_wiki.titleshouldnotbeempty": "The title should not be empty",
|
||||
"addon.mod_wiki.viewpage": "View page",
|
||||
"addon.mod_wiki.wikipage": "Wiki page",
|
||||
|
|
Loading…
Reference in New Issue