diff --git a/src/core/course/lang/en.json b/src/core/course/lang/en.json
index f4997d593..a672d3a15 100644
--- a/src/core/course/lang/en.json
+++ b/src/core/course/lang/en.json
@@ -18,6 +18,7 @@
"hiddenfromstudents": "Hidden from students",
"nocontentavailable": "No content available at the moment.",
"overriddennotice": "Your final grade from this activity was manually adjusted.",
+ "refreshcourse": "Refresh course",
"sections": "Sections",
"useactivityonbrowser": "You can still use it using your device's web browser."
}
\ No newline at end of file
diff --git a/src/core/course/pages/section/section.html b/src/core/course/pages/section/section.html
index 56cd025b4..cb9f66456 100644
--- a/src/core/course/pages/section/section.html
+++ b/src/core/course/pages/section/section.html
@@ -13,7 +13,7 @@
-
+
diff --git a/src/core/course/pages/section/section.ts b/src/core/course/pages/section/section.ts
index 33d30e128..3c5f55f39 100644
--- a/src/core/course/pages/section/section.ts
+++ b/src/core/course/pages/section/section.ts
@@ -49,7 +49,8 @@ export class CoreCourseSectionPage implements OnDestroy {
downloadEnabled: boolean;
downloadEnabledIcon = 'square-outline'; // Disabled by default.
prefetchCourseData = {
- prefetchCourseIcon: 'spinner'
+ prefetchCourseIcon: 'spinner',
+ title: 'core.course.downloadcourse'
};
moduleId: number;
displayEnableDownload: boolean;
@@ -83,7 +84,7 @@ export class CoreCourseSectionPage implements OnDestroy {
// Listen for changes in course status.
this.courseStatusObserver = eventsProvider.on(CoreEventsProvider.COURSE_STATUS_CHANGED, (data) => {
if (data.courseId == this.course.id) {
- this.prefetchCourseData.prefetchCourseIcon = this.courseHelper.getCourseStatusIconFromStatus(data.status);
+ this.updateCourseStatus(data.status);
}
}, sitesProvider.getCurrentSiteId());
}
@@ -116,7 +117,7 @@ export class CoreCourseSectionPage implements OnDestroy {
} else {
// No download, this probably means that the app was closed while downloading. Set previous status.
this.courseProvider.setCoursePreviousStatus(this.course.id).then((status) => {
- this.prefetchCourseData.prefetchCourseIcon = this.courseHelper.getCourseStatusIconFromStatus(status);
+ this.updateCourseStatus(status);
});
}
}
@@ -273,8 +274,9 @@ export class CoreCourseSectionPage implements OnDestroy {
* @return {Promise} Promise resolved when done.
*/
protected determineCoursePrefetchIcon(): Promise {
- return this.courseHelper.getCourseStatusIcon(this.course.id).then((icon) => {
- this.prefetchCourseData.prefetchCourseIcon = icon;
+ return this.courseHelper.getCourseStatusIconAndTitle(this.course.id).then((data) => {
+ this.prefetchCourseData.prefetchCourseIcon = data.icon;
+ this.prefetchCourseData.title = data.title;
});
}
@@ -305,6 +307,18 @@ export class CoreCourseSectionPage implements OnDestroy {
this.downloadEnabledIcon = this.downloadEnabled ? 'checkbox-outline' : 'square-outline';
}
+ /**
+ * Update the course status icon and title.
+ *
+ * @param {string} status Status to show.
+ */
+ protected updateCourseStatus(status: string): void {
+ const statusData = this.courseHelper.getCourseStatusIconAndTitleFromStatus(status);
+
+ this.prefetchCourseData.prefetchCourseIcon = statusData.icon;
+ this.prefetchCourseData.title = statusData.title;
+ }
+
/**
* Page destroyed.
*/
diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts
index 02502ef0c..02418da21 100644
--- a/src/core/course/providers/helper.ts
+++ b/src/core/course/providers/helper.ts
@@ -245,20 +245,22 @@ export class CoreCourseHelperProvider {
* This function will set the icon to "spinner" when starting and it will also set it back to the initial icon if the
* user cancels. All the other updates of the icon should be made when CoreEventsProvider.COURSE_STATUS_CHANGED is received.
*
- * @param {any} iconData An object where to store the course icon. It will be stored with the name "prefetchCourseIcon".
+ * @param {any} data An object where to store the course icon and title: "prefetchCourseIcon" and "title".
* @param {any} course Course to prefetch.
* @param {any[]} [sections] List of course sections.
* @param {CoreCourseOptionsHandlerToDisplay[]} courseHandlers List of course handlers.
* @return {Promise} Promise resolved when the download finishes, rejected if an error occurs or the user cancels.
*/
- confirmAndPrefetchCourse(iconData: any, course: any, sections?: any[], courseHandlers?: CoreCourseOptionsHandlerToDisplay[])
+ confirmAndPrefetchCourse(data: any, course: any, sections?: any[], courseHandlers?: CoreCourseOptionsHandlerToDisplay[])
: Promise {
- const initialIcon = iconData.prefetchCourseIcon,
+ const initialIcon = data.prefetchCourseIcon,
+ initialTitle = data.title,
siteId = this.sitesProvider.getCurrentSiteId();
let promise;
- iconData.prefetchCourseIcon = 'spinner';
+ data.prefetchCourseIcon = 'spinner';
+ data.title = 'core.downloading';
// Get the sections first if needed.
if (sections) {
@@ -286,7 +288,8 @@ export class CoreCourseHelperProvider {
});
}, (error): any => {
// User cancelled or there was an error calculating the size.
- iconData.prefetchCourseIcon = initialIcon;
+ data.prefetchCourseIcon = initialIcon;
+ data.title = initialTitle;
return Promise.reject(error);
});
@@ -729,32 +732,41 @@ export class CoreCourseHelperProvider {
}
/**
- * Get a course status icon.
+ * Get a course status icon and the langkey to use as a title.
*
* @param {number} courseId Course ID.
* @param {string} [siteId] Site ID. If not defined, current site.
- * @return {Promise} Promise resolved with the icon name.
+ * @return {Promise<{icon: string, title: string}>} Promise resolved with the icon name and the title key.
*/
- getCourseStatusIcon(courseId: number, siteId?: string): Promise {
+ getCourseStatusIconAndTitle(courseId: number, siteId?: string): Promise<{icon: string, title: string}> {
return this.courseProvider.getCourseStatus(courseId, siteId).then((status) => {
- return this.getCourseStatusIconFromStatus(status);
+ return this.getCourseStatusIconAndTitleFromStatus(status);
});
}
/**
- * Get a course status icon from status.
+ * Get a course status icon and the langkey to use as a title from status.
*
* @param {string} status Course status.
- * @return {string} Icon name.
+ * @return {{icon: string, title: string}} Title and icon name.
*/
- getCourseStatusIconFromStatus(status: string): string {
+ getCourseStatusIconAndTitleFromStatus(status: string): {icon: string, title: string} {
if (status == CoreConstants.DOWNLOADED) {
// Always show refresh icon, we cannot knew if there's anything new in course options.
- return 'refresh';
+ return {
+ icon: 'refresh',
+ title: 'core.course.refreshcourse'
+ };
} else if (status == CoreConstants.DOWNLOADING) {
- return 'spinner';
+ return {
+ icon: 'spinner',
+ title: 'core.downloading'
+ };
} else {
- return 'cloud-download';
+ return {
+ icon: 'cloud-download',
+ title: 'core.course.downloadcourse'
+ };
}
}
diff --git a/src/core/courses/components/course-progress/course-progress.html b/src/core/courses/components/course-progress/course-progress.html
index ec1484c21..2560cc0a8 100644
--- a/src/core/courses/components/course-progress/course-progress.html
+++ b/src/core/courses/components/course-progress/course-progress.html
@@ -4,7 +4,7 @@