MOBILE-3643 core: Rename splitview property
parent
05ae8ada14
commit
da14b7dac3
|
@ -570,7 +570,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.svComponent?.isOn()) {
|
if (this.svComponent?.outletActivated) {
|
||||||
// Empty form.
|
// Empty form.
|
||||||
this.hasOffline = false;
|
this.hasOffline = false;
|
||||||
this.form.reset(this.originalData);
|
this.form.reset(this.originalData);
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
|
||||||
this.notificationsEnabled = CoreLocalNotifications.instance.isAvailable();
|
this.notificationsEnabled = CoreLocalNotifications.instance.isAvailable();
|
||||||
this.siteHomeId = CoreSites.instance.getCurrentSiteHomeId();
|
this.siteHomeId = CoreSites.instance.getCurrentSiteHomeId();
|
||||||
this.currentSiteId = CoreSites.instance.getCurrentSiteId();
|
this.currentSiteId = CoreSites.instance.getCurrentSiteId();
|
||||||
this.isSplitViewOn = this.svComponent?.isOn();
|
this.isSplitViewOn = this.svComponent?.outletActivated;
|
||||||
|
|
||||||
// Check if site supports editing and deleting. No need to check allowed types, event.canedit already does it.
|
// Check if site supports editing and deleting. No need to check allowed types, event.canedit already does it.
|
||||||
this.canEdit = AddonCalendar.instance.canEditEventsInSite();
|
this.canEdit = AddonCalendar.instance.canEditEventsInSite();
|
||||||
|
|
|
@ -121,9 +121,9 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.refreshEvents(true, false).finally(() => {
|
this.refreshEvents(true, false).finally(() => {
|
||||||
|
|
||||||
// In tablet mode try to open the event (only if it's an online event).
|
// In tablet mode try to open the event (only if it's an online event).
|
||||||
if (this.splitviewCtrl?.isOn() && data.eventId > 0) {
|
if (this.splitviewCtrl?.outletActivated && data.eventId > 0) {
|
||||||
this.gotoEvent(data.eventId);
|
this.gotoEvent(data.eventId);
|
||||||
} else if (this.splitviewCtrl?.isOn()) {
|
} else if (this.splitviewCtrl?.outletActivated) {
|
||||||
// Discussion added, clear details page.
|
// Discussion added, clear details page.
|
||||||
this.emptySplitView();
|
this.emptySplitView();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
// Listen for new event discarded event. When it does, reload the data.
|
// Listen for new event discarded event. When it does, reload the data.
|
||||||
this.discardedObserver = CoreEvents.on(AddonCalendarProvider.NEW_EVENT_DISCARDED_EVENT, () => {
|
this.discardedObserver = CoreEvents.on(AddonCalendarProvider.NEW_EVENT_DISCARDED_EVENT, () => {
|
||||||
if (this.splitviewCtrl?.isOn()) {
|
if (this.splitviewCtrl?.outletActivated) {
|
||||||
// Discussion added, clear details page.
|
// Discussion added, clear details page.
|
||||||
this.emptySplitView();
|
this.emptySplitView();
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,8 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.eventsLoaded = false;
|
this.eventsLoaded = false;
|
||||||
this.refreshEvents();
|
this.refreshEvents();
|
||||||
|
|
||||||
if (this.splitviewCtrl?.isOn() && this.eventId && data && data.deleted && data.deleted.indexOf(this.eventId) != -1) {
|
if (this.splitviewCtrl?.outletActivated &&
|
||||||
|
this.eventId && data && data.deleted && data.deleted.indexOf(this.eventId) != -1) {
|
||||||
// Current selected event was deleted. Clear details.
|
// Current selected event was deleted. Clear details.
|
||||||
this.emptySplitView();
|
this.emptySplitView();
|
||||||
}
|
}
|
||||||
|
@ -168,7 +169,8 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.refreshEvents();
|
this.refreshEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.splitviewCtrl?.isOn() && this.eventId && data && data.deleted && data.deleted.indexOf(this.eventId) != -1) {
|
if (this.splitviewCtrl?.outletActivated &&
|
||||||
|
this.eventId && data && data.deleted && data.deleted.indexOf(this.eventId) != -1) {
|
||||||
// Current selected event was deleted. Clear details.
|
// Current selected event was deleted. Clear details.
|
||||||
this.emptySplitView();
|
this.emptySplitView();
|
||||||
}
|
}
|
||||||
|
@ -185,7 +187,7 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.hasOffline = true;
|
this.hasOffline = true;
|
||||||
} else {
|
} else {
|
||||||
// Event deleted, clear the details if needed and refresh the view.
|
// Event deleted, clear the details if needed and refresh the view.
|
||||||
if (this.splitviewCtrl?.isOn()) {
|
if (this.splitviewCtrl?.outletActivated) {
|
||||||
this.emptySplitView();
|
this.emptySplitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +257,7 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
await this.fetchData(false, true, false);
|
await this.fetchData(false, true, false);
|
||||||
|
|
||||||
if (!this.eventId && this.splitviewCtrl?.isOn() && this.events.length > 0) {
|
if (!this.eventId && this.splitviewCtrl?.outletActivated && this.events.length > 0) {
|
||||||
// Take first online event and load it. If no online event, load the first offline.
|
// Take first online event and load it. If no online event, load the first offline.
|
||||||
if (this.onlineEvents[0]) {
|
if (this.onlineEvents[0]) {
|
||||||
this.gotoEvent(this.onlineEvents[0].id);
|
this.gotoEvent(this.onlineEvents[0].id);
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Component, OnDestroy, ViewChild, OnInit, AfterViewInit, ElementRef } from '@angular/core';
|
import { Component, OnDestroy, ViewChild, OnInit, AfterViewInit, ElementRef, Optional } from '@angular/core';
|
||||||
|
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||||
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
||||||
import { CoreUser } from '@features/user/services/user';
|
import { CoreUser } from '@features/user/services/user';
|
||||||
import { CanLeave } from '@guards/can-leave';
|
import { CanLeave } from '@guards/can-leave';
|
||||||
|
@ -106,7 +107,10 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
|
||||||
protected ratingSyncObserver?: CoreEventObserver;
|
protected ratingSyncObserver?: CoreEventObserver;
|
||||||
protected changeDiscObserver?: CoreEventObserver;
|
protected changeDiscObserver?: CoreEventObserver;
|
||||||
|
|
||||||
constructor(protected elementRef: ElementRef) {}
|
constructor(
|
||||||
|
@Optional() protected splitView: CoreSplitViewComponent,
|
||||||
|
protected elementRef: ElementRef,
|
||||||
|
) {}
|
||||||
|
|
||||||
get isMobile(): boolean {
|
get isMobile(): boolean {
|
||||||
return CoreScreen.instance.isMobile;
|
return CoreScreen.instance.isMobile;
|
||||||
|
@ -216,12 +220,11 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
|
||||||
|
|
||||||
if (typeof data.deleted != 'undefined' && data.deleted) {
|
if (typeof data.deleted != 'undefined' && data.deleted) {
|
||||||
if (!data.post?.parentid) {
|
if (!data.post?.parentid) {
|
||||||
// @todo
|
if (this.splitView?.outletActivated) {
|
||||||
// if (this.svComponent && this.svComponent.isOn()) {
|
CoreNavigator.instance.navigate('../');
|
||||||
// this.svComponent.emptyDetails();
|
} else {
|
||||||
// } else {
|
CoreNavigator.instance.back();
|
||||||
// this.navCtrl.pop();
|
}
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
this.discussionLoaded = false;
|
this.discussionLoaded = false;
|
||||||
this.refreshPosts();
|
this.refreshPosts();
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Component, OnDestroy, ViewChild, ElementRef, OnInit } from '@angular/core';
|
import { Component, OnDestroy, ViewChild, ElementRef, OnInit, Optional } from '@angular/core';
|
||||||
import { FileEntry } from '@ionic-native/file/ngx';
|
import { FileEntry } from '@ionic-native/file/ngx';
|
||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import { CoreEvents, CoreEventObserver } from '@singletons/events';
|
import { CoreEvents, CoreEventObserver } from '@singletons/events';
|
||||||
|
@ -38,7 +38,7 @@ import { IonRefresher } from '@ionic/angular';
|
||||||
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
||||||
import { CoreTextUtils } from '@services/utils/text';
|
import { CoreTextUtils } from '@services/utils/text';
|
||||||
import { CanLeave } from '@guards/can-leave';
|
import { CanLeave } from '@guards/can-leave';
|
||||||
import { CoreScreen } from '@services/screen';
|
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||||
|
|
||||||
type NewDiscussionData = {
|
type NewDiscussionData = {
|
||||||
subject: string;
|
subject: string;
|
||||||
|
@ -96,6 +96,8 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
|
||||||
protected originalData?: Partial<NewDiscussionData>;
|
protected originalData?: Partial<NewDiscussionData>;
|
||||||
protected forceLeave = false;
|
protected forceLeave = false;
|
||||||
|
|
||||||
|
constructor(@Optional() protected splitView: CoreSplitViewComponent) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component being initialized.
|
* Component being initialized.
|
||||||
*/
|
*/
|
||||||
|
@ -433,9 +435,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
|
||||||
CoreSites.instance.getCurrentSiteId(),
|
CoreSites.instance.getCurrentSiteId(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (CoreScreen.instance.isMobile) {
|
if (this.splitView?.outletActivated) {
|
||||||
CoreNavigator.instance.back();
|
|
||||||
} else {
|
|
||||||
// Empty form.
|
// Empty form.
|
||||||
this.hasOffline = false;
|
this.hasOffline = false;
|
||||||
this.newDiscussion.subject = '';
|
this.newDiscussion.subject = '';
|
||||||
|
@ -444,6 +444,8 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
|
||||||
this.newDiscussion.postToAllGroups = false;
|
this.newDiscussion.postToAllGroups = false;
|
||||||
this.messageEditor.clearText();
|
this.messageEditor.clearText();
|
||||||
this.originalData = CoreUtils.instance.clone(this.newDiscussion);
|
this.originalData = CoreUtils.instance.clone(this.newDiscussion);
|
||||||
|
} else {
|
||||||
|
CoreNavigator.instance.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,10 @@ export class CoreSplitViewComponent implements AfterViewInit, OnDestroy {
|
||||||
return this.outletRouteSubject.value;
|
return this.outletRouteSubject.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get outletActivated(): boolean {
|
||||||
|
return this.contentOutlet.isActivated;
|
||||||
|
}
|
||||||
|
|
||||||
get outletRouteObservable(): Observable<ActivatedRouteSnapshot | null> {
|
get outletRouteObservable(): Observable<ActivatedRouteSnapshot | null> {
|
||||||
return this.outletRouteSubject.asObservable();
|
return this.outletRouteSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
@ -118,13 +122,4 @@ export class CoreSplitViewComponent implements AfterViewInit, OnDestroy {
|
||||||
return CoreSplitViewMode.MenuAndContent;
|
return CoreSplitViewMode.MenuAndContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if both panels are shown. It depends on screen width.
|
|
||||||
*
|
|
||||||
* @return If split view is enabled.
|
|
||||||
*/
|
|
||||||
isOn(): boolean {
|
|
||||||
return this.contentOutlet.isActivated;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue