From c07eb58568508fe9f5f27b6392321ed4e9207a92 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Mon, 8 Jul 2019 11:19:05 +0200 Subject: [PATCH] MOBILE-2201 data: Display tags in database entries --- src/addon/mod/data/components/action/action.ts | 6 +++++- .../mod/data/components/action/addon-mod-data-action.html | 2 ++ src/addon/mod/data/components/components.module.ts | 4 +++- src/addon/mod/data/providers/helper.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/addon/mod/data/components/action/action.ts b/src/addon/mod/data/components/action/action.ts index 9e96c3d1a..b96dc078d 100644 --- a/src/addon/mod/data/components/action/action.ts +++ b/src/addon/mod/data/components/action/action.ts @@ -20,6 +20,7 @@ import { AddonModDataOfflineProvider } from '../../providers/offline'; import { CoreSitesProvider } from '@providers/sites'; import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; import { CoreUserProvider } from '@core/user/providers/user'; +import { CoreTagProvider } from '@core/tag/providers/tag'; /** * Component that displays a database action. @@ -41,13 +42,16 @@ export class AddonModDataActionComponent implements OnInit { rootUrl: string; url: string; userPicture: string; + tagsEnabled: boolean; constructor(protected injector: Injector, protected dataProvider: AddonModDataProvider, protected dataOffline: AddonModDataOfflineProvider, protected eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, protected userProvider: CoreUserProvider, private navCtrl: NavController, - protected linkHelper: CoreContentLinksHelperProvider, private dataHelper: AddonModDataHelperProvider) { + protected linkHelper: CoreContentLinksHelperProvider, private dataHelper: AddonModDataHelperProvider, + private tagProvider: CoreTagProvider) { this.rootUrl = sitesProvider.getCurrentSite().getURL(); this.siteId = sitesProvider.getCurrentSiteId(); + this.tagsEnabled = this.tagProvider.areTagsAvailableInSite(); } /** diff --git a/src/addon/mod/data/components/action/addon-mod-data-action.html b/src/addon/mod/data/components/action/addon-mod-data-action.html index 41a44e5fa..b6c9e9924 100644 --- a/src/addon/mod/data/components/action/addon-mod-data-action.html +++ b/src/addon/mod/data/components/action/addon-mod-data-action.html @@ -32,3 +32,5 @@ {{entry.fullname}} + + diff --git a/src/addon/mod/data/components/components.module.ts b/src/addon/mod/data/components/components.module.ts index 3470ae872..ef12a46b3 100644 --- a/src/addon/mod/data/components/components.module.ts +++ b/src/addon/mod/data/components/components.module.ts @@ -25,6 +25,7 @@ import { AddonModDataFieldPluginComponent } from './field-plugin/field-plugin'; import { AddonModDataActionComponent } from './action/action'; import { CoreCompileHtmlComponentModule } from '@core/compile/components/compile-html/compile-html.module'; import { CoreCommentsComponentsModule } from '@core/comments/components/components.module'; +import { CoreTagComponentsModule } from '@core/tag/components/components.module'; @NgModule({ declarations: [ @@ -41,7 +42,8 @@ import { CoreCommentsComponentsModule } from '@core/comments/components/componen CorePipesModule, CoreCourseComponentsModule, CoreCompileHtmlComponentModule, - CoreCommentsComponentsModule + CoreCommentsComponentsModule, + CoreTagComponentsModule ], providers: [ ], diff --git a/src/addon/mod/data/providers/helper.ts b/src/addon/mod/data/providers/helper.ts index b5aaadcec..477eed3fc 100644 --- a/src/addon/mod/data/providers/helper.ts +++ b/src/addon/mod/data/providers/helper.ts @@ -367,6 +367,7 @@ export class AddonModDataHelperProvider { userpicture: true, timeadded: true, timemodified: true, + tags: true, edit: record.canmanageentry && !record.deleted, // This already checks capabilities and readonly period. delete: record.canmanageentry, @@ -377,7 +378,6 @@ export class AddonModDataHelperProvider { comments: database.comments, // Unsupported actions. - tags: false, delcheck: false, export: false };