MOBILE-2201 forum: Tag area handler for forum posts
parent
e698537cf7
commit
f1591b1113
|
@ -553,6 +553,7 @@
|
|||
"addon.mod_forum.reply": "forum",
|
||||
"addon.mod_forum.replyplaceholder": "forum",
|
||||
"addon.mod_forum.subject": "forum",
|
||||
"addon.mod_forum.tagarea_forum_posts": "forum",
|
||||
"addon.mod_forum.thisforumhasduedate": "forum",
|
||||
"addon.mod_forum.thisforumisdue": "forum",
|
||||
"addon.mod_forum.unlockdiscussion": "forum",
|
||||
|
|
|
@ -18,6 +18,7 @@ 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 { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||
import { CoreTagAreaDelegate } from '@core/tag/providers/area-delegate';
|
||||
import { AddonModForumProvider } from './providers/forum';
|
||||
import { AddonModForumOfflineProvider } from './providers/offline';
|
||||
import { AddonModForumHelperProvider } from './providers/helper';
|
||||
|
@ -30,6 +31,7 @@ import { AddonModForumDiscussionLinkHandler } from './providers/discussion-link-
|
|||
import { AddonModForumListLinkHandler } from './providers/list-link-handler';
|
||||
import { AddonModForumPostLinkHandler } from './providers/post-link-handler';
|
||||
import { AddonModForumPushClickHandler } from './providers/push-click-handler';
|
||||
import { AddonModForumTagAreaHandler } from './providers/tag-area-handler';
|
||||
import { AddonModForumComponentsModule } from './components/components.module';
|
||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
||||
|
||||
|
@ -59,7 +61,8 @@ export const ADDON_MOD_FORUM_PROVIDERS: any[] = [
|
|||
AddonModForumListLinkHandler,
|
||||
AddonModForumPostLinkHandler,
|
||||
AddonModForumDiscussionLinkHandler,
|
||||
AddonModForumPushClickHandler
|
||||
AddonModForumPushClickHandler,
|
||||
AddonModForumTagAreaHandler
|
||||
]
|
||||
})
|
||||
export class AddonModForumModule {
|
||||
|
@ -69,7 +72,8 @@ export class AddonModForumModule {
|
|||
indexHandler: AddonModForumIndexLinkHandler, discussionHandler: AddonModForumDiscussionLinkHandler,
|
||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModForumListLinkHandler,
|
||||
pushNotificationsDelegate: CorePushNotificationsDelegate, pushClickHandler: AddonModForumPushClickHandler,
|
||||
postLinkHandler: AddonModForumPostLinkHandler) {
|
||||
postLinkHandler: AddonModForumPostLinkHandler, tagAreaDelegate: CoreTagAreaDelegate,
|
||||
tagAreaHandler: AddonModForumTagAreaHandler) {
|
||||
|
||||
moduleDelegate.registerHandler(moduleHandler);
|
||||
prefetchDelegate.registerHandler(prefetchHandler);
|
||||
|
@ -79,6 +83,7 @@ export class AddonModForumModule {
|
|||
linksDelegate.registerHandler(listLinkHandler);
|
||||
linksDelegate.registerHandler(postLinkHandler);
|
||||
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
||||
tagAreaDelegate.registerHandler(tagAreaHandler);
|
||||
|
||||
// Allow migrating the tables from the old app to the new schema.
|
||||
updateManager.registerSiteTablesMigration([
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
"reply": "Reply",
|
||||
"replyplaceholder": "Write your reply...",
|
||||
"subject": "Subject",
|
||||
"tagarea_forum_posts": "Forum posts",
|
||||
"thisforumhasduedate": "The due date for posting to this forum is {{$a}}.",
|
||||
"thisforumisdue": "The due date for posting to this forum was {{$a}}.",
|
||||
"unlockdiscussion": "Unlock this discussion",
|
||||
|
|
|
@ -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 AddonModForumTagAreaHandler implements CoreTagAreaHandler {
|
||||
name = 'AddonModForumTagAreaHandler';
|
||||
type = 'mod_forum/forum_posts';
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -553,6 +553,7 @@
|
|||
"addon.mod_forum.reply": "Reply",
|
||||
"addon.mod_forum.replyplaceholder": "Write your reply...",
|
||||
"addon.mod_forum.subject": "Subject",
|
||||
"addon.mod_forum.tagarea_forum_posts": "Forum posts",
|
||||
"addon.mod_forum.thisforumhasduedate": "The due date for posting to this forum is {{$a}}.",
|
||||
"addon.mod_forum.thisforumisdue": "The due date for posting to this forum was {{$a}}.",
|
||||
"addon.mod_forum.unlockdiscussion": "Unlock this discussion",
|
||||
|
|
Loading…
Reference in New Issue