Merge pull request #2145 from dpalou/MOBILE-3187
MOBILE-3187 myoverview: Fix keyboard flicker on filtermain
commit
fb5c9576b4
|
@ -9,7 +9,7 @@
|
||||||
<ion-spinner *ngIf="!prefetchCoursesData[selectedFilter].icon || prefetchCoursesData[selectedFilter].icon == 'spinner'"></ion-spinner>
|
<ion-spinner *ngIf="!prefetchCoursesData[selectedFilter].icon || prefetchCoursesData[selectedFilter].icon == 'spinner'"></ion-spinner>
|
||||||
</div>
|
</div>
|
||||||
<core-context-menu item-end>
|
<core-context-menu item-end>
|
||||||
<core-context-menu-item *ngIf="loaded && showFilterSwitchButton()" [priority]="1000" [content]="'core.courses.filtermycourses' | translate" (action)="switchFilter()" iconAction="funnel"></core-context-menu-item>
|
<core-context-menu-item *ngIf="loaded && showFilterSwitchButton()" [priority]="1000" [content]="'core.courses.filtermycourses' | translate" (action)="switchFilter()" iconAction="funnel" (onClosed)="switchFilterClosed()"></core-context-menu-item>
|
||||||
<core-context-menu-item *ngIf="loaded && showSortFilter" [priority]="900" content="{{('core.sortby' | translate) + ' ' + ('addon.block_myoverview.title' | translate)}}" (action)="switchSort('fullname')" [iconAction]="sort == 'fullname' ? 'radio-button-on' : 'radio-button-off'"></core-context-menu-item>
|
<core-context-menu-item *ngIf="loaded && showSortFilter" [priority]="900" content="{{('core.sortby' | translate) + ' ' + ('addon.block_myoverview.title' | translate)}}" (action)="switchSort('fullname')" [iconAction]="sort == 'fullname' ? 'radio-button-on' : 'radio-button-off'"></core-context-menu-item>
|
||||||
<core-context-menu-item *ngIf="loaded && showSortFilter" [priority]="800" content="{{('core.sortby' | translate) + ' ' + ('addon.block_myoverview.lastaccessed' | translate)}}" (action)="switchSort('lastaccess')" [iconAction]="sort == 'lastaccess' ? 'radio-button-on' : 'radio-button-off'"></core-context-menu-item>
|
<core-context-menu-item *ngIf="loaded && showSortFilter" [priority]="800" content="{{('core.sortby' | translate) + ' ' + ('addon.block_myoverview.lastaccessed' | translate)}}" (action)="switchSort('lastaccess')" [iconAction]="sort == 'lastaccess' ? 'radio-button-on' : 'radio-button-off'"></core-context-menu-item>
|
||||||
</core-context-menu>
|
</core-context-menu>
|
||||||
|
|
|
@ -334,10 +334,16 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
||||||
this.showFilter = !this.showFilter;
|
this.showFilter = !this.showFilter;
|
||||||
this.courses.filter = '';
|
this.courses.filter = '';
|
||||||
this.filteredCourses = this.courses[this.showFilter ? 'all' : this.selectedFilter];
|
this.filteredCourses = this.courses[this.showFilter ? 'all' : this.selectedFilter];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Popover closed after clicking switch filter.
|
||||||
|
*/
|
||||||
|
switchFilterClosed(): void {
|
||||||
if (this.showFilter) {
|
if (this.showFilter) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.searchbar.setFocus();
|
this.searchbar.setFocus();
|
||||||
}, 500);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,12 +51,14 @@ export class CoreContextMenuItemComponent implements OnInit, OnDestroy, OnChange
|
||||||
@Input() badgeClass?: number; // A class to set in the badge.
|
@Input() badgeClass?: number; // A class to set in the badge.
|
||||||
@Input() hidden?: boolean; // Whether the item should be hidden.
|
@Input() hidden?: boolean; // Whether the item should be hidden.
|
||||||
@Output() action?: EventEmitter<() => void>; // Will emit an event when the item clicked.
|
@Output() action?: EventEmitter<() => void>; // Will emit an event when the item clicked.
|
||||||
|
@Output() onClosed?: EventEmitter<() => void>; // Will emit an event when the popover is closed because the item was clicked.
|
||||||
|
|
||||||
protected hasAction = false;
|
protected hasAction = false;
|
||||||
protected destroyed = false;
|
protected destroyed = false;
|
||||||
|
|
||||||
constructor(private ctxtMenu: CoreContextMenuComponent) {
|
constructor(private ctxtMenu: CoreContextMenuComponent) {
|
||||||
this.action = new EventEmitter();
|
this.action = new EventEmitter();
|
||||||
|
this.onClosed = new EventEmitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,8 +40,8 @@ export class CoreContextMenuPopoverComponent {
|
||||||
/**
|
/**
|
||||||
* Close the popover.
|
* Close the popover.
|
||||||
*/
|
*/
|
||||||
closeMenu(): void {
|
closeMenu(item?: CoreContextMenuItemComponent): void {
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,12 +61,12 @@ export class CoreContextMenuPopoverComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.closeOnClick) {
|
if (item.closeOnClick) {
|
||||||
this.closeMenu();
|
this.closeMenu(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.action.emit(this.closeMenu.bind(this));
|
item.action.emit(this.closeMenu.bind(this, item));
|
||||||
} else if (item.href && item.closeOnClick) {
|
} else if (item.closeOnClick && (item.href || item.onClosed.observers.length > 0)) {
|
||||||
this.closeMenu();
|
this.closeMenu(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -180,8 +180,12 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy {
|
||||||
const popover = this.popoverCtrl.create(CoreContextMenuPopoverComponent,
|
const popover = this.popoverCtrl.create(CoreContextMenuPopoverComponent,
|
||||||
{ title: this.title, items: this.items, id: this.uniqueId, showBackdrop: true });
|
{ title: this.title, items: this.items, id: this.uniqueId, showBackdrop: true });
|
||||||
|
|
||||||
popover.onDidDismiss(() => {
|
popover.onDidDismiss((item: CoreContextMenuItemComponent) => {
|
||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
|
|
||||||
|
if (item) {
|
||||||
|
item.onClosed.emit();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
popover.present({
|
popover.present({
|
||||||
ev: event
|
ev: event
|
||||||
|
|
Loading…
Reference in New Issue