diff --git a/src/addons/mod/assign/components/index/addon-mod-assign-index.html b/src/addons/mod/assign/components/index/addon-mod-assign-index.html index 2b39744af..5aa7a97af 100644 --- a/src/addons/mod/assign/components/index/addon-mod-assign-index.html +++ b/src/addons/mod/assign/components/index/addon-mod-assign-index.html @@ -11,10 +11,10 @@ - +
- +
diff --git a/src/addons/mod/folder/components/index/addon-mod-folder-index.html b/src/addons/mod/folder/components/index/addon-mod-folder-index.html index eea0df71e..3a121644d 100644 --- a/src/addons/mod/folder/components/index/addon-mod-folder-index.html +++ b/src/addons/mod/folder/components/index/addon-mod-folder-index.html @@ -15,7 +15,7 @@ - +

{{folder.filename}}

diff --git a/src/addons/mod/folder/components/index/index.ts b/src/addons/mod/folder/components/index/index.ts index 8cd1f0504..e20e5cf7e 100644 --- a/src/addons/mod/folder/components/index/index.ts +++ b/src/addons/mod/folder/components/index/index.ts @@ -54,6 +54,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo if (this.subfolder) { this.description = this.folderInstance ? this.folderInstance.intro : this.module.description; this.contents = this.subfolder; + this.sortFilesAndFolders(); this.showLoading = false; @@ -88,6 +89,30 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo this.description = this.folderInstance ? this.folderInstance.intro : this.module.description; this.contents = AddonModFolderHelper.formatContents(contents); + this.sortFilesAndFolders(); + } + + /** + * Sort files and folders alphabetically. + */ + protected sortFilesAndFolders(): void { + if (!this.contents) { + return; + } + + this.contents.folders.sort((a, b) => { + const compareA = a.filename.toLowerCase(); + const compareB = b.filename.toLowerCase(); + + return compareA.localeCompare(compareB); + }); + + this.contents.files.sort((a, b) => { + const compareA = a.filename.toLowerCase(); + const compareB = b.filename.toLowerCase(); + + return compareA.localeCompare(compareB); + }); } /** diff --git a/src/addons/notifications/pages/list/list.scss b/src/addons/notifications/pages/list/list.scss index 4ac957b62..da15978c7 100644 --- a/src/addons/notifications/pages/list/list.scss +++ b/src/addons/notifications/pages/list/list.scss @@ -40,6 +40,8 @@ ion-item { div.core-notification-icon, core-mod-icon.core-notification-icon { padding: 8px; + max-width: var(--core-avatar-size); + max-height: var(--core-avatar-size); } } diff --git a/src/addons/privatefiles/pages/index/index.html b/src/addons/privatefiles/pages/index/index.html index ec245c9cd..3ad05578f 100644 --- a/src/addons/privatefiles/pages/index/index.html +++ b/src/addons/privatefiles/pages/index/index.html @@ -37,10 +37,8 @@ - - - - + + {{file.filename}} diff --git a/src/assets/img/files/archive-64.png b/src/assets/img/files/archive-64.png deleted file mode 100644 index ba7111a02..000000000 Binary files a/src/assets/img/files/archive-64.png and /dev/null differ diff --git a/src/assets/img/files/archive.png b/src/assets/img/files/archive.png new file mode 100644 index 000000000..20aab03e1 Binary files /dev/null and b/src/assets/img/files/archive.png differ diff --git a/src/assets/img/files/audio-64.png b/src/assets/img/files/audio-64.png deleted file mode 100644 index e98c78dd7..000000000 Binary files a/src/assets/img/files/audio-64.png and /dev/null differ diff --git a/src/assets/img/files/audio.png b/src/assets/img/files/audio.png new file mode 100644 index 000000000..7d8a7824e Binary files /dev/null and b/src/assets/img/files/audio.png differ diff --git a/src/assets/img/files/avi-64.png b/src/assets/img/files/avi-64.png deleted file mode 100644 index ec1a942cd..000000000 Binary files a/src/assets/img/files/avi-64.png and /dev/null differ diff --git a/src/assets/img/files/avi.png b/src/assets/img/files/avi.png new file mode 100644 index 000000000..700f9ce62 Binary files /dev/null and b/src/assets/img/files/avi.png differ diff --git a/src/assets/img/files/base-64.png b/src/assets/img/files/base-64.png deleted file mode 100644 index cf698f525..000000000 Binary files a/src/assets/img/files/base-64.png and /dev/null differ diff --git a/src/assets/img/files/base.png b/src/assets/img/files/base.png new file mode 100644 index 000000000..c75e01f12 Binary files /dev/null and b/src/assets/img/files/base.png differ diff --git a/src/assets/img/files/bmp-64.png b/src/assets/img/files/bmp-64.png deleted file mode 100644 index 562e7bbab..000000000 Binary files a/src/assets/img/files/bmp-64.png and /dev/null differ diff --git a/src/assets/img/files/bmp.png b/src/assets/img/files/bmp.png new file mode 100644 index 000000000..6b6dc8f37 Binary files /dev/null and b/src/assets/img/files/bmp.png differ diff --git a/src/assets/img/files/calc-64.png b/src/assets/img/files/calc-64.png deleted file mode 100644 index b813dd2cb..000000000 Binary files a/src/assets/img/files/calc-64.png and /dev/null differ diff --git a/src/assets/img/files/calc.png b/src/assets/img/files/calc.png new file mode 100644 index 000000000..ec76dceac Binary files /dev/null and b/src/assets/img/files/calc.png differ diff --git a/src/assets/img/files/chart-64.png b/src/assets/img/files/chart-64.png deleted file mode 100644 index 4b8f85bd6..000000000 Binary files a/src/assets/img/files/chart-64.png and /dev/null differ diff --git a/src/assets/img/files/chart.png b/src/assets/img/files/chart.png new file mode 100644 index 000000000..8e04b2bc8 Binary files /dev/null and b/src/assets/img/files/chart.png differ diff --git a/src/assets/img/files/database-64.png b/src/assets/img/files/database-64.png deleted file mode 100644 index 33d5043c1..000000000 Binary files a/src/assets/img/files/database-64.png and /dev/null differ diff --git a/src/assets/img/files/database.png b/src/assets/img/files/database.png new file mode 100644 index 000000000..5e9fd837e Binary files /dev/null and b/src/assets/img/files/database.png differ diff --git a/src/assets/img/files/document-64.png b/src/assets/img/files/document-64.png deleted file mode 100644 index 0888ebbbd..000000000 Binary files a/src/assets/img/files/document-64.png and /dev/null differ diff --git a/src/assets/img/files/document.png b/src/assets/img/files/document.png new file mode 100644 index 000000000..6a4bb8ba5 Binary files /dev/null and b/src/assets/img/files/document.png differ diff --git a/src/assets/img/files/draw-64.png b/src/assets/img/files/draw-64.png deleted file mode 100644 index 1b827c7c6..000000000 Binary files a/src/assets/img/files/draw-64.png and /dev/null differ diff --git a/src/assets/img/files/draw.png b/src/assets/img/files/draw.png new file mode 100644 index 000000000..f9f2da1ea Binary files /dev/null and b/src/assets/img/files/draw.png differ diff --git a/src/assets/img/files/eps-64.png b/src/assets/img/files/eps-64.png deleted file mode 100644 index c42492441..000000000 Binary files a/src/assets/img/files/eps-64.png and /dev/null differ diff --git a/src/assets/img/files/eps.png b/src/assets/img/files/eps.png new file mode 100644 index 000000000..99b23525c Binary files /dev/null and b/src/assets/img/files/eps.png differ diff --git a/src/assets/img/files/epub-64.png b/src/assets/img/files/epub-64.png deleted file mode 100644 index 298d5dcd9..000000000 Binary files a/src/assets/img/files/epub-64.png and /dev/null differ diff --git a/src/assets/img/files/epub.png b/src/assets/img/files/epub.png new file mode 100644 index 000000000..9a59fdc02 Binary files /dev/null and b/src/assets/img/files/epub.png differ diff --git a/src/assets/img/files/flash-64.png b/src/assets/img/files/flash-64.png deleted file mode 100644 index 01d28e03e..000000000 Binary files a/src/assets/img/files/flash-64.png and /dev/null differ diff --git a/src/assets/img/files/flash.png b/src/assets/img/files/flash.png new file mode 100644 index 000000000..11c557051 Binary files /dev/null and b/src/assets/img/files/flash.png differ diff --git a/src/assets/img/files/folder-64.png b/src/assets/img/files/folder-64.png deleted file mode 100644 index 2508ab252..000000000 Binary files a/src/assets/img/files/folder-64.png and /dev/null differ diff --git a/src/assets/img/files/folder-open-64.png b/src/assets/img/files/folder-open-64.png deleted file mode 100644 index 27f7271bd..000000000 Binary files a/src/assets/img/files/folder-open-64.png and /dev/null differ diff --git a/src/assets/img/files/folder-open.png b/src/assets/img/files/folder-open.png new file mode 100644 index 000000000..bcca6f434 Binary files /dev/null and b/src/assets/img/files/folder-open.png differ diff --git a/src/assets/img/files/folder.png b/src/assets/img/files/folder.png new file mode 100644 index 000000000..8479747ef Binary files /dev/null and b/src/assets/img/files/folder.png differ diff --git a/src/assets/img/files/gif-64.png b/src/assets/img/files/gif-64.png deleted file mode 100644 index 2373292b7..000000000 Binary files a/src/assets/img/files/gif-64.png and /dev/null differ diff --git a/src/assets/img/files/gif.png b/src/assets/img/files/gif.png new file mode 100644 index 000000000..303cfd9ef Binary files /dev/null and b/src/assets/img/files/gif.png differ diff --git a/src/assets/img/files/h5p-64.png b/src/assets/img/files/h5p-64.png deleted file mode 100644 index cdd1c9b1b..000000000 Binary files a/src/assets/img/files/h5p-64.png and /dev/null differ diff --git a/src/assets/img/files/h5p.png b/src/assets/img/files/h5p.png new file mode 100644 index 000000000..b3554abbf Binary files /dev/null and b/src/assets/img/files/h5p.png differ diff --git a/src/assets/img/files/html-64.png b/src/assets/img/files/html-64.png deleted file mode 100644 index 7f703bb83..000000000 Binary files a/src/assets/img/files/html-64.png and /dev/null differ diff --git a/src/assets/img/files/html.png b/src/assets/img/files/html.png new file mode 100644 index 000000000..5d36c2227 Binary files /dev/null and b/src/assets/img/files/html.png differ diff --git a/src/assets/img/files/image-64.png b/src/assets/img/files/image-64.png deleted file mode 100644 index 2d8f9e4fa..000000000 Binary files a/src/assets/img/files/image-64.png and /dev/null differ diff --git a/src/assets/img/files/image.png b/src/assets/img/files/image.png new file mode 100644 index 000000000..52d7060dc Binary files /dev/null and b/src/assets/img/files/image.png differ diff --git a/src/assets/img/files/impress-64.png b/src/assets/img/files/impress-64.png deleted file mode 100644 index c279c62ef..000000000 Binary files a/src/assets/img/files/impress-64.png and /dev/null differ diff --git a/src/assets/img/files/impress.png b/src/assets/img/files/impress.png new file mode 100644 index 000000000..8b9723919 Binary files /dev/null and b/src/assets/img/files/impress.png differ diff --git a/src/assets/img/files/isf-64.png b/src/assets/img/files/isf-64.png deleted file mode 100644 index ad5a18867..000000000 Binary files a/src/assets/img/files/isf-64.png and /dev/null differ diff --git a/src/assets/img/files/isf.png b/src/assets/img/files/isf.png new file mode 100644 index 000000000..30466983f Binary files /dev/null and b/src/assets/img/files/isf.png differ diff --git a/src/assets/img/files/jpeg-64.png b/src/assets/img/files/jpeg-64.png deleted file mode 100644 index b4fc0c998..000000000 Binary files a/src/assets/img/files/jpeg-64.png and /dev/null differ diff --git a/src/assets/img/files/jpeg.png b/src/assets/img/files/jpeg.png new file mode 100644 index 000000000..03e2302aa Binary files /dev/null and b/src/assets/img/files/jpeg.png differ diff --git a/src/assets/img/files/markup-64.png b/src/assets/img/files/markup-64.png deleted file mode 100644 index b89072713..000000000 Binary files a/src/assets/img/files/markup-64.png and /dev/null differ diff --git a/src/assets/img/files/markup.png b/src/assets/img/files/markup.png new file mode 100644 index 000000000..350b1d5ef Binary files /dev/null and b/src/assets/img/files/markup.png differ diff --git a/src/assets/img/files/math-64.png b/src/assets/img/files/math-64.png deleted file mode 100644 index d98beea61..000000000 Binary files a/src/assets/img/files/math-64.png and /dev/null differ diff --git a/src/assets/img/files/math.png b/src/assets/img/files/math.png new file mode 100644 index 000000000..70509ac82 Binary files /dev/null and b/src/assets/img/files/math.png differ diff --git a/src/assets/img/files/moodle-64.png b/src/assets/img/files/moodle-64.png deleted file mode 100644 index 44ad3a37d..000000000 Binary files a/src/assets/img/files/moodle-64.png and /dev/null differ diff --git a/src/assets/img/files/moodle.png b/src/assets/img/files/moodle.png new file mode 100644 index 000000000..e98223567 Binary files /dev/null and b/src/assets/img/files/moodle.png differ diff --git a/src/assets/img/files/mp3-64.png b/src/assets/img/files/mp3-64.png deleted file mode 100644 index 13b8da0b8..000000000 Binary files a/src/assets/img/files/mp3-64.png and /dev/null differ diff --git a/src/assets/img/files/mp3.png b/src/assets/img/files/mp3.png new file mode 100644 index 000000000..83ce89b9c Binary files /dev/null and b/src/assets/img/files/mp3.png differ diff --git a/src/assets/img/files/mpeg-64.png b/src/assets/img/files/mpeg-64.png deleted file mode 100644 index 05d77fa7b..000000000 Binary files a/src/assets/img/files/mpeg-64.png and /dev/null differ diff --git a/src/assets/img/files/mpeg.png b/src/assets/img/files/mpeg.png new file mode 100644 index 000000000..6047ef219 Binary files /dev/null and b/src/assets/img/files/mpeg.png differ diff --git a/src/assets/img/files/oth-64.png b/src/assets/img/files/oth-64.png deleted file mode 100644 index 8ffa8b466..000000000 Binary files a/src/assets/img/files/oth-64.png and /dev/null differ diff --git a/src/assets/img/files/oth.png b/src/assets/img/files/oth.png new file mode 100644 index 000000000..97fa3eeeb Binary files /dev/null and b/src/assets/img/files/oth.png differ diff --git a/src/assets/img/files/pdf-64.png b/src/assets/img/files/pdf-64.png deleted file mode 100644 index b7cdae7e9..000000000 Binary files a/src/assets/img/files/pdf-64.png and /dev/null differ diff --git a/src/assets/img/files/pdf.png b/src/assets/img/files/pdf.png new file mode 100644 index 000000000..cb98c99a8 Binary files /dev/null and b/src/assets/img/files/pdf.png differ diff --git a/src/assets/img/files/png-64.png b/src/assets/img/files/png-64.png deleted file mode 100644 index 3ecf3e5df..000000000 Binary files a/src/assets/img/files/png-64.png and /dev/null differ diff --git a/src/assets/img/files/png.png b/src/assets/img/files/png.png new file mode 100644 index 000000000..33b4acac4 Binary files /dev/null and b/src/assets/img/files/png.png differ diff --git a/src/assets/img/files/powerpoint-64.png b/src/assets/img/files/powerpoint-64.png deleted file mode 100644 index 4d44c7d2b..000000000 Binary files a/src/assets/img/files/powerpoint-64.png and /dev/null differ diff --git a/src/assets/img/files/powerpoint.png b/src/assets/img/files/powerpoint.png new file mode 100644 index 000000000..d8a830780 Binary files /dev/null and b/src/assets/img/files/powerpoint.png differ diff --git a/src/assets/img/files/psd-64.png b/src/assets/img/files/psd-64.png deleted file mode 100644 index 0b800dffa..000000000 Binary files a/src/assets/img/files/psd-64.png and /dev/null differ diff --git a/src/assets/img/files/psd.png b/src/assets/img/files/psd.png new file mode 100644 index 000000000..3433fbc84 Binary files /dev/null and b/src/assets/img/files/psd.png differ diff --git a/src/assets/img/files/publisher-64.png b/src/assets/img/files/publisher-64.png deleted file mode 100644 index 9633ef3dd..000000000 Binary files a/src/assets/img/files/publisher-64.png and /dev/null differ diff --git a/src/assets/img/files/publisher.png b/src/assets/img/files/publisher.png new file mode 100644 index 000000000..8a51d4701 Binary files /dev/null and b/src/assets/img/files/publisher.png differ diff --git a/src/assets/img/files/quicktime-64.png b/src/assets/img/files/quicktime-64.png deleted file mode 100644 index 90f2fbc0d..000000000 Binary files a/src/assets/img/files/quicktime-64.png and /dev/null differ diff --git a/src/assets/img/files/quicktime.png b/src/assets/img/files/quicktime.png new file mode 100644 index 000000000..4a56a9676 Binary files /dev/null and b/src/assets/img/files/quicktime.png differ diff --git a/src/assets/img/files/sourcecode-64.png b/src/assets/img/files/sourcecode-64.png deleted file mode 100644 index ad25537e4..000000000 Binary files a/src/assets/img/files/sourcecode-64.png and /dev/null differ diff --git a/src/assets/img/files/sourcecode.png b/src/assets/img/files/sourcecode.png new file mode 100644 index 000000000..5c8863480 Binary files /dev/null and b/src/assets/img/files/sourcecode.png differ diff --git a/src/assets/img/files/spreadsheet-64.png b/src/assets/img/files/spreadsheet-64.png deleted file mode 100644 index 00427c0e7..000000000 Binary files a/src/assets/img/files/spreadsheet-64.png and /dev/null differ diff --git a/src/assets/img/files/spreadsheet.png b/src/assets/img/files/spreadsheet.png new file mode 100644 index 000000000..23d94f272 Binary files /dev/null and b/src/assets/img/files/spreadsheet.png differ diff --git a/src/assets/img/files/text-64.png b/src/assets/img/files/text-64.png deleted file mode 100644 index 7b397cea5..000000000 Binary files a/src/assets/img/files/text-64.png and /dev/null differ diff --git a/src/assets/img/files/text.png b/src/assets/img/files/text.png new file mode 100644 index 000000000..9eb4b197e Binary files /dev/null and b/src/assets/img/files/text.png differ diff --git a/src/assets/img/files/tiff-64.png b/src/assets/img/files/tiff-64.png deleted file mode 100644 index c11a85e28..000000000 Binary files a/src/assets/img/files/tiff-64.png and /dev/null differ diff --git a/src/assets/img/files/tiff.png b/src/assets/img/files/tiff.png new file mode 100644 index 000000000..dd17d28dd Binary files /dev/null and b/src/assets/img/files/tiff.png differ diff --git a/src/assets/img/files/unknown-64.png b/src/assets/img/files/unknown-64.png deleted file mode 100644 index 7f703bb83..000000000 Binary files a/src/assets/img/files/unknown-64.png and /dev/null differ diff --git a/src/assets/img/files/unknown.png b/src/assets/img/files/unknown.png new file mode 100644 index 000000000..5d36c2227 Binary files /dev/null and b/src/assets/img/files/unknown.png differ diff --git a/src/assets/img/files/video-64.png b/src/assets/img/files/video-64.png deleted file mode 100644 index 570c4b2b3..000000000 Binary files a/src/assets/img/files/video-64.png and /dev/null differ diff --git a/src/assets/img/files/video.png b/src/assets/img/files/video.png new file mode 100644 index 000000000..8ac140c8b Binary files /dev/null and b/src/assets/img/files/video.png differ diff --git a/src/assets/img/files/wav-64.png b/src/assets/img/files/wav-64.png deleted file mode 100644 index 819781a9b..000000000 Binary files a/src/assets/img/files/wav-64.png and /dev/null differ diff --git a/src/assets/img/files/wav.png b/src/assets/img/files/wav.png new file mode 100644 index 000000000..b12df5d4c Binary files /dev/null and b/src/assets/img/files/wav.png differ diff --git a/src/assets/img/files/wmv-64.png b/src/assets/img/files/wmv-64.png deleted file mode 100644 index 570c4b2b3..000000000 Binary files a/src/assets/img/files/wmv-64.png and /dev/null differ diff --git a/src/assets/img/files/wmv.png b/src/assets/img/files/wmv.png new file mode 100644 index 000000000..8ac140c8b Binary files /dev/null and b/src/assets/img/files/wmv.png differ diff --git a/src/assets/img/files/writer-64.png b/src/assets/img/files/writer-64.png deleted file mode 100644 index 6285b6ffa..000000000 Binary files a/src/assets/img/files/writer-64.png and /dev/null differ diff --git a/src/assets/img/files/writer.png b/src/assets/img/files/writer.png new file mode 100644 index 000000000..eb8e7cf1a Binary files /dev/null and b/src/assets/img/files/writer.png differ diff --git a/src/core/components/file/core-file.html b/src/core/components/file/core-file.html index 396b05120..e6e2e729d 100644 --- a/src/core/components/file/core-file.html +++ b/src/core/components/file/core-file.html @@ -1,24 +1,29 @@ - - - - - -

{{fileName}}

-

{{ fileSizeReadable }}

-

{{ timemodified * 1000 | coreFormatDate }}

-
-
- - + + + + + + +

{{fileName}}

+

+ {{ fileSizeReadable }} + · + {{ timemodified * 1000 | coreFormatDate }} +

+
+
+ + - - - + + + - - - -
-
+ + + +
+
+ diff --git a/src/core/components/local-file/core-local-file.html b/src/core/components/local-file/core-local-file.html index 7c5ede969..b723da5eb 100644 --- a/src/core/components/local-file/core-local-file.html +++ b/src/core/components/local-file/core-local-file.html @@ -1,41 +1,48 @@
- - - - + + + + + - - -

{{fileName}}

- -

{{ size }}

-

{{ timemodified }}

-
+ + +

{{fileName}}

+ +

+ {{ size }} + · + {{ timemodified }} +

+
- - - + + + -
- - - - - - - +
+ + - - - + + + + - - - - -
- + + + + + + + +
+
+
+
diff --git a/src/core/components/local-file/local-file.ts b/src/core/components/local-file/local-file.ts index 3ae64c44c..568b657df 100644 --- a/src/core/components/local-file/local-file.ts +++ b/src/core/components/local-file/local-file.ts @@ -56,7 +56,7 @@ export class CoreLocalFileComponent implements OnInit { timemodified?: string; newFileName = ''; editMode = false; - relativePath?: string; + relativePath = ''; isIOS = false; openButtonIcon = ''; openButtonLabel = ''; @@ -112,7 +112,7 @@ export class CoreLocalFileComponent implements OnInit { * @param isOpenButton Whether the open button was clicked. */ async openFile(e: Event, isOpenButton = false): Promise { - if (this.editMode) { + if (this.editMode || !this.file) { return; } @@ -125,7 +125,7 @@ export class CoreLocalFileComponent implements OnInit { return; } - if (!CoreFileHelper.isOpenableInApp(this.file!)) { + if (!CoreFileHelper.isOpenableInApp(this.file)) { try { await CoreFileHelper.showConfirmOpenUnsupportedFile(); } catch (error) { @@ -139,7 +139,7 @@ export class CoreLocalFileComponent implements OnInit { options.iOSOpenFileAction = this.defaultIsOpenWithPicker ? OpenFileAction.OPEN : OpenFileAction.OPEN_WITH; } - CoreUtils.openFile(this.file!.toURL(), options); + CoreUtils.openFile(this.file.toURL(), options); } /** @@ -148,11 +148,15 @@ export class CoreLocalFileComponent implements OnInit { * @param e Click event. */ activateEdit(e: Event): void { + if (!this.file) { + return; + } + e.preventDefault(); e.stopPropagation(); this.editMode = true; - this.newFileName = this.file!.name; + this.newFileName = this.file.name; } /** @@ -162,10 +166,14 @@ export class CoreLocalFileComponent implements OnInit { * @param e Click event. */ async changeName(newName: string, e: Event): Promise { + if (!this.file) { + return; + } + e.preventDefault(); e.stopPropagation(); - if (newName == this.file!.name) { + if (newName == this.file.name) { // Name hasn't changed, stop. this.editMode = false; CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId()); @@ -174,7 +182,7 @@ export class CoreLocalFileComponent implements OnInit { } const modal = await CoreDomUtils.showModalLoading(); - const fileAndDir = CoreFile.getFileAndDirectoryFromPath(this.relativePath!); + const fileAndDir = CoreFile.getFileAndDirectoryFromPath(this.relativePath); const newPath = CoreText.concatenatePaths(fileAndDir.directory, newName); try { @@ -186,7 +194,7 @@ export class CoreLocalFileComponent implements OnInit { } catch { try { // File doesn't exist, move it. - const fileEntry = await CoreFile.moveFile(this.relativePath!, newPath); + const fileEntry = await CoreFile.moveFile(this.relativePath, newPath); CoreForms.triggerFormSubmittedEvent(this.formElement, false, CoreSites.getCurrentSiteId()); @@ -219,7 +227,7 @@ export class CoreLocalFileComponent implements OnInit { modal = await CoreDomUtils.showModalLoading('core.deleting', true); - await CoreFile.removeFile(this.relativePath!); + await CoreFile.removeFile(this.relativePath); this.onDelete.emit(); } catch (error) { diff --git a/src/core/directives/collapsible-header.ts b/src/core/directives/collapsible-header.ts index fb15f6445..1cb15b1d6 100644 --- a/src/core/directives/collapsible-header.ts +++ b/src/core/directives/collapsible-header.ts @@ -208,7 +208,11 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest this.expandedHeader = this.page?.querySelector('ion-item[collapsible]') ?? undefined; if (!this.expandedHeader) { + this.enabled = false; + this.setEnabled(this.enabled); + throw new Error('[collapsible-header] Couldn\'t initialize expanded header'); + } this.expandedHeader.classList.add('collapsible-header-expanded'); @@ -384,11 +388,11 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest * @param enable True to enable, false otherwise */ async setEnabled(enable: boolean): Promise { - if (!this.page || !this.content) { + if (!this.page) { return; } - if (enable) { + if (enable && this.content) { const contentScroll = await this.content.getScrollElement(); // Do nothing, since scroll has already started on the page. diff --git a/src/core/directives/collapsible-item.ts b/src/core/directives/collapsible-item.ts index 5084f128a..3bac8a97c 100644 --- a/src/core/directives/collapsible-item.ts +++ b/src/core/directives/collapsible-item.ts @@ -15,11 +15,14 @@ import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core'; import { CoreCancellablePromise } from '@classes/cancellable-promise'; import { CoreLoadingComponent } from '@components/loading/loading'; +import { CoreSettingsHelper } from '@features/settings/services/settings-helper'; import { CoreUtils } from '@services/utils/utils'; import { Translate } from '@singletons'; +import { CoreColors } from '@singletons/colors'; import { CoreComponentsRegistry } from '@singletons/components-registry'; import { CoreDom } from '@singletons/dom'; import { CoreEventObserver } from '@singletons/events'; +import { Subscription } from 'rxjs'; import { CoreFormatTextDirective } from './format-text'; const defaultMaxHeight = 80; @@ -50,6 +53,7 @@ export class CoreCollapsibleItemDirective implements OnInit, OnDestroy { protected maxHeight = defaultMaxHeight; protected expandedHeight = 0; protected resizeListener?: CoreEventObserver; + protected darkModeListener?: Subscription; protected domPromise?: CoreCancellablePromise; protected uniqueId: string; @@ -92,6 +96,10 @@ export class CoreCollapsibleItemDirective implements OnInit, OnDestroy { this.resizeListener = CoreDom.onWindowResize(() => { this.calculateHeight(); }, 50); + + this.darkModeListener = CoreSettingsHelper.onDarkModeChange().subscribe(() => { + this.setGradientColor(); + }); } /** @@ -135,7 +143,34 @@ export class CoreCollapsibleItemDirective implements OnInit, OnDestroy { this.element.classList.remove('collapsible-loading-height'); // If cannot calculate height, shorten always. - this.setExpandButtonEnabled(!this.expandedHeight || this.expandedHeight >= this.maxHeight); + const enable = !this.expandedHeight || this.expandedHeight >= this.maxHeight; + this.setExpandButtonEnabled(enable); + this.setGradientColor(); + + } + + /** + * Sets the gradient color based on the background. + */ + protected setGradientColor(): void { + if (!this.toggleExpandEnabled) { + return; + } + + let coloredElement: HTMLElement | null = this.element; + let backgroundColor = [0, 0, 0, 0]; + let background = ''; + while (coloredElement && backgroundColor[3] === 0) { + background = getComputedStyle(coloredElement).backgroundColor; + backgroundColor = CoreColors.getColorRGBA(background); + coloredElement = coloredElement.parentElement; + } + + if (backgroundColor[3] !== 0) { + delete(backgroundColor[3]); + const bgList = backgroundColor.join(','); + this.element.style.setProperty('--background-gradient-rgb', `${bgList}`); + } } /** @@ -241,6 +276,7 @@ export class CoreCollapsibleItemDirective implements OnInit, OnDestroy { */ ngOnDestroy(): void { this.resizeListener?.off(); + this.darkModeListener?.unsubscribe(); this.domPromise?.cancel(); } diff --git a/src/core/features/course/components/course-format/course-format.html b/src/core/features/course/components/course-format/course-format.html index 3afda6fd4..e796412d3 100644 --- a/src/core/features/course/components/course-format/course-format.html +++ b/src/core/features/course/components/course-format/course-format.html @@ -44,7 +44,7 @@ - diff --git a/src/core/features/course/components/module-info/core-course-module-info.html b/src/core/features/course/components/module-info/core-course-module-info.html index 2ff034ce9..62ccf0e34 100644 --- a/src/core/features/course/components/module-info/core-course-module-info.html +++ b/src/core/features/course/components/module-info/core-course-module-info.html @@ -14,43 +14,39 @@
- - - +
+ +
- - +
-
-
+

{{ date.label }} {{ date.timestamp * 1000 | coreFormatDate:'strftimedatetime' }}

+ -
+
-
- - +
- - - +
+ +
diff --git a/src/core/features/course/components/module-info/course-module-info.scss b/src/core/features/course/components/module-info/course-module-info.scss index 6091e0b2f..8b6c8feb0 100644 --- a/src/core/features/course/components/module-info/course-module-info.scss +++ b/src/core/features/course/components/module-info/course-module-info.scss @@ -23,27 +23,46 @@ } - .core-module-dates-availabilityinfo { + .core-module-info-box { background: var(--light); border-radius: var(--small-radius); - padding: 8px; margin: 8px; - font-size: 90%; - ion-icon { - position: static; - @include margin-horizontal(null, 8px); + padding: 8px; + + ::ng-deep ion-item { + --ion-item-background: var(--light); + --background: var(--light); } - p, - ul { - margin-top: 4px; - margin-bottom: 4px; + ::ng-deep ion-card.card-file { + --ion-card-horizontal-margin: 0px; } - } - .core-module-dates + .core-module-availabilityinfo { - border-top: 1px solid var(--stroke); - padding-top: 8px; + .core-module-info-box-section + .core-module-info-box-section { + border-top: 1px solid var(--stroke); + margin-top: 8px; + padding-top: 8px; + } + + .core-module-dates ion-icon { + margin-left: 4px; + margin-right: 4px; + } + + .core-module-dates, + .core-module-availabilityinfo { + font-size: 90%; + ion-icon { + position: static; + @include margin-horizontal(null, 8px); + } + + p, + ul { + margin-top: 4px; + margin-bottom: 4px; + } + } } core-course-module-completion ::ng-deep ion-button { diff --git a/src/core/features/course/components/module-navigation/module-navigation.scss b/src/core/features/course/components/module-navigation/module-navigation.scss index 7ae45b850..4b4eb2a8c 100644 --- a/src/core/features/course/components/module-navigation/module-navigation.scss +++ b/src/core/features/course/components/module-navigation/module-navigation.scss @@ -21,6 +21,10 @@ margin-top: var(--button-vertical-margin); margin-bottom: var(--button-vertical-margin); } + + &.empty { + display: none; + } } :host-context(core-course-format.core-course-format-singleactivity) { diff --git a/src/core/features/course/components/module-navigation/module-navigation.ts b/src/core/features/course/components/module-navigation/module-navigation.ts index 4e436af4b..63211dbc2 100644 --- a/src/core/features/course/components/module-navigation/module-navigation.ts +++ b/src/core/features/course/components/module-navigation/module-navigation.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core'; import { CoreCourse, CoreCourseWSSection } from '@features/course/services/course'; import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; @@ -44,11 +44,13 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { nextModuleSection?: CoreCourseWSSection; previousModuleSection?: CoreCourseWSSection; loaded = false; + element: HTMLElement; protected completionObserver: CoreEventObserver; - constructor(protected ionContent: IonContent) { + constructor(protected ionContent: IonContent, element: ElementRef) { const siteId = CoreSites.getCurrentSiteId(); + this.element = element.nativeElement; this.completionObserver = CoreEvents.on(CoreEvents.COMPLETION_MODULE_VIEWED, async (data) => { if (data && data.courseId == this.courseId) { @@ -168,6 +170,8 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { } } } + + this.element.classList.toggle('empty', !this.nextModule && !this.previousModule); } /** diff --git a/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html b/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html index d5c1692c3..342f17c3e 100644 --- a/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html +++ b/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html @@ -1,6 +1,3 @@
- - - diff --git a/src/core/features/course/format/singleactivity/components/singleactivity.ts b/src/core/features/course/format/singleactivity/components/singleactivity.ts index 499d7f805..ac3be661c 100644 --- a/src/core/features/course/format/singleactivity/components/singleactivity.ts +++ b/src/core/features/course/format/singleactivity/components/singleactivity.ts @@ -20,7 +20,6 @@ import { CoreDynamicComponent } from '@components/dynamic-component/dynamic-comp import { CoreCourseAnyCourseData } from '@features/courses/services/courses'; import { IonRefresher } from '@ionic/angular'; import { CoreCourseModuleCompletionData, CoreCourseSection } from '@features/course/services/course-helper'; -import { CoreBlockHelper } from '@features/block/services/block-helper'; import { CoreCourse } from '@features/course/services/course'; /** @@ -46,7 +45,6 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges { componentClass?: Type; // The class of the component to render. data: Record = {}; // Data to pass to the component. - hasBlocks = false; /** * @inheritdoc @@ -60,8 +58,6 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges { return; } - this.hasBlocks = await CoreBlockHelper.hasCourseBlocks(this.course.id); - // In single activity the module should only have 1 section and 1 module. Get the module. const module = this.sections?.[0].modules?.[0]; @@ -93,11 +89,7 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges { if (this.course) { const courseId = this.course.id; - await CoreCourse.invalidateCourseBlocks(courseId).then(async () => { - this.hasBlocks = await CoreBlockHelper.hasCourseBlocks(courseId); - - return; - }); + await CoreCourse.invalidateCourseBlocks(courseId); } } diff --git a/src/core/features/sharedfiles/components/list/list.html b/src/core/features/sharedfiles/components/list/list.html index e3ae1898e..96174712a 100644 --- a/src/core/features/sharedfiles/components/list/list.html +++ b/src/core/features/sharedfiles/components/list/list.html @@ -13,10 +13,8 @@ (onDelete)="fileDeleted(idx)" (onRename)="fileRenamed(idx, $event)"> - - + + {{ file.name }} diff --git a/src/core/pipes/to-locale-string.ts b/src/core/pipes/to-locale-string.ts index 5783fea6c..908bc84f7 100644 --- a/src/core/pipes/to-locale-string.ts +++ b/src/core/pipes/to-locale-string.ts @@ -21,7 +21,8 @@ import { CoreLogger } from '@singletons/logger'; * Filter to format a timestamp to a locale string. Timestamp can be in seconds or milliseconds. * * @deprecated since 3.6. Use coreFormatDate instead. - * This pipe wasn't removed in app 4.0 because some site plugins still used it. It will be removed in future versions. + * This pipe wasn't removed in app 4.0 because some site plugins still used it. It will be removed in future versions + * (see MOBILE-2823). */ @Pipe({ name: 'coreToLocaleString', diff --git a/src/core/services/utils/mimetype.ts b/src/core/services/utils/mimetype.ts index d8e4610ed..386a6f267 100644 --- a/src/core/services/utils/mimetype.ts +++ b/src/core/services/utils/mimetype.ts @@ -280,7 +280,7 @@ export class CoreMimetypeUtilsProvider { * @return The path to a folder icon. */ getFolderIcon(): string { - return 'assets/img/files/folder-64.png'; + return 'assets/img/files/folder.png'; } /** @@ -290,7 +290,7 @@ export class CoreMimetypeUtilsProvider { * @return The icon path. */ getFileIconForType(type: string): string { - return 'assets/img/files/' + type + '-64.png'; + return `assets/img/files/${type}.png`; } /** diff --git a/src/core/singletons/colors.ts b/src/core/singletons/colors.ts index d0e0e3dfa..ed70b8bdf 100644 --- a/src/core/singletons/colors.ts +++ b/src/core/singletons/colors.ts @@ -90,30 +90,44 @@ export class CoreColors { * Returns the hex code from any color css type (ie named). * * @param color Color in any format. - * @returns Color in hex format. + * @return Color in hex format. */ static getColorHex(color: string): string { - const d = document.createElement('div'); - d.style.color = color; - document.body.appendChild(d); - - // Color in RGB . - const matches = getComputedStyle(d).color.match(/\d+/g) || []; - if (matches.length == 0) { + const rgba = CoreColors.getColorRGBA(color, true); + if (rgba.length === 0) { return ''; } - const rgba = matches.map((a) => parseInt(a, 10)); - const hex = [0,1,2].map( (idx) => this.componentToHex(rgba[idx]), ).join(''); - document.body.removeChild(d); - return '#' + hex; } + /** + * Returns RGBA color from any color format. + * + * @param color Color in any format. + * @param createElement Wether create a new element is needed to calculate value. + * @return Red, green, blue and alpha. + */ + static getColorRGBA(color: string, createElement = false): number[] { + if (createElement) { + const d = document.createElement('span'); + d.style.color = color; + document.body.appendChild(d); + + // Color in RGB. + color = getComputedStyle(d).color; + document.body.removeChild(d); + } + + const matches = color.match(/\d+/g) || []; + + return matches.map((a, index) => index < 3 ? parseInt(a, 10) : parseFloat(a)); + } + /** * Gets the luma of a color. * diff --git a/src/theme/components/format-text.scss b/src/theme/components/format-text.scss index a242fe175..808d38dbc 100644 --- a/src/theme/components/format-text.scss +++ b/src/theme/components/format-text.scss @@ -208,6 +208,11 @@ core-format-text, core-rich-text-editor .core-rte-editor { @include core-headings(); + p, ul, ol, li { + // Normalize font-size inside formatted text. + font-size: 14px; + } + p { margin-bottom: 1rem; margin-block-start: 0; diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index 78a7bf894..a97d2eea2 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -706,10 +706,35 @@ body.core-iframe-fullscreen ion-router-outlet { .item.item-file { ion-thumbnail { - --size: 32px; + --size: 24px; width: var(--size); height: var(--size); } + + p.item-heading { + font-size: 14px; + } + + p { + font-size: 12px; + } + + ion-label { + margin-top: 8px; + margin-bottom: 8px; + } + + ion-button { + --a11y-min-target-size: 40px; + } + + &.item-directory ion-icon { + @include margin-horizontal(0px, 16px); + } + + [slot=end] { + @include margin-horizontal(16px, null); + } } .item-dimmed { @@ -870,7 +895,8 @@ ion-action-sheet.md { // Radio. ion-radio, -input[type=radio] { +input[type=radio], +.select-alert.ios .alert-radio-icon { --color: var(--text-color); --color-checked: var(--color); --border-radius: 50%; @@ -882,7 +908,8 @@ input[type=radio] { } .ios ion-radio, -.ios input[type=radio] { +.ios input[type=radio], +.select-alert.ios .alert-radio-icon { --border-width: 1px; --outer-border-width: 1px; } @@ -911,8 +938,8 @@ input[type=radio] { &.radio-checked { &::part(container) { - border-color: var(--color-checked); - background: var(--color-checked); + border-color: var(--color); + background: var(--color); } &::part(mark) { @@ -921,6 +948,44 @@ input[type=radio] { } } +.select-alert.ios { + .alert-radio-icon { + height: var(--size); + width: var(--size); + min-width: var(--size); + border-radius: var(--border-radius); + border-width: var(--outer-border-width); + border-style: var(--border-style); + border-color: var(--color); + @include margin(10px, 8px, 10px, 8px); + display: flex; + align-items: center; + justify-content: center; + + .alert-radio-inner { + top: auto; + left: auto; + position: static; + border-radius: var(--inner-border-radius); + width: calc(50% + var(--outer-border-width)); + height: calc(50% + var(--outer-border-width)); + transform: scale3d(0, 0, 0); + transition: transform 280ms cubic-bezier(.4, 0, .2, 1); + background: var(--contrast-background); + border: 0 !important; + } + } + + button[aria-checked=true] .alert-radio-icon { + border-color: var(--color-checked); + background: var(--color-checked); + + .alert-radio-inner { + transform: scale3d(1, 1, 1); + } + } +} + // Checkbox. ion-checkbox, input[type=checkbox] { @@ -938,6 +1003,10 @@ input[type=checkbox] { --outer-border-width: 1px; } +.select-alert.ios .alert-checkbox-icon { + border-radius: 2px; +} + // Select. ion-select::part(text) { white-space: normal; @@ -1000,9 +1069,7 @@ ion-chip { border-color: var(--ion-color-base); color: var(--ion-color-base); } - } - &.ion-color { &.ion-color-light, &.ion-color-medium, &.ion-color-dark, @@ -1013,6 +1080,10 @@ ion-chip { } } } + + &:not(.ion-color) ion-icon { + color: var(--text-color); + } } ion-searchbar {