From 3a11cdbfe2898f5da44fc7b6bf1a337f61b3d8cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 25 Feb 2022 12:31:30 +0100 Subject: [PATCH] MOBILE-3149 module: Add collapsible footer buttons inside activities --- scripts/langindex.json | 2 - src/addons/mod/data/pages/entry/entry.html | 24 ++--- src/addons/mod/feedback/lang.json | 2 - src/addons/mod/feedback/pages/form/form.html | 82 ++++++++--------- src/addons/mod/feedback/pages/form/form.ts | 6 +- .../mod/lesson/pages/player/player.html | 29 +++--- .../mod/lesson/services/lesson-helper.ts | 2 +- .../navigation-modal/navigation-modal.html | 32 ++----- .../navigation-modal/navigation-modal.ts | 16 ---- .../mod/quiz/pages/attempt/attempt.html | 14 ++- src/addons/mod/quiz/pages/player/player.html | 90 +++++++------------ .../mod/quiz/pages/player/player.page.ts | 6 +- src/addons/mod/quiz/pages/review/review.html | 46 +++++----- .../mod/quiz/pages/review/review.page.ts | 15 +--- .../qtype/essay/services/handlers/essay.ts | 2 +- src/core/components/timer/timer.scss | 1 + src/core/features/course/lang.json | 4 +- 17 files changed, 153 insertions(+), 220 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index 11f362ee4..081689da2 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -576,7 +576,6 @@ "addon.mod_feedback.minimal": "feedback", "addon.mod_feedback.mode": "feedback", "addon.mod_feedback.modulenameplural": "feedback", - "addon.mod_feedback.next_page": "feedback", "addon.mod_feedback.non_anonymous": "feedback", "addon.mod_feedback.non_anonymous_entries": "feedback", "addon.mod_feedback.non_respondents_students": "feedback", @@ -586,7 +585,6 @@ "addon.mod_feedback.overview": "feedback", "addon.mod_feedback.page_after_submit": "feedback", "addon.mod_feedback.preview": "moodle", - "addon.mod_feedback.previous_page": "feedback", "addon.mod_feedback.questions": "feedback", "addon.mod_feedback.questionscountdescription": "local_moodlemobileapp", "addon.mod_feedback.response_nr": "feedback", diff --git a/src/addons/mod/data/pages/entry/entry.html b/src/addons/mod/data/pages/entry/entry.html index 7ecfe25c5..e66b33145 100644 --- a/src/addons/mod/data/pages/entry/entry.html +++ b/src/addons/mod/data/pages/entry/entry.html @@ -60,21 +60,23 @@ (onLoading)="setLoadingComments($event)" [showItem]="true"> - - - - - - {{ 'core.previous' | translate }} +
+ + + + - - - {{ 'core.next' | translate }} - + + + + + - +
diff --git a/src/addons/mod/feedback/lang.json b/src/addons/mod/feedback/lang.json index 903a127e3..bfab7c6e0 100644 --- a/src/addons/mod/feedback/lang.json +++ b/src/addons/mod/feedback/lang.json @@ -18,7 +18,6 @@ "minimal": "Minimum", "mode": "Mode", "modulenameplural": "Feedback", - "next_page": "Next page", "non_anonymous": "User's name will be logged and shown with answers", "non_anonymous_entries": "Non anonymous entries ({{$a}})", "non_respondents_students": "Non-respondent students ({{$a}})", @@ -28,7 +27,6 @@ "overview": "Overview", "page_after_submit": "Completion message", "preview": "Preview", - "previous_page": "Previous page", "questions": "Questions", "questionscountdescription": "There are {{count}} questions.", "response_nr": "Response number", diff --git a/src/addons/mod/feedback/pages/form/form.html b/src/addons/mod/feedback/pages/form/form.html index 4ed5b620f..e2a2a4079 100644 --- a/src/addons/mod/feedback/pages/form/form.html +++ b/src/addons/mod/feedback/pages/form/form.html @@ -109,32 +109,31 @@ - - - - - - {{ 'addon.mod_feedback.previous_page' | translate }} - - - - - {{ 'addon.mod_feedback.next_page' | translate }} - - - - - - {{ 'addon.mod_feedback.save_entries' | translate }} - - - - + + + + + + {{ 'core.previous' | translate }} + + + + + {{ 'core.next' | translate }} + + + + + + {{ 'core.submit' | translate }} + + + - +

@@ -143,32 +142,25 @@

{{ 'addon.mod_feedback.feedback_submitted_offline' | translate }}

