From f6732dbf2221738297839253ef21c4ee26c7287b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 19 Dec 2018 11:19:45 +0100 Subject: [PATCH 1/4] MOBILE-2795 dashboard: Filter all courses --- .../myoverview/addon-block-myoverview.html | 2 +- .../components/myoverview/myoverview.ts | 16 ++++++++-------- src/app/app.ios.scss | 6 +++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html index ce5b034bc..4275f04b3 100644 --- a/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html +++ b/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html @@ -1,7 +1,7 @@

{{ 'addon.block_myoverview.pluginname' | translate }}

-
+
diff --git a/src/addon/block/myoverview/components/myoverview/myoverview.ts b/src/addon/block/myoverview/components/myoverview/myoverview.ts index 13630305e..59b87cb3f 100644 --- a/src/addon/block/myoverview/components/myoverview/myoverview.ts +++ b/src/addon/block/myoverview/components/myoverview/myoverview.ts @@ -177,17 +177,17 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem */ filterChanged(event: any): void { const newValue = event.target.value && event.target.value.trim().toLowerCase(); - if (!newValue || !this.courses[this.selectedFilter]) { - this.filteredCourses = this.courses[this.selectedFilter]; + if (!newValue || !this.courses['all']) { + this.filteredCourses = this.courses['all']; } else { // Use displayname if avalaible, or fullname if not. - if (this.courses[this.selectedFilter].length > 0 && - typeof this.courses[this.selectedFilter][0].displayname != 'undefined') { - this.filteredCourses = this.courses[this.selectedFilter].filter((course) => { + if (this.courses['all'].length > 0 && + typeof this.courses['all'][0].displayname != 'undefined') { + this.filteredCourses = this.courses['all'].filter((course) => { return course.displayname.toLowerCase().indexOf(newValue) > -1; }); } else { - this.filteredCourses = this.courses[this.selectedFilter].filter((course) => { + this.filteredCourses = this.courses['all'].filter((course) => { return course.fullname.toLowerCase().indexOf(newValue) > -1; }); } @@ -311,7 +311,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem switchFilter(): void { this.showFilter = !this.showFilter; this.courses.filter = ''; - this.filteredCourses = this.courses[this.selectedFilter]; + this.filteredCourses = this.courses[this.showFilter ? 'all' : this.selectedFilter]; if (this.showFilter) { setTimeout(() => { this.searchbar.setFocus(); @@ -325,7 +325,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * @return {boolean} If switch button that enables the filter input is shown or not. */ showFilterSwitchButton(): boolean { - return this.loaded && this.courses[this.selectedFilter] && this.courses[this.selectedFilter].length > 5; + return this.loaded && this.courses['all'] && this.courses['all'].length > 5; } /** diff --git a/src/app/app.ios.scss b/src/app/app.ios.scss index c6d73a607..3a6213ed1 100644 --- a/src/app/app.ios.scss +++ b/src/app/app.ios.scss @@ -1,6 +1,10 @@ ion-app.app-root.ios { .button-ios { - min-height: $button-ios-height + min-height: $button-ios-height; + } + + ion-searchbar.searchbar-ios .button-ios { + min-height: auto; } // Light buttons color. From 23e993fda08ff14ffc91ec86be35d2e25f44c5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 19 Dec 2018 11:37:08 +0100 Subject: [PATCH 2/4] MOBILE-2795 message: Fix avatar on discussion title --- src/addon/messages/pages/discussion/discussion.html | 2 +- src/addon/messages/pages/discussion/discussion.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addon/messages/pages/discussion/discussion.html b/src/addon/messages/pages/discussion/discussion.html index cfa4dc7a0..2c7cd6a1a 100644 --- a/src/addon/messages/pages/discussion/discussion.html +++ b/src/addon/messages/pages/discussion/discussion.html @@ -1,7 +1,7 @@ - + diff --git a/src/addon/messages/pages/discussion/discussion.ts b/src/addon/messages/pages/discussion/discussion.ts index 79562599b..1dae62395 100644 --- a/src/addon/messages/pages/discussion/discussion.ts +++ b/src/addon/messages/pages/discussion/discussion.ts @@ -42,7 +42,7 @@ import * as moment from 'moment'; export class AddonMessagesDiscussionPage implements OnDestroy { @ViewChild(Content) content: Content; - protected siteId: string; + siteId: string; protected fetching: boolean; protected polling; protected logger; From e509abffee37333b3629a823027de17374d85272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 19 Dec 2018 13:48:13 +0100 Subject: [PATCH 3/4] MOBILE-2795 course: Fix undefined section modules length --- src/core/course/providers/helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index 73ac7e3a4..6bbc497a8 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -1083,7 +1083,7 @@ export class CoreCourseHelperProvider { } const sectionWithModules = sections.find((section) => { - return section.modules.length > 0; + return section.modules && section.modules.length > 0; }); if (!sectionWithModules || typeof sectionWithModules.modules[0].completion == 'undefined') { promises.push(this.courseProvider.getActivitiesCompletionStatus(course.id)); From f0d1828324b2bb7b45d0ce1b90dc4fc2367ce189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 20 Dec 2018 10:09:45 +0100 Subject: [PATCH 4/4] MOBILE-2795 message: Add icons to context menu --- .../messages/pages/discussion/discussion.html | 21 ++++++++++--------- .../messages/pages/discussion/discussion.ts | 20 ++++++++++++++++++ src/app/app.scss | 3 ++- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/addon/messages/pages/discussion/discussion.html b/src/addon/messages/pages/discussion/discussion.html index 2c7cd6a1a..dbda39413 100644 --- a/src/addon/messages/pages/discussion/discussion.html +++ b/src/addon/messages/pages/discussion/discussion.html @@ -1,7 +1,8 @@ - + + @@ -9,15 +10,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/addon/messages/pages/discussion/discussion.ts b/src/addon/messages/pages/discussion/discussion.ts index 1dae62395..df944af81 100644 --- a/src/addon/messages/pages/discussion/discussion.ts +++ b/src/addon/messages/pages/discussion/discussion.ts @@ -79,6 +79,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { members: any = {}; // Members that wrote a message, indexed by ID. favouriteIcon = 'fa-star'; deleteIcon = 'trash'; + blockIcon = 'close-circle'; + addRemoveIcon = 'add'; otherMember: any; // Other member information (individual conversations only). footerType: 'message' | 'blocked' | 'requiresContact' | 'requestSent' | 'requestReceived' | 'unable'; requestContactSent = false; @@ -420,6 +422,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { this.favouriteIcon = conversation.isfavourite ? 'fa-star-o' : 'fa-star'; if (!this.isGroup) { this.userId = conversation.userid; + this.blockIcon = this.otherMember && this.otherMember.isblocked ? 'close-circle' : 'checkmark-circle'; + this.addRemoveIcon = this.otherMember && this.otherMember.iscontact ? 'remove' : 'add'; } return true; @@ -1086,6 +1090,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { const okText = this.translate.instant('addon.messages.blockuser'); return this.domUtils.showConfirm(template, undefined, okText).then(() => { + this.blockIcon = 'spinner'; + const modal = this.domUtils.showModalLoading('core.sending', true); this.showLoadingModal = true; @@ -1095,6 +1101,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { }); }).catch((error) => { this.domUtils.showErrorModalDefault(error, 'core.error', true); + }).finally(() => { + this.blockIcon = this.otherMember.isblocked ? 'close-circle' : 'checkmark-circle'; }); } @@ -1140,6 +1148,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { const okText = this.translate.instant('addon.messages.unblockuser'); return this.domUtils.showConfirm(template, undefined, okText).then(() => { + this.blockIcon = 'spinner'; + const modal = this.domUtils.showModalLoading('core.sending', true); this.showLoadingModal = true; @@ -1149,6 +1159,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { }); }).catch((error) => { this.domUtils.showErrorModalDefault(error, 'core.error', true); + }).finally(() => { + this.blockIcon = this.otherMember.isblocked ? 'close-circle' : 'checkmark-circle'; }); } @@ -1167,6 +1179,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { const okText = this.translate.instant('core.add'); return this.domUtils.showConfirm(template, undefined, okText).then(() => { + this.addRemoveIcon = 'spinner'; + const modal = this.domUtils.showModalLoading('core.sending', true); this.showLoadingModal = true; @@ -1176,6 +1190,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { }); }).catch((error) => { this.domUtils.showErrorModalDefault(error, 'core.error', true); + }).finally(() => { + this.addRemoveIcon = this.otherMember.iscontact ? 'remove' : 'add'; }); } @@ -1238,6 +1254,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { const okText = this.translate.instant('core.remove'); return this.domUtils.showConfirm(template, undefined, okText).then(() => { + this.addRemoveIcon = 'spinner'; + const modal = this.domUtils.showModalLoading('core.sending', true); this.showLoadingModal = true; @@ -1247,6 +1265,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { }); }).catch((error) => { this.domUtils.showErrorModalDefault(error, 'core.error', true); + }).finally(() => { + this.addRemoveIcon = this.otherMember.iscontact ? 'remove' : 'add'; }); } diff --git a/src/app/app.scss b/src/app/app.scss index d36bc1954..0e82d8f59 100644 --- a/src/app/app.scss +++ b/src/app/app.scss @@ -554,7 +554,8 @@ ion-app.app-root { } } - .toolbar .core-bar-button-image { + .toolbar img.core-bar-button-image, + .toolbar .core-bar-button-image img { padding: 0; width: 100%; height: 100%;