diff --git a/src/addons/storagemanager/services/handlers/course-menu.ts b/src/addons/storagemanager/services/handlers/course-menu.ts deleted file mode 100644 index 74dc8f409..000000000 --- a/src/addons/storagemanager/services/handlers/course-menu.ts +++ /dev/null @@ -1,62 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import { Injectable } from '@angular/core'; -import { CoreCourseOptionsMenuHandler, CoreCourseOptionsMenuHandlerData } from '@features/course/services/course-options-delegate'; -import { CoreCourseAnyCourseDataWithOptions } from '@features/courses/services/courses'; -import { makeSingleton } from '@singletons'; - -/** - * Handler to inject an option into course menu so that user can get to the manage storage page. - */ -@Injectable( { providedIn: 'root' }) -export class AddonStorageManagerCourseMenuHandlerService implements CoreCourseOptionsMenuHandler { - - name = 'AddonStorageManager'; - priority = 500; - isMenuHandler = true; - - /** - * @inheritdoc - */ - async isEnabledForCourse(): Promise { - return true; - } - - /** - * @inheritdoc - */ - async isEnabled(): Promise { - return true; - } - - /** - * @inheritdoc - */ - getMenuDisplayData( - course: CoreCourseAnyCourseDataWithOptions, - ): CoreCourseOptionsMenuHandlerData { - return { - icon: 'fas-cloud-download-alt', - title: 'addon.storagemanager.coursedownloads', - page: 'storage/' + course.id, - pageParams: { - title: course.displayname ?? course.fullname, - }, - class: 'addon-storagemanager-coursemenu-handler', - }; - } - -} -export const AddonStorageManagerCourseMenuHandler = makeSingleton(AddonStorageManagerCourseMenuHandlerService); diff --git a/src/addons/storagemanager/storagemanager.module.ts b/src/addons/storagemanager/storagemanager.module.ts index 187d66cdd..fbf97bdaf 100644 --- a/src/addons/storagemanager/storagemanager.module.ts +++ b/src/addons/storagemanager/storagemanager.module.ts @@ -14,12 +14,10 @@ import { NgModule, APP_INITIALIZER } from '@angular/core'; import { Routes } from '@angular/router'; -import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; import { CoreSettingsDelegate } from '@features/settings/services/settings-delegate'; -import { AddonStorageManagerCourseMenuHandler } from './services/handlers/course-menu'; import { AddonStorageManagerSettingsHandler } from './services/handlers/settings'; const routes: Routes = [ @@ -41,7 +39,6 @@ const routes: Routes = [ provide: APP_INITIALIZER, multi: true, useValue: () => { - CoreCourseOptionsDelegate.registerHandler(AddonStorageManagerCourseMenuHandler.instance); CoreSettingsDelegate.registerHandler(AddonStorageManagerSettingsHandler.instance); }, }, diff --git a/src/core/components/iframe/core-iframe.html b/src/core/components/iframe/core-iframe.html index 776cfbbee..78c405420 100644 --- a/src/core/components/iframe/core-iframe.html +++ b/src/core/components/iframe/core-iframe.html @@ -1,6 +1,6 @@
- + diff --git a/src/core/features/course/components/module-summary/module-summary.html b/src/core/features/course/components/module-summary/module-summary.html index 52dc0f284..09a0e3354 100644 --- a/src/core/features/course/components/module-summary/module-summary.html +++ b/src/core/features/course/components/module-summary/module-summary.html @@ -58,7 +58,7 @@

- + {{ 'addon.storagemanager.downloads' | translate }}

@@ -81,7 +81,7 @@
- + {{ 'core.download' | translate }} diff --git a/src/core/features/course/pages/contents/contents.html b/src/core/features/course/pages/contents/contents.html index 64ff48a05..bc3f404f8 100644 --- a/src/core/features/course/pages/contents/contents.html +++ b/src/core/features/course/pages/contents/contents.html @@ -1,4 +1,7 @@ - + + + + diff --git a/src/core/features/course/pages/contents/contents.ts b/src/core/features/course/pages/contents/contents.ts index 85d7bfce1..81953a209 100644 --- a/src/core/features/course/pages/contents/contents.ts +++ b/src/core/features/course/pages/contents/contents.ts @@ -29,7 +29,6 @@ import { } from '@features/course/services/course-helper'; import { CoreCourseFormatDelegate } from '@features/course/services/format-delegate'; import { CoreCourseModulePrefetchDelegate } from '@features/course/services/module-prefetch-delegate'; -import { CoreCourseOptionsMenuHandlerToDisplay } from '@features/course/services/course-options-delegate'; import { CoreCourseSync, CoreCourseSyncProvider } from '@features/course/services/sync'; import { CoreCourseFormatComponent } from '../../components/course-format/course-format'; import { @@ -54,7 +53,6 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy { sections?: CoreCourseSection[]; sectionId?: number; sectionNumber?: number; - courseMenuHandlers: CoreCourseOptionsMenuHandlerToDisplay[] = []; dataLoaded = false; downloadCourseEnabled = false; moduleId?: number; @@ -368,8 +366,16 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy { } } + gotoCourseDownloads(): void { + CoreNavigator.navigateToSitePath( + `storage/${this.course.id}`, + { params: { title: this.course.fullname } }, + ); + + } + /** - * Page destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.isDestroyed = true;