MOBILE-2201 blog: Display tags in blog posts

main
Albert Gasset 2019-07-08 11:13:50 +02:00
parent f5cfda53a5
commit 2ea97b0840
3 changed files with 11 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { CorePipesModule } from '@pipes/pipes.module'; import { CorePipesModule } from '@pipes/pipes.module';
import { CoreCommentsComponentsModule } from '@core/comments/components/components.module'; import { CoreCommentsComponentsModule } from '@core/comments/components/components.module';
import { CoreTagComponentsModule } from '@core/tag/components/components.module';
import { AddonBlogEntriesComponent } from './entries/entries'; import { AddonBlogEntriesComponent } from './entries/entries';
@NgModule({ @NgModule({
@ -33,7 +34,8 @@ import { AddonBlogEntriesComponent } from './entries/entries';
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
CorePipesModule, CorePipesModule,
CoreCommentsComponentsModule CoreCommentsComponentsModule,
CoreTagComponentsModule
], ],
providers: [ providers: [
], ],

View File

@ -29,6 +29,10 @@
</ion-item> </ion-item>
<ion-card-content> <ion-card-content>
<core-format-text [text]="entry.summary" [component]="this.component" [componentId]="entry.id"></core-format-text> <core-format-text [text]="entry.summary" [component]="this.component" [componentId]="entry.id"></core-format-text>
<ion-item text-wrap *ngIf="tagsEnabled && entry.tags && entry.tags.length > 0">
<div item-start>{{ 'core.tag.tags' | translate }}:</div>
<core-tag-list [tags]="entry.tags"></core-tag-list>
</ion-item>
<ion-item *ngIf="commentsEnabled"> <ion-item *ngIf="commentsEnabled">
<core-comments [component]="this.component" [itemId]="entry.id" area="format_blog" [instanceId]="entry.userid" contextLevel="user"></core-comments> <core-comments [component]="this.component" [itemId]="entry.id" area="format_blog" [instanceId]="entry.userid" contextLevel="user"></core-comments>
</ion-item> </ion-item>

View File

@ -19,6 +19,7 @@ import { CoreSitesProvider } from '@providers/sites';
import { CoreUserProvider } from '@core/user/providers/user'; import { CoreUserProvider } from '@core/user/providers/user';
import { AddonBlogProvider } from '../../providers/blog'; import { AddonBlogProvider } from '../../providers/blog';
import { CoreCommentsProvider } from '@core/comments/providers/comments'; import { CoreCommentsProvider } from '@core/comments/providers/comments';
import { CoreTagProvider } from '@core/tag/providers/tag';
/** /**
* Component that displays the blog entries. * Component that displays the blog entries.
@ -49,10 +50,11 @@ export class AddonBlogEntriesComponent implements OnInit {
onlyMyEntries = false; onlyMyEntries = false;
component = AddonBlogProvider.COMPONENT; component = AddonBlogProvider.COMPONENT;
commentsEnabled: boolean; commentsEnabled: boolean;
tagsEnabled: boolean;
constructor(protected blogProvider: AddonBlogProvider, protected domUtils: CoreDomUtilsProvider, constructor(protected blogProvider: AddonBlogProvider, protected domUtils: CoreDomUtilsProvider,
protected userProvider: CoreUserProvider, sitesProvider: CoreSitesProvider, protected userProvider: CoreUserProvider, sitesProvider: CoreSitesProvider,
protected commentsProvider: CoreCommentsProvider) { protected commentsProvider: CoreCommentsProvider, private tagProvider: CoreTagProvider) {
this.currentUserId = sitesProvider.getCurrentSiteUserId(); this.currentUserId = sitesProvider.getCurrentSiteUserId();
} }
@ -85,6 +87,7 @@ export class AddonBlogEntriesComponent implements OnInit {
} }
this.commentsEnabled = !this.commentsProvider.areCommentsDisabledInSite(); this.commentsEnabled = !this.commentsProvider.areCommentsDisabledInSite();
this.tagsEnabled = this.tagProvider.areTagsAvailableInSite();
this.fetchEntries().then(() => { this.fetchEntries().then(() => {
this.blogProvider.logView(this.filter).catch(() => { this.blogProvider.logView(this.filter).catch(() => {