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