diff --git a/src/addons/mod/assign/pages/index/index.ts b/src/addons/mod/assign/pages/index/index.ts index 1d4321208..03b810c1a 100644 --- a/src/addons/mod/assign/pages/index/index.ts +++ b/src/addons/mod/assign/pages/index/index.ts @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, ViewChild } from '@angular/core'; +import { AfterViewInit, Component, ViewChild } from '@angular/core'; import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; import { AddonModAssignIndexComponent } from '../../components/index/index'; +import { CoreNavigator } from '@services/navigator'; +import { CoreUtils } from '@services/utils/utils'; /** * Page that displays an assign. @@ -23,8 +25,30 @@ import { AddonModAssignIndexComponent } from '../../components/index/index'; selector: 'page-addon-mod-assign-index', templateUrl: 'index.html', }) -export class AddonModAssignIndexPage extends CoreCourseModuleMainActivityPage { +export class AddonModAssignIndexPage extends CoreCourseModuleMainActivityPage + implements AfterViewInit { + + private action?: string; @ViewChild(AddonModAssignIndexComponent) activityComponent?: AddonModAssignIndexComponent; + constructor() { + super(); + + this.action = CoreNavigator.getRouteParam('action'); + } + + /** + * @inheritdoc + */ + async ngAfterViewInit(): Promise { + switch (this.action) { + case 'editsubmission': + await CoreUtils.waitFor(() => !!this.activityComponent?.submissionComponent, { timeout: 5000 }); + await this.activityComponent?.submissionComponent?.goToEdit(); + + break; + } + } + } diff --git a/src/addons/mod/assign/services/handlers/index-link.ts b/src/addons/mod/assign/services/handlers/index-link.ts index 3162d8d15..b3f93af53 100644 --- a/src/addons/mod/assign/services/handlers/index-link.ts +++ b/src/addons/mod/assign/services/handlers/index-link.ts @@ -14,6 +14,7 @@ import { Injectable } from '@angular/core'; import { CoreContentLinksModuleIndexHandler } from '@features/contentlinks/classes/module-index-handler'; +import { CoreNavigationOptions } from '@services/navigator'; import { makeSingleton } from '@singletons'; /** @@ -28,5 +29,16 @@ export class AddonModAssignIndexLinkHandlerService extends CoreContentLinksModul super('AddonModAssign', 'assign'); } + /** + * @inheritdoc + */ + getModNavOptions(url: string, params: Record): CoreNavigationOptions { + if (!params.action) { + return {}; + } + + return { params: { action: params.action } }; + } + } export const AddonModAssignIndexLinkHandler = makeSingleton(AddonModAssignIndexLinkHandlerService); diff --git a/src/core/components/swipe-slides/swipe-slides.ts b/src/core/components/swipe-slides/swipe-slides.ts index a5f60f904..0154671e1 100644 --- a/src/core/components/swipe-slides/swipe-slides.ts +++ b/src/core/components/swipe-slides/swipe-slides.ts @@ -21,6 +21,7 @@ import { CorePromisedValue } from '@classes/promised-value'; import { IonContent } from '@ionic/angular'; import { CoreDomUtils, VerticalPoint } from '@services/utils/dom'; import { CoreUtils } from '@services/utils/utils'; +import { NgZone } from '@singletons'; import { CoreDom } from '@singletons/dom'; import { CoreEventObserver } from '@singletons/events'; import { CoreMath } from '@singletons/math'; @@ -62,8 +63,8 @@ export class CoreSwipeSlidesComponent implements OnChanges, OnDe this.swiper.slideTo(this.options.initialSlide, 0, this.options.runCallbacksOnInit); } - this.swiper.on('slideChangeTransitionStart', () => this.slideWillChange()); - this.swiper.on('slideChangeTransitionEnd', () => this.slideDidChange()); + this.swiper.on('slideChangeTransitionStart', () => NgZone.run(() => this.slideWillChange())); + this.swiper.on('slideChangeTransitionEnd', () => NgZone.run(() => this.slideDidChange())); }); } diff --git a/src/core/features/courses/tests/behat/basic_usage.feature b/src/core/features/courses/tests/behat/basic_usage.feature index bc23c6f41..860d27def 100755 --- a/src/core/features/courses/tests/behat/basic_usage.feature +++ b/src/core/features/courses/tests/behat/basic_usage.feature @@ -119,14 +119,21 @@ Feature: Test basic usage of courses in app Scenario: Links to actions in Timeline work for teachers/students # Submit assignment as student Given I entered the app as "student1" - When I press "Add submission" in the app + When I press "assignment" in the app Then the header should be "assignment" in the app And I should find "Test assignment description" in the app And I should find "No attempt" in the app And I should find "Due:" in the app When I press "Add submission" in the app - And I set the field "Online text submissions" to "test" in the app + Then I should find "Online text submissions" in the app + + When I press the back button in the app + And I press the back button in the app + And I press "Add submission" in the app + Then I should find "Online text submissions" in the app + + When I set the field "Online text submissions" to "test" in the app And I press "Save" in the app And I press "Submit assignment" in the app And I press "OK" in the app