commit
d103f50769
|
@ -326,10 +326,17 @@ export class AddonModForumDiscussionPage implements OnDestroy {
|
|||
}).then(() => {
|
||||
let posts = offlineReplies.concat(onlinePosts);
|
||||
|
||||
const startingPost = this.forumProvider.extractStartingPost(posts);
|
||||
if (startingPost) {
|
||||
// Update discussion data from first post.
|
||||
this.discussion = Object.assign(this.discussion || {}, startingPost);
|
||||
}
|
||||
|
||||
// If sort type is nested, normal sorting is disabled and nested posts will be displayed.
|
||||
if (this.sort == 'nested') {
|
||||
// Sort first by creation date to make format tree work.
|
||||
this.forumProvider.sortDiscussionPosts(posts, 'ASC');
|
||||
|
||||
posts = this.utils.formatTree(posts, 'parent', 'id', this.discussion.id);
|
||||
} else {
|
||||
// Set default reply subject.
|
||||
|
@ -364,7 +371,7 @@ export class AddonModForumDiscussionPage implements OnDestroy {
|
|||
}
|
||||
}));
|
||||
|
||||
// Fetch the discussion if not passed as parameter.
|
||||
// The discussion object was not passed as parameter and there is no starting post. Should not happen.
|
||||
if (!this.discussion) {
|
||||
promises.push(this.loadDiscussion(this.forumId, this.discussionId));
|
||||
}
|
||||
|
@ -373,12 +380,9 @@ export class AddonModForumDiscussionPage implements OnDestroy {
|
|||
}).catch(() => {
|
||||
// Ignore errors.
|
||||
}).then(() => {
|
||||
const startingPost = this.forumProvider.extractStartingPost(posts);
|
||||
if (startingPost) {
|
||||
// Update discussion data from first post.
|
||||
this.discussion = Object.assign(this.discussion || {}, startingPost);
|
||||
} else if (!this.discussion) {
|
||||
// The discussion object was not passed as parameter and there is no starting post.
|
||||
|
||||
if (!this.discussion) {
|
||||
// The discussion object was not passed as parameter and there is no starting post. Should not happen.
|
||||
return Promise.reject('Invalid forum discussion.');
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ export class AddonModForumDiscussionLinkHandler extends CoreContentLinksHandlerB
|
|||
return [{
|
||||
action: (siteId, navCtrl?): void => {
|
||||
const pageParams: any = {
|
||||
courseId: courseId || parseInt(params.courseid, 10) || parseInt(params.cid, 10),
|
||||
courseId: courseId || parseInt(params.courseid, 10) || parseInt(params.cid, 10) || undefined,
|
||||
discussionId: parseInt(params.d, 10),
|
||||
cmId: data.cmid && parseInt(data.cmid, 10),
|
||||
forumId: data.instance && parseInt(data.instance, 10)
|
||||
|
|
|
@ -278,14 +278,9 @@ export class AddonModForumProvider {
|
|||
* @return Starting post or undefined if not found.
|
||||
*/
|
||||
extractStartingPost(posts: any[]): any {
|
||||
// Check the last post first, since they'll usually be ordered by create time.
|
||||
for (let i = posts.length - 1; i >= 0; i--) {
|
||||
if (posts[i].parent == 0) {
|
||||
return posts.splice(i, 1).pop(); // Remove it from the array.
|
||||
}
|
||||
}
|
||||
const index = posts.findIndex((post) => post.parent == 0);
|
||||
|
||||
return undefined;
|
||||
return index >= 0 ? posts.splice(index, 1).pop() : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -101,7 +101,11 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
|
|||
// Create the navigation modal.
|
||||
this.menuModal = modalCtrl.create('AddonModLessonMenuModalPage', {
|
||||
page: this
|
||||
});
|
||||
}, { cssClass: 'core-modal-lateral',
|
||||
showBackdrop: true,
|
||||
enableBackdropDismiss: true,
|
||||
enterAnimation: 'core-modal-lateral-transition',
|
||||
leaveAnimation: 'core-modal-lateral-transition' });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -202,9 +202,11 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
});
|
||||
}).then(() => {
|
||||
if (courseId) {
|
||||
return this.surveyProvider.invalidateSurveyData(courseId, siteId).then(() => {
|
||||
// Data has been sent to server, update survey data.
|
||||
return this.courseProvider.getModuleBasicInfoByInstance(surveyId, 'survey', siteId).then((module) => {
|
||||
return this.prefetchAfterUpdate(module, courseId, undefined, siteId);
|
||||
});
|
||||
}).catch(() => {
|
||||
// Ignore errors.
|
||||
});
|
||||
|
|
|
@ -367,6 +367,9 @@ ion-app.app-root {
|
|||
color: $black;
|
||||
border-radius: 5px;
|
||||
background: rgba(255, 255, 255, .5);
|
||||
@include darkmode() {
|
||||
background-color: rgba(0, 0, 0, .5);
|
||||
}
|
||||
text-align: center;
|
||||
|
||||
width: 32px;
|
||||
|
@ -376,6 +379,8 @@ ion-app.app-root {
|
|||
font-size: 24px;
|
||||
ion-icon {
|
||||
font-size: 24px;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ ion-app.app-root core-rich-text-editor {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
@include darkmode() {
|
||||
background-color: $black;
|
||||
background-color: $gray-darker;
|
||||
}
|
||||
|
||||
.core-rte-editor, .core-textarea {
|
||||
|
@ -17,7 +17,7 @@ ion-app.app-root core-rich-text-editor {
|
|||
resize: none;
|
||||
background-color: $white;
|
||||
@include darkmode() {
|
||||
background-color: $black;
|
||||
background-color: $gray-darker;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<core-loading [hideUntil]="loaded">
|
||||
<core-empty-box *ngIf="!modules || !modules.length" icon="qr-scanner" [message]="'core.course.nocontentavailable' | translate"></core-empty-box>
|
||||
<core-empty-box *ngIf="!sections || !sections.length" icon="qr-scanner" [message]="'core.course.nocontentavailable' | translate"></core-empty-box>
|
||||
|
||||
<ion-list>
|
||||
<ng-container *ngFor="let module of modules">
|
||||
<core-course-module *ngIf="module.visibleoncoursepage !== 0" [module]="module" [courseId]="courseId" [downloadEnabled]="downloadEnabled"></core-course-module>
|
||||
<ng-container text-wrap *ngFor="let section of sections" >
|
||||
<ng-container *ngFor="let module of section.modules">
|
||||
<core-course-module *ngIf="module.visibleoncoursepage !== 0" [module]="module" [section]="section" [courseId]="courseId" [downloadEnabled]="downloadEnabled"></core-course-module>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ion-list>
|
||||
</core-loading>
|
||||
|
|
|
@ -31,7 +31,7 @@ import { CoreConstants } from '@core/constants';
|
|||
})
|
||||
export class CoreCourseListModTypePage {
|
||||
|
||||
modules = [];
|
||||
sections = [];
|
||||
title: string;
|
||||
loaded = false;
|
||||
downloadEnabled = false;
|
||||
|
@ -69,17 +69,15 @@ export class CoreCourseListModTypePage {
|
|||
// Get all the modules in the course.
|
||||
return this.courseProvider.getSections(this.courseId, false, true).then((sections) => {
|
||||
|
||||
this.modules = [];
|
||||
|
||||
sections.forEach((section) => {
|
||||
this.sections = sections.filter((section) => {
|
||||
if (!section.modules) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
section.modules.forEach((mod) => {
|
||||
section.modules = section.modules.filter((mod) => {
|
||||
if (mod.uservisible === false || !this.courseProvider.moduleHasView(mod)) {
|
||||
// Ignore this module.
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.modName === 'resources') {
|
||||
|
@ -90,21 +88,18 @@ export class CoreCourseListModTypePage {
|
|||
}
|
||||
|
||||
if (this.archetypes[mod.modname] == CoreConstants.MOD_ARCHETYPE_RESOURCE) {
|
||||
this.modules.push(mod);
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (mod.modname == this.modName) {
|
||||
this.modules.push(mod);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return section.modules.length > 0;
|
||||
});
|
||||
|
||||
// Get the handler data for the modules.
|
||||
const fakeSection = {
|
||||
visible: 1,
|
||||
modules: this.modules
|
||||
};
|
||||
this.courseHelper.addHandlerDataForModules([fakeSection], this.courseId);
|
||||
this.courseHelper.addHandlerDataForModules(this.sections, this.courseId);
|
||||
}).catch((error) => {
|
||||
this.domUtils.showErrorModalDefault(error, 'Error getting data');
|
||||
});
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<h2 text-wrap><core-format-text [text]="site.siteName" clean="true" [siteId]="site.id"></core-format-text></h2>
|
||||
<p text-wrap>{{ site.fullName }}</p>
|
||||
<div item-end>
|
||||
<p>{{ site.spaceUsage | coreBytesToSize }}</p>
|
||||
<p>{{ 'core.settings.entriesincache' | translate: { $a: site.cacheEntries } }}</p>
|
||||
<p *ngIf="site.spaceUsage != null" text-end>{{ site.spaceUsage | coreBytesToSize }}</p>
|
||||
<p *ngIf="site.cacheEntries != null" text-end>{{ 'core.settings.entriesincache' | translate: { $a: site.cacheEntries } }}</p>
|
||||
</div>
|
||||
<button ion-button icon-only clear color="danger" item-end (click)="deleteSiteStorage(site)" [hidden]="!site.spaceUsage > '0' && !site.cacheEntries > '0'" [attr.aria-label]="'core.settings.deletesitefilestitle' | translate">
|
||||
<ion-icon name="trash"></ion-icon>
|
||||
|
|
Loading…
Reference in New Issue