diff --git a/src/core/features/course/components/course-index/course-index.html b/src/core/features/course/components/course-index/course-index.html index 15319b6b4..bdff39b4c 100644 --- a/src/core/features/course/components/course-index/course-index.html +++ b/src/core/features/course/components/course-index/course-index.html @@ -53,7 +53,7 @@
- !CoreCourseHelper.isSectionStealth(section)) .map((section) => { @@ -92,6 +96,7 @@ export class CoreCourseCourseIndexComponent implements OnInit { course: module.course, visible: !!module.visible, uservisible: CoreCourseHelper.canUserViewModule(module, section), + indented: enableIndentation && module.indent > 0, completionStatus, }; }); @@ -170,6 +175,7 @@ type CourseIndexSection = { id: number; course: number; visible: boolean; + indented: boolean; uservisible: boolean; completionStatus?: CoreCourseModuleCompletionStatus; }[]; diff --git a/src/core/features/course/components/module/module.scss b/src/core/features/course/components/module/module.scss index 3485350cf..84b5db76c 100644 --- a/src/core/features/course/components/module/module.scss +++ b/src/core/features/course/components/module/module.scss @@ -101,4 +101,15 @@ margin-right: 4px; } } + + &.indented ion-card { + border: none; + border-radius: 0; + margin-inline-start: calc(var(--horizontal-margin) + 1rem); + } + + &.indented + ::ng-deep core-course-module.indented ion-card { + border-top: 1px solid var(--border-color); + } + } diff --git a/src/core/features/course/components/module/module.ts b/src/core/features/course/components/module/module.ts index e190819e8..8d9863dda 100644 --- a/src/core/features/course/components/module/module.ts +++ b/src/core/features/course/components/module/module.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, Input, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core'; +import { Component, Input, Output, EventEmitter, OnInit, OnDestroy, HostBinding } from '@angular/core'; import { CoreSites } from '@services/sites'; import { @@ -52,6 +52,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { @Input() showLegacyCompletion?: boolean; // Whether to show module completion in the old format. @Input() isLastViewed = false; // Whether it's the last module viewed in a course. @Output() completionChanged = new EventEmitter(); // Notify when module completion changes. + @HostBinding('class.indented') indented = false; modNameTranslated = ''; hasInfo = false; @@ -69,10 +70,13 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { * @inheritdoc */ async ngOnInit(): Promise { + const site = CoreSites.getRequiredCurrentSite(); + + this.indented = site.isVersionGreaterEqualThan('4.2') && this.module.indent > 0; this.modNameTranslated = CoreCourse.translateModuleName(this.module.modname, this.module.modplural); this.showLegacyCompletion = this.showLegacyCompletion ?? CoreConstants.CONFIG.uselegacycompletion ?? - !CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('3.11'); + !site.isVersionGreaterEqualThan('3.11'); this.checkShowManualCompletion(); if (!this.module.handlerData) { diff --git a/src/core/features/course/tests/behat/basic_usage.feature b/src/core/features/course/tests/behat/basic_usage.feature index 74b735629..af1c73e2d 100755 --- a/src/core/features/course/tests/behat/basic_usage.feature +++ b/src/core/features/course/tests/behat/basic_usage.feature @@ -71,6 +71,15 @@ Feature: Test basic usage of one course in app | activity | name | intro | course | idnumber | groupmode | section | | workshop | Test workshop name | Test workshop | C1 | workshop | 0 | 3 | + # TODO remove once MDL-77951 is resolved. + And I log in as "admin" + And I am on "Course 1" course homepage with editing mode on + And I open "Choice course 1" actions menu + And I click on "Move right" "link" in the "Choice course 1" activity + And I open "assignment" actions menu + And I click on "Move right" "link" in the "assignment" activity + And I log out + Scenario: View course contents When I entered the course "Course 1" as "student1" in the app Then the header should be "Course 1" in the app diff --git a/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_39.png b/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_39.png deleted file mode 100644 index 6be3fbb7e..000000000 Binary files a/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_39.png and /dev/null differ diff --git a/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_46.png b/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_46.png new file mode 100644 index 000000000..e9671788f Binary files /dev/null and b/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_46.png differ