-

- - -

+ +
- - - - - - - {{ 'addon.mod_feedback.completed_feedbacks' | translate }} - - - - - {{ 'core.continue' | translate }} - - - - - - +
+
+ + + {{ 'addon.mod_feedback.completed_feedbacks' | translate }} + + + {{ 'core.continue' | translate }} + {{ 'core.course.gotonextactivity' | translate }} + +
+
diff --git a/src/addons/mod/feedback/pages/form/form.ts b/src/addons/mod/feedback/pages/form/form.ts index 5807d7e3e..8134221a6 100644 --- a/src/addons/mod/feedback/pages/form/form.ts +++ b/src/addons/mod/feedback/pages/form/form.ts @@ -16,7 +16,7 @@ import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { CoreSite } from '@classes/site'; import { CoreContentLinksHelper } from '@features/contentlinks/services/contentlinks-helper'; import { CoreCourse, CoreCourseCommonModWSOptions } from '@features/course/services/course'; -import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper'; +import { CoreCourseModuleData } from '@features/course/services/course-helper'; import { CanLeave } from '@guards/can-leave'; import { IonContent } from '@ionic/angular'; import { CoreApp } from '@services/app'; @@ -53,7 +53,6 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { protected module?: CoreCourseModuleData; protected currentPage?: number; - protected siteAfterSubmit?: string; protected onlineObserver: Subscription; protected originalData?: Record; protected currentSite: CoreSite; @@ -75,6 +74,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { hasNextPage = false; completed = false; completedOffline = false; + siteAfterSubmit?: string; constructor() { this.currentSite = CoreSites.getRequiredCurrentSite(); @@ -409,7 +409,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { */ async continue(): Promise { if (!this.siteAfterSubmit) { - return CoreCourseHelper.getAndOpenCourse(this.courseId, {}, this.currentSite.getId()); + return CoreNavigator.back(); } const modal = await CoreDomUtils.showModalLoading(); diff --git a/src/addons/mod/lesson/pages/player/player.html b/src/addons/mod/lesson/pages/player/player.html index 3d0739c2f..adb7dd441 100644 --- a/src/addons/mod/lesson/pages/player/player.html +++ b/src/addons/mod/lesson/pages/player/player.html @@ -21,7 +21,7 @@ - + {{ messages[0].message }} @@ -86,13 +86,12 @@ - - - - + {{ 'core.content' | translate }} + + @@ -185,12 +184,12 @@ -
- + + {{ 'addon.mod_lesson.progressbarteacherwarning2' | translate }} -
+
@@ -254,8 +253,8 @@ {{ eolData.modattemptsnoteacher.message }} - + @@ -290,10 +289,10 @@ - + {{ 'addon.mod_lesson.finish' | translate }} - {{ button.label | translate }} diff --git a/src/addons/mod/lesson/services/lesson-helper.ts b/src/addons/mod/lesson/services/lesson-helper.ts index 669a9bd5b..1ec765591 100644 --- a/src/addons/mod/lesson/services/lesson-helper.ts +++ b/src/addons/mod/lesson/services/lesson-helper.ts @@ -557,7 +557,7 @@ export class AddonModLessonHelperProvider { // Add some HTML to the answer if needed. if (textarea) { - data[textarea.name] = CoreTextUtils.formatHtmlLines( data[textarea.name]); + data[textarea.name] = CoreTextUtils.formatHtmlLines( data[textarea.name] || ''); } } else if (question.template == 'multichoice' && ( question).multi) { // Only send the options with value set to true. diff --git a/src/addons/mod/quiz/components/navigation-modal/navigation-modal.html b/src/addons/mod/quiz/components/navigation-modal/navigation-modal.html index 9899cb608..239b919fa 100644 --- a/src/addons/mod/quiz/components/navigation-modal/navigation-modal.html +++ b/src/addons/mod/quiz/components/navigation-modal/navigation-modal.html @@ -13,19 +13,6 @@ + + + + {{ 'addon.mod_quiz.finishattemptdots' | translate }} + + diff --git a/src/addons/mod/quiz/components/navigation-modal/navigation-modal.ts b/src/addons/mod/quiz/components/navigation-modal/navigation-modal.ts index 92c958c0a..93fb6848c 100644 --- a/src/addons/mod/quiz/components/navigation-modal/navigation-modal.ts +++ b/src/addons/mod/quiz/components/navigation-modal/navigation-modal.ts @@ -26,15 +26,10 @@ import { ModalController } from '@singletons'; }) export class AddonModQuizNavigationModalComponent { - static readonly CHANGE_PAGE = 1; - static readonly SWITCH_MODE = 2; - @Input() navigation?: AddonModQuizNavigationQuestion[]; // Whether the user is reviewing the attempt. @Input() summaryShown?: boolean; // Whether summary is currently being shown. @Input() currentPage?: number; // Current page. @Input() isReview?: boolean; // Whether the user is reviewing the attempt. - @Input() numPages = 0; // Num of pages for review mode. - @Input() showAll?: boolean; // Whether to show all questions in same page or not for review mode. /** * Close modal. @@ -51,21 +46,11 @@ export class AddonModQuizNavigationModalComponent { */ loadPage(page: number, slot?: number): void { ModalController.dismiss({ - action: AddonModQuizNavigationModalComponent.CHANGE_PAGE, page, slot, }); } - /** - * Switch mode in review. - */ - switchMode(): void { - ModalController.dismiss({ - action: AddonModQuizNavigationModalComponent.SWITCH_MODE, - }); - } - } /** @@ -76,7 +61,6 @@ export type AddonModQuizNavigationQuestion = CoreQuestionQuestionParsed & { }; export type AddonModQuizNavigationModalReturn = { - action: number; page?: number; slot?: number; }; diff --git a/src/addons/mod/quiz/pages/attempt/attempt.html b/src/addons/mod/quiz/pages/attempt/attempt.html index 9454e17a9..c6a47f24d 100644 --- a/src/addons/mod/quiz/pages/attempt/attempt.html +++ b/src/addons/mod/quiz/pages/attempt/attempt.html @@ -53,15 +53,21 @@

- - - {{ 'addon.mod_quiz.review' | translate }} - +

{{ 'addon.mod_quiz.noreviewattempt' | translate }}

+ +
+
+ + + {{ 'addon.mod_quiz.review' | translate }} + +
+
diff --git a/src/addons/mod/quiz/pages/player/player.html b/src/addons/mod/quiz/pages/player/player.html index b234f85ef..089a3ecf9 100644 --- a/src/addons/mod/quiz/pages/player/player.html +++ b/src/addons/mod/quiz/pages/player/player.html @@ -28,32 +28,10 @@ - - - - - - - - - - - - - - - - - - - - {{ 'addon.mod_quiz.startattempt' | translate }} @@ -89,22 +67,23 @@ - - - - - - {{ 'core.previous' | translate }} - - - - - {{ 'core.next' | translate }} - - - - - + + + + + {{ 'core.previous' | translate }} + + + + + {{ 'core.next' | translate }} + + + + {{ 'core.submit' | translate }} + + + @@ -141,11 +120,6 @@ - - - {{ 'addon.mod_quiz.returnattempt' | translate }} - - {{ dueDateWarning }} @@ -162,17 +136,6 @@

{{message}}

- - - {{ 'core.openinbrowser' | translate }} - - - - - - {{ 'addon.mod_quiz.submitallandfinish' | translate }} -
@@ -180,10 +143,25 @@ {{ 'addon.mod_quiz.errorparsequestions' | translate }} - + + {{ 'addon.mod_quiz.returnattempt' | translate }} + + + +
+ {{ 'core.openinbrowser' | translate }} - + + + + {{ 'addon.mod_quiz.submitallandfinish' | translate }} + +
diff --git a/src/addons/mod/quiz/pages/player/player.page.ts b/src/addons/mod/quiz/pages/player/player.page.ts index 16e1a22de..d022c6d5e 100644 --- a/src/addons/mod/quiz/pages/player/player.page.ts +++ b/src/addons/mod/quiz/pages/player/player.page.ts @@ -602,9 +602,11 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { }, }); - if (modalData && modalData.action == AddonModQuizNavigationModalComponent.CHANGE_PAGE) { - this.changePage(modalData.page!, true, modalData.slot); + if (!modalData) { + return; } + + this.changePage(modalData.page!, true, modalData.slot); } /** diff --git a/src/addons/mod/quiz/pages/review/review.html b/src/addons/mod/quiz/pages/review/review.html index 068dc2a6f..38286d18a 100644 --- a/src/addons/mod/quiz/pages/review/review.html +++ b/src/addons/mod/quiz/pages/review/review.html @@ -87,8 +87,6 @@
- -
@@ -113,28 +111,30 @@
+
- - +
+ + + + + + + + + + {{ 'addon.mod_quiz.showall' | translate }} + {{ 'addon.mod_quiz.showeachpage' | translate }} + + + + + + + +
- - - - - - - - - - - - - - - - - - diff --git a/src/addons/mod/quiz/pages/review/review.page.ts b/src/addons/mod/quiz/pages/review/review.page.ts index 07fb1c5cd..04b7bb7a7 100644 --- a/src/addons/mod/quiz/pages/review/review.page.ts +++ b/src/addons/mod/quiz/pages/review/review.page.ts @@ -53,7 +53,7 @@ export class AddonModQuizReviewPage implements OnInit { attempt?: AddonModQuizAttemptWSData; // The attempt being reviewed. component = AddonModQuizProvider.COMPONENT; // Component to link the files to. showAll = false; // Whether to view all questions in the same page. - numPages?: number; // Number of pages. + numPages = 1; // Number of pages. showCompleted = false; // Whether to show completed time. additionalData?: AddonModQuizWSAdditionalData[]; // Additional data to display for the attempt. loaded = false; // Whether data has been loaded. @@ -112,10 +112,9 @@ export class AddonModQuizReviewPage implements OnInit { * Change the current page. If slot is supplied, try to scroll to that question. * * @param page Page to load. -1 means all questions in same page. - * @param fromModal Whether the page was selected using the navigation modal. * @param slot Slot of the question to scroll to. */ - async changePage(page: number, fromModal?: boolean, slot?: number): Promise { + async changePage(page: number, slot?: number): Promise { if (slot !== undefined && (this.attempt!.currentpage == -1 || page == this.currentPage)) { // Scrol to a certain question in the current page. this.scrollToQuestion(slot); @@ -183,7 +182,7 @@ export class AddonModQuizReviewPage implements OnInit { this.setSummaryCalculatedData(data); this.questions = data.questions; - this.nextPage = page == -1 ? -2 : page + 1; + this.nextPage = page + 1; this.previousPage = page - 1; this.questions.forEach((question) => { @@ -341,8 +340,6 @@ export class AddonModQuizReviewPage implements OnInit { summaryShown: false, currentPage: this.attempt?.currentpage, isReview: true, - numPages: this.numPages, - showAll: this.showAll, }, }); @@ -350,11 +347,7 @@ export class AddonModQuizReviewPage implements OnInit { return; } - if (modalData.action == AddonModQuizNavigationModalComponent.CHANGE_PAGE) { - this.changePage(modalData.page!, true, modalData.slot); - } else if (modalData.action == AddonModQuizNavigationModalComponent.SWITCH_MODE) { - this.switchMode(); - } + this.changePage(modalData.page!, modalData.slot); } } diff --git a/src/addons/qtype/essay/services/handlers/essay.ts b/src/addons/qtype/essay/services/handlers/essay.ts index 707c9737e..94b3912b0 100644 --- a/src/addons/qtype/essay/services/handlers/essay.ts +++ b/src/addons/qtype/essay/services/handlers/essay.ts @@ -516,7 +516,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { if (!isPlainText) { // Add some HTML to the text if needed. - answers[textarea.name] = CoreTextUtils.formatHtmlLines( answers[textarea.name]); + answers[textarea.name] = CoreTextUtils.formatHtmlLines( answers[textarea.name] || ''); } } diff --git a/src/core/components/timer/timer.scss b/src/core/components/timer/timer.scss index 077ea389d..c7c9cc39c 100644 --- a/src/core/components/timer/timer.scss +++ b/src/core/components/timer/timer.scss @@ -6,6 +6,7 @@ $core-timer-iterations: 15 !default; :host { .core-timer { --background: transparent !important; + border-radius: var(--big-radius); .core-timer-time-left, .core-timesup { font-weight: bold; diff --git a/src/core/features/course/lang.json b/src/core/features/course/lang.json index 554f22f43..efa7b5613 100644 --- a/src/core/features/course/lang.json +++ b/src/core/features/course/lang.json @@ -35,9 +35,9 @@ "errordownloadingsection": "Error downloading section.", "errorgetmodule": "Error getting activity data.", "failed": "Failed", - "gotonextactivity": "Continue to next activity", + "gotonextactivity": "Go to next activity", "gotonextactivitynotfound": "Next activity not found. It's possible that it has been hidden or deleted.", - "gotopreviousactivity": "Continue to previous activity", + "gotopreviousactivity": "Go to previous activity", "gotopreviousactivitynotfound": "Previous activity not found. It's possible that it has been hidden or deleted.", "hiddenfromstudents": "Hidden from students", "hiddenoncoursepage": "Available but not shown on course page",