Delete isLoggedIn from portals and class-contents
This commit is contained in:
parent
2d0893ff45
commit
02bf9abee4
|
@ -192,31 +192,22 @@ export class ClassHelpContentsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public togglePageHelpContents(status: boolean, ids: string[]) {
|
public togglePageHelpContents(status: boolean, ids: string[]) {
|
||||||
if (!Session.isLoggedIn()) {
|
this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
|
||||||
this.router.navigate(['/user-info'], {
|
() => {
|
||||||
queryParams: {
|
for (let id of ids) {
|
||||||
'errorCode': LoginErrorCodes.NOT_VALID,
|
let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
|
||||||
'redirectUrl': this.router.url
|
this.checkboxes[i].divHelpContent.isActive = status;
|
||||||
}
|
}
|
||||||
});
|
this.countClassHelpContents();
|
||||||
} else {
|
this.applyCheck(false);
|
||||||
this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
|
UIkit.notification('Page content(s) has been <b>successfully updated</b>', {
|
||||||
() => {
|
status: 'success',
|
||||||
for (let id of ids) {
|
timeout: 6000,
|
||||||
let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
|
pos: 'bottom-right'
|
||||||
this.checkboxes[i].divHelpContent.isActive = status;
|
});
|
||||||
}
|
},
|
||||||
this.countClassHelpContents();
|
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
||||||
this.applyCheck(false);
|
));
|
||||||
UIkit.notification('Page content(s) has been <b>successfully updated</b>', {
|
|
||||||
status: 'success',
|
|
||||||
timeout: 6000,
|
|
||||||
pos: 'bottom-right'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,24 +81,18 @@ export class PortalsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
getPortals() {
|
getPortals() {
|
||||||
if (!Session.isLoggedIn()) {
|
this.showLoading = true;
|
||||||
this._router.navigate(['/user-info'], {
|
this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
|
||||||
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
|
portals => {
|
||||||
});
|
this.portals = portals;
|
||||||
} else {
|
if (portals) {
|
||||||
this.showLoading = true;
|
portals.forEach(_ => {
|
||||||
this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
|
this.checkboxes.push(<CheckPortal>{portal: _, checked: false});
|
||||||
portals => {
|
});
|
||||||
this.portals = portals;
|
}
|
||||||
if (portals) {
|
this.showLoading = false;
|
||||||
portals.forEach(_ => {
|
},
|
||||||
this.checkboxes.push(<CheckPortal>{portal: _, checked: false});
|
error => this.handleError('System error retrieving portals', error)));
|
||||||
});
|
|
||||||
}
|
|
||||||
this.showLoading = false;
|
|
||||||
},
|
|
||||||
error => this.handleError('System error retrieving portals', error)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public toggleCheckBoxes(event) {
|
public toggleCheckBoxes(event) {
|
||||||
|
@ -187,59 +181,41 @@ export class PortalsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
private portalModalOpen(title: string, yesBtn: string) {
|
private portalModalOpen(title: string, yesBtn: string) {
|
||||||
if (!Session.isLoggedIn()) {
|
this.editModal.okButtonLeft = false;
|
||||||
this._router.navigate(['/user-info'], {
|
this.editModal.alertTitle = title;
|
||||||
queryParams: {
|
this.editModal.okButtonText = yesBtn;
|
||||||
"errorCode": LoginErrorCodes.NOT_VALID,
|
this.editModal.open();
|
||||||
"redirectUrl": this._router.url
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.editModal.okButtonLeft = false;
|
|
||||||
this.editModal.alertTitle = title;
|
|
||||||
this.editModal.okButtonText = yesBtn;
|
|
||||||
this.editModal.open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public portalSaveConfirmed(data: any) {
|
public portalSaveConfirmed(data: any) {
|
||||||
this.showLoading = true;
|
this.showLoading = true;
|
||||||
if (!Session.isLoggedIn()) {
|
if (this.portalForm.value._id) {
|
||||||
this._router.navigate(['/user-info'], {
|
this.portalForm.get('type').enable();
|
||||||
queryParams: {
|
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
|
||||||
"errorCode": LoginErrorCodes.NOT_VALID,
|
this.properties.adminToolsAPIURL).subscribe(
|
||||||
"redirectUrl": this._router.url
|
portal => {
|
||||||
}
|
this.portalUpdatedSuccessfully(portal);
|
||||||
});
|
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully updated</b>', {
|
||||||
|
status: 'success',
|
||||||
|
timeout: 6000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error => this.handleUpdateError('System error updating portal', error)
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
if (this.portalForm.value._id) {
|
this.subscriptions.push(this._helpContentService.saveCommunity(<Portal>this.portalForm.value,
|
||||||
this.portalForm.get('type').enable();
|
this.properties.adminToolsAPIURL).subscribe(
|
||||||
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
|
portal => {
|
||||||
this.properties.adminToolsAPIURL).subscribe(
|
this.portalSavedSuccessfully(portal);
|
||||||
portal => {
|
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully created</b>', {
|
||||||
this.portalUpdatedSuccessfully(portal);
|
status: 'success',
|
||||||
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully updated</b>', {
|
timeout: 6000,
|
||||||
status: 'success',
|
pos: 'bottom-right'
|
||||||
timeout: 6000,
|
});
|
||||||
pos: 'bottom-right'
|
},
|
||||||
});
|
error => this.handleUpdateError('System error creating portal', error)
|
||||||
},
|
));
|
||||||
error => this.handleUpdateError('System error updating portal', error)
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
this.subscriptions.push(this._helpContentService.saveCommunity(<Portal>this.portalForm.value,
|
|
||||||
this.properties.adminToolsAPIURL).subscribe(
|
|
||||||
portal => {
|
|
||||||
this.portalSavedSuccessfully(portal);
|
|
||||||
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully created</b>', {
|
|
||||||
status: 'success',
|
|
||||||
timeout: 6000,
|
|
||||||
pos: 'bottom-right'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error => this.handleUpdateError('System error creating portal', error)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue