MOBILE-3833 module: Support empty module navigation

main
Pau Ferrer Ocaña 2022-03-29 10:47:18 +02:00
parent 0a950061d7
commit bbd0d5bb9b
2 changed files with 10 additions and 2 deletions

View File

@ -21,6 +21,10 @@
margin-top: var(--button-vertical-margin);
margin-bottom: var(--button-vertical-margin);
}
&.empty {
display: none;
}
}
:host-context(core-course-format.core-course-format-singleactivity) {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import { CoreCourse, CoreCourseWSSection } from '@features/course/services/course';
import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -44,11 +44,13 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
nextModuleSection?: CoreCourseWSSection;
previousModuleSection?: CoreCourseWSSection;
loaded = false;
element: HTMLElement;
protected completionObserver: CoreEventObserver;
constructor(protected ionContent: IonContent) {
constructor(protected ionContent: IonContent, element: ElementRef) {
const siteId = CoreSites.getCurrentSiteId();
this.element = element.nativeElement;
this.completionObserver = CoreEvents.on(CoreEvents.COMPLETION_MODULE_VIEWED, async (data) => {
if (data && data.courseId == this.courseId) {
@ -168,6 +170,8 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
}
}
}
this.element.classList.toggle('empty', !this.nextModule && !this.previousModule);
}
/**