diff --git a/src/core/block/components/course-blocks/core-block-course-blocks.html b/src/core/block/components/course-blocks/core-block-course-blocks.html
index 47494de17..52b424c11 100644
--- a/src/core/block/components/course-blocks/core-block-course-blocks.html
+++ b/src/core/block/components/course-blocks/core-block-course-blocks.html
@@ -2,7 +2,7 @@
-
0" [class.core-hide-blocks]="hideBlocks" class="core-course-blocks-side">
+
0 && !hideBlocks" [class.core-hide-blocks]="hideBottomBlocks" class="core-course-blocks-side">
diff --git a/src/core/block/components/course-blocks/course-blocks.ts b/src/core/block/components/course-blocks/course-blocks.ts
index a95a77178..69ca7adc9 100644
--- a/src/core/block/components/course-blocks/course-blocks.ts
+++ b/src/core/block/components/course-blocks/course-blocks.ts
@@ -30,6 +30,7 @@ export class CoreBlockCourseBlocksComponent implements OnInit {
@Input() courseId: number;
@Input() hideBlocks = false;
+ @Input() hideBottomBlocks = false;
@Input() downloadEnabled: boolean;
@ViewChildren(CoreBlockComponent) blocksComponents: QueryList;
@@ -49,6 +50,7 @@ export class CoreBlockCourseBlocksComponent implements OnInit {
* Component being initialized.
*/
ngOnInit(): void {
+ this.element.classList.add('core-no-blocks');
this.loadContent().finally(() => {
this.dataLoaded = true;
});
@@ -89,7 +91,7 @@ export class CoreBlockCourseBlocksComponent implements OnInit {
this.blocks = [];
}).finally(() => {
- if (this.blocks.length > 0) {
+ if (!this.hideBlocks && this.blocks.length > 0) {
this.element.classList.add('core-has-blocks');
this.element.classList.remove('core-no-blocks');
diff --git a/src/core/course/components/format/core-course-format.html b/src/core/course/components/format/core-course-format.html
index 8ce6d7b62..638720e4e 100644
--- a/src/core/course/components/format/core-course-format.html
+++ b/src/core/course/components/format/core-course-format.html
@@ -5,7 +5,7 @@
-
+
diff --git a/src/core/course/components/format/format.ts b/src/core/course/components/format/format.ts
index a5e46d2b5..cc7bab957 100644
--- a/src/core/course/components/format/format.ts
+++ b/src/core/course/components/format/format.ts
@@ -69,6 +69,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
data: any = {};
displaySectionSelector: boolean;
+ displayBlocks: boolean;
selectedSection: any;
previousSection: any;
nextSection: any;
@@ -158,6 +159,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
*/
ngOnInit(): void {
this.displaySectionSelector = this.cfDelegate.displaySectionSelector(this.course);
+ this.displayBlocks = this.cfDelegate.displayBlocks(this.course);
}
/**
diff --git a/src/core/course/formats/singleactivity/providers/handler.ts b/src/core/course/formats/singleactivity/providers/handler.ts
index c9edd07db..a01597c70 100644
--- a/src/core/course/formats/singleactivity/providers/handler.ts
+++ b/src/core/course/formats/singleactivity/providers/handler.ts
@@ -48,6 +48,16 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa
return false;
}
+ /**
+ * Whether the option blocks should be displayed. Defaults to true.
+ *
+ * @param course The course to check.
+ * @return Whether it can display blocks.
+ */
+ displayBlocks(course: any): boolean {
+ return false;
+ }
+
/**
* Get the title to use in course page. If not defined, course displayname or fullname.
* This function will be called without sections first, and then call it again when the sections are retrieved.
diff --git a/src/core/course/providers/default-format.ts b/src/core/course/providers/default-format.ts
index df3e7f401..bbf673151 100644
--- a/src/core/course/providers/default-format.ts
+++ b/src/core/course/providers/default-format.ts
@@ -65,6 +65,16 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler {
return true;
}
+ /**
+ * Whether the option blocks should be displayed. Defaults to true.
+ *
+ * @param course The course to check.
+ * @return Whether it can display blocks.
+ */
+ displayBlocks(course: any): boolean {
+ return true;
+ }
+
/**
* Whether the option to enable section/module download should be displayed. Defaults to true.
*
diff --git a/src/core/course/providers/format-delegate.ts b/src/core/course/providers/format-delegate.ts
index 87279b01e..ceee5af13 100644
--- a/src/core/course/providers/format-delegate.ts
+++ b/src/core/course/providers/format-delegate.ts
@@ -47,6 +47,14 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler {
*/
canViewAllSections?(course: any): boolean;
+ /**
+ * Whether the option blocks should be displayed. Defaults to true.
+ *
+ * @param course The course to check.
+ * @return Whether it can display blocks.
+ */
+ displayBlocks?(course: any): boolean;
+
/**
* Whether the option to enable section/module download should be displayed. Defaults to true.
*
@@ -191,6 +199,16 @@ export class CoreCourseFormatDelegate extends CoreDelegate {
return this.executeFunctionOnEnabled(course.format, 'canViewAllSections', [course]);
}
+ /**
+ * Whether the option blocks should be displayed. Defaults to true.
+ *
+ * @param course The course to check.
+ * @return Whether it can display blocks.
+ */
+ displayBlocks?(course: any): boolean {
+ return this.executeFunctionOnEnabled(course.format, 'displayBlocks', [course]);
+ }
+
/**
* Whether the option to enable section/module download should be displayed. Defaults to true.
*