MOBILE-2602 page: Display timemodified at the end of page
parent
8f99fab2e4
commit
7bc76533c8
|
@ -18,6 +18,7 @@ import { IonicModule } from 'ionic-angular';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreComponentsModule } from '@components/components.module';
|
||||
import { CoreDirectivesModule } from '@directives/directives.module';
|
||||
import { CorePipesModule } from '@pipes/pipes.module';
|
||||
import { CoreCourseComponentsModule } from '@core/course/components/components.module';
|
||||
import { AddonModPageIndexComponent } from './index/index';
|
||||
|
||||
|
@ -31,6 +32,7 @@ import { AddonModPageIndexComponent } from './index/index';
|
|||
TranslateModule.forChild(),
|
||||
CoreComponentsModule,
|
||||
CoreDirectivesModule,
|
||||
CorePipesModule,
|
||||
CoreCourseComponentsModule
|
||||
],
|
||||
providers: [
|
||||
|
|
|
@ -12,10 +12,13 @@
|
|||
<!-- Content. -->
|
||||
<core-loading [hideUntil]="loaded" class="core-loading-center">
|
||||
|
||||
<core-course-module-description [description]="description" [component]="component" [componentId]="componentId"></core-course-module-description>
|
||||
<core-course-module-description *ngIf="displayDescription" [description]="description" [component]="component" [componentId]="componentId"></core-course-module-description>
|
||||
|
||||
<div padding>
|
||||
<core-format-text [component]="component" [componentId]="componentId" [text]="contents"></core-format-text>
|
||||
<p class="addon-mod_page-timemodified" *ngIf="displayTimemodified && page && page.timemodified">
|
||||
{{ 'core.lastmodified' | translate}}: {{ page.timemodified * 1000 | coreFormatDate: "dfmediumdate" }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</core-loading>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import { Component, Injector } from '@angular/core';
|
||||
import { CoreAppProvider } from '@providers/app';
|
||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||
import { CoreCourseProvider } from '@core/course/providers/course';
|
||||
import { CoreCourseModuleMainResourceComponent } from '@core/course/classes/main-resource-component';
|
||||
import { AddonModPageProvider } from '../../providers/page';
|
||||
|
@ -31,11 +32,15 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp
|
|||
component = AddonModPageProvider.COMPONENT;
|
||||
canGetPage: boolean;
|
||||
contents: any;
|
||||
displayDescription = true;
|
||||
displayTimemodified = true;
|
||||
page: any;
|
||||
|
||||
protected fetchContentDefaultError = 'addon.mod_page.errorwhileloadingthepage';
|
||||
|
||||
constructor(injector: Injector, private pageProvider: AddonModPageProvider, private courseProvider: CoreCourseProvider,
|
||||
private appProvider: CoreAppProvider, private pageHelper: AddonModPageHelperProvider,
|
||||
private pagePrefetch: AddonModPagePrefetchHandler) {
|
||||
private pagePrefetch: AddonModPagePrefetchHandler, private utils: CoreUtilsProvider) {
|
||||
super(injector);
|
||||
}
|
||||
|
||||
|
@ -97,6 +102,22 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp
|
|||
if (page) {
|
||||
this.description = page.intro || page.description;
|
||||
this.dataRetrieved.emit(page);
|
||||
|
||||
if (this.canGetPage) {
|
||||
this.page = page;
|
||||
|
||||
// Check if description and timemodified should be displayed.
|
||||
if (page.displayoptions) {
|
||||
const options = this.textUtils.unserialize(page.displayoptions) || {};
|
||||
this.displayDescription = typeof options.printintro == 'undefined' ||
|
||||
this.utils.isTrueOrOne(options.printintro);
|
||||
this.displayTimemodified = typeof options.printlastmodified == 'undefined' ||
|
||||
this.utils.isTrueOrOne(options.printlastmodified);
|
||||
} else {
|
||||
this.displayDescription = true;
|
||||
this.displayTimemodified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
// Ignore errors.
|
||||
|
|
Loading…
Reference in New Issue