MOBILE-2201 data: Display tags in database entries

main
Albert Gasset 2019-07-08 11:19:05 +02:00
parent 85d214edba
commit c07eb58568
4 changed files with 11 additions and 3 deletions

View File

@ -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();
}
/**

View File

@ -32,3 +32,5 @@
</a>
<a *ngIf="action == 'user' && entry" core-user-link [courseId]="database.courseid" [userId]="entry.userid" [title]="entry.fullname">{{entry.fullname}}</a>
<core-tag-list *ngIf="tagsEnabled && action == 'tags' && entry" [tags]="entry.tags"></core-tag-list>

View File

@ -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: [
],

View File

@ -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
};