From a34736bc60ab0ae7d5c0cab0ac13e1c942a80e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 18 Feb 2022 12:41:04 +0100 Subject: [PATCH] MOBILE-3814 module: Adapt module preview page --- scripts/langindex.json | 3 - .../module-info/core-course-module-info.html | 33 +++++++---- .../module-info/course-module-info.scss | 26 ++++++++- .../components/module-info/module-info.ts | 2 + .../core-course-unsupported-module.html | 37 ++++++------ .../unsupported-module/unsupported-module.ts | 9 +-- src/core/features/course/lang.json | 2 - .../pages/module-preview/module-preview.html | 56 ++++++------------- .../module-preview/module-preview.page.ts | 3 + src/core/lang.json | 1 - 10 files changed, 91 insertions(+), 81 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index e1beb3757..092fbfb2c 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1517,10 +1517,8 @@ "core.course": "moodle", "core.course.activitydisabled": "local_moodlemobileapp", "core.course.activitynotyetviewableremoteaddon": "local_moodlemobileapp", - "core.course.activitynotyetviewablesiteupgradeneeded": "local_moodlemobileapp", "core.course.allsections": "local_moodlemobileapp", "core.course.aria:sectionprogress": "local_moodlemobileapp", - "core.course.askadmintosupport": "local_moodlemobileapp", "core.course.availablespace": "local_moodlemobileapp", "core.course.cannotdeletewhiledownloading": "local_moodlemobileapp", "core.course.completion_automatic:done": "course", @@ -2357,7 +2355,6 @@ "core.whatisyourage": "moodle", "core.wheredoyoulive": "moodle", "core.whoissiteadmin": "local_moodlemobileapp", - "core.whoops": "local_moodlemobileapp", "core.whyisthishappening": "local_moodlemobileapp", "core.whyisthisrequired": "moodle", "core.wsfunctionnotavailable": "local_moodlemobileapp", diff --git a/src/core/features/course/components/module-info/core-course-module-info.html b/src/core/features/course/components/module-info/core-course-module-info.html index 256f2c789..f6f50dd35 100644 --- a/src/core/features/course/components/module-info/core-course-module-info.html +++ b/src/core/features/course/components/module-info/core-course-module-info.html @@ -7,6 +7,8 @@ + @@ -20,22 +22,33 @@ - + + - -
-

- {{ date.label }} {{ date.timestamp * 1000 | - coreFormatDate:'strftimedatetime' }} -

-
-
+ +
+ +
+

+ {{ date.label }} {{ date.timestamp + * + 1000 | coreFormatDate:'strftimedatetime' }} +

+
+ +
+ + + +
+
+ diff --git a/src/core/features/course/components/module-info/course-module-info.scss b/src/core/features/course/components/module-info/course-module-info.scss index 46d6c970c..75e76aedd 100644 --- a/src/core/features/course/components/module-info/course-module-info.scss +++ b/src/core/features/course/components/module-info/course-module-info.scss @@ -16,16 +16,38 @@ align-self: flex-start; } - .core-module-dates { + h1 ion-icon { + color: var(--medium); + @include margin-horizontal(8px, null); + font-size: 80%; + + } + + .core-module-dates-availabilityinfo { background: var(--light); border-radius: var(--small-radius); padding: 8px; - + margin: 8px; + font-size: 90%; ion-icon { + position: static; @include margin-horizontal(null, 8px); } + + p, + ul { + margin-top: 4px; + margin-bottom: 4px; + } } + .core-module-dates + .core-module-availabilityinfo { + border-top: 1px solid var(--stroke); + padding-top: 8px; + } + + + } :host-context(.core-iframe-fullscreen) { diff --git a/src/core/features/course/components/module-info/module-info.ts b/src/core/features/course/components/module-info/module-info.ts index f57b95e7e..bd1fe0780 100644 --- a/src/core/features/course/components/module-info/module-info.ts +++ b/src/core/features/course/components/module-info/module-info.ts @@ -44,6 +44,8 @@ export class CoreCourseModuleInfoComponent implements OnInit { @Input() description?: string | false; // The description to display. If false, no description will be shown. @Input() expandDescription = false; // If the description should be expanded by default. + @Input() showAvailabilityInfo = false; // If show availability info on the box. + @Input() hasDataToSync = false; // If the activity has any data to be synced. modicon = ''; diff --git a/src/core/features/course/components/unsupported-module/core-course-unsupported-module.html b/src/core/features/course/components/unsupported-module/core-course-unsupported-module.html index 4fd22a35d..f8b7bd52f 100644 --- a/src/core/features/course/components/unsupported-module/core-course-unsupported-module.html +++ b/src/core/features/course/components/unsupported-module/core-course-unsupported-module.html @@ -1,21 +1,22 @@ -
-

{{ 'core.whoops' | translate }}

-

{{ 'core.uhoh' | translate }}

- -

{{ 'core.course.activitydisabled' | translate }}

-

- {{ 'core.course.activitynotyetviewablesiteupgradeneeded' | translate }} -

-

- {{ 'core.course.activitynotyetviewableremoteaddon' | translate }} -

-

{{ 'core.course.askadmintosupport' | translate }}

- -
-

{{ 'core.course.useactivityonbrowser' | translate }}

- + + + + +

{{ 'core.uhoh' | translate }} + {{ 'core.course.activitydisabled' | translate }} + + {{ 'core.course.activitynotyetviewableremoteaddon' | translate }} + +

+
+
+
+ + +

{{ 'core.course.useactivityonbrowser' | translate }}

+ {{ 'core.openinbrowser' | translate }} -
-
+ +
diff --git a/src/core/features/course/components/unsupported-module/unsupported-module.ts b/src/core/features/course/components/unsupported-module/unsupported-module.ts index 5df40ab8f..15c3e7902 100644 --- a/src/core/features/course/components/unsupported-module/unsupported-module.ts +++ b/src/core/features/course/components/unsupported-module/unsupported-module.ts @@ -14,7 +14,6 @@ import { Component, Input, OnInit } from '@angular/core'; -import { CoreCourse } from '@features/course/services/course'; import { CoreCourseModuleData } from '@features/course/services/course-helper'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; @@ -27,12 +26,10 @@ import { CoreCourseModuleDelegate } from '@features/course/services/module-deleg }) export class CoreCourseUnsupportedModuleComponent implements OnInit { - @Input() courseId?: number; // The course to module belongs to. + @Input() courseId?: number; // The course to module belongs to (unused). @Input() module?: CoreCourseModuleData; // The module to render. - isDisabledInSite?: boolean; - isSupportedByTheApp?: boolean; - moduleName?: string; + isDisabledInSite = false; // It is implicit than if not disabled it will be unsupported. /** * Component being initialized. @@ -43,8 +40,6 @@ export class CoreCourseUnsupportedModuleComponent implements OnInit { } this.isDisabledInSite = CoreCourseModuleDelegate.isModuleDisabledInSite(this.module.modname); - this.isSupportedByTheApp = CoreCourseModuleDelegate.hasHandler(this.module.modname); - this.moduleName = CoreCourse.translateModuleName(this.module.modname); } } diff --git a/src/core/features/course/lang.json b/src/core/features/course/lang.json index 36f792de9..554f22f43 100644 --- a/src/core/features/course/lang.json +++ b/src/core/features/course/lang.json @@ -1,10 +1,8 @@ { "activitydisabled": "Your organisation has disabled this activity in the mobile app.", "activitynotyetviewableremoteaddon": "Your organisation installed a plugin that is not yet supported.", - "activitynotyetviewablesiteupgradeneeded": "Your organisation's Moodle installation needs to be updated.", "allsections": "All sections", "aria:sectionprogress": "Section progress:", - "askadmintosupport": "Contact the site administrator and tell them you want to use this activity with the Moodle Mobile app.", "availablespace": " You currently have about {{available}} free space.", "cannotdeletewhiledownloading": "Files cannot be deleted while the activity is being downloaded. Please wait for the download to finish.", "completion_automatic:done": "Done:", diff --git a/src/core/features/course/pages/module-preview/module-preview.html b/src/core/features/course/pages/module-preview/module-preview.html index eb42c4b54..010351d87 100644 --- a/src/core/features/course/pages/module-preview/module-preview.html +++ b/src/core/features/course/pages/module-preview/module-preview.html @@ -11,8 +11,8 @@ - + @@ -24,44 +24,24 @@ + [componentId]="module.id" [expandDescription]="true" [showAvailabilityInfo]="true"> +
+ + + - - -
- - - -
- - -
- - {{ 'core.course.hiddenfromstudents' | translate }} - -
-
- - {{ 'core.course.hiddenoncoursepage' | translate }} - -
- - -
- - - -
-
-
- - + + + {{ 'core.course.hiddenfromstudents' | translate }} + + + {{ 'core.course.hiddenoncoursepage' | translate }} + +
+ +
void; // Update the module after a certain time. @@ -80,6 +81,8 @@ export class CoreCourseModulePreviewPage implements OnInit { if (!this.unsupported) { this.module.handlerData = await CoreCourseModuleDelegate.getModuleDataFor(this.module.modname, this.module, this.courseId); + } else { + this.isDisabledInSite = CoreCourseModuleDelegate.isModuleDisabledInSite(this.module.modname); } this.title = this.module.name; diff --git a/src/core/lang.json b/src/core/lang.json index 5b58a7e07..2a72d84e7 100644 --- a/src/core/lang.json +++ b/src/core/lang.json @@ -342,7 +342,6 @@ "whatisyourage": "What is your age?", "wheredoyoulive": "In which country do you live?", "whoissiteadmin": "\"Site Administrators\" are the people who manage the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.", - "whoops": "Oops!", "whyisthishappening": "Why is this happening?", "whyisthisrequired": "Why is this required?", "wsfunctionnotavailable": "The web service function is not available.",