mailPrefs.component: use 'showSaveResetButtons' variable to show or hide 'save' and 'reset' buttons.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@53538 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
a381a25305
commit
da959c01ec
|
@ -47,12 +47,11 @@
|
||||||
<option [ngValue]="168">Weekly</option>
|
<option [ngValue]="168">Weekly</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<!-- (click)="notifications[i].frequency = 168" -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-float-right">
|
<div *ngIf="showSaveResetButtons" class="uk-float-right">
|
||||||
<button type="submit" class="uk-button uk-button-primary" (click)="saveNotification(notifications, i)">Save Changes</button>
|
<button type="submit" class="uk-button uk-button-primary" (click)="saveNotification(i)">Save Changes</button>
|
||||||
<button type="submit" class="uk-button" (click)="restoreNotification(notifications, i)">Reset</button>
|
<button type="submit" class="uk-button" (click)="restoreNotification(i)">Reset</button>
|
||||||
</div>
|
</div>
|
||||||
<!-- <span class="uk-margin">
|
<!-- <span class="uk-margin">
|
||||||
<button class="uk-width-1-1 uk-button uk-button-primary uk-button-small" type="submit" (click)="saveNotification(notifications, i)">Save</button>
|
<button class="uk-width-1-1 uk-button uk-button-primary uk-button-small" type="submit" (click)="saveNotification(notifications, i)">Save</button>
|
||||||
|
|
|
@ -36,6 +36,8 @@ export class MailPrefsComponent {
|
||||||
|
|
||||||
private errorCodes: ErrorCodes;
|
private errorCodes: ErrorCodes;
|
||||||
|
|
||||||
|
@Input() showSaveResetButtons: boolean = true;
|
||||||
|
|
||||||
constructor (private _mailPrefsService: MailPrefsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
|
constructor (private _mailPrefsService: MailPrefsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
|
||||||
this.errorCodes = new ErrorCodes();
|
this.errorCodes = new ErrorCodes();
|
||||||
this.status = this.errorCodes.LOADING;
|
this.status = this.errorCodes.LOADING;
|
||||||
|
@ -118,7 +120,7 @@ export class MailPrefsComponent {
|
||||||
notification.notify = checked;
|
notification.notify = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveNotification(notifications: any, index: number) {
|
saveNotification(index: number) {
|
||||||
if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) {
|
if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) {
|
||||||
if(!Session.isLoggedIn()){
|
if(!Session.isLoggedIn()){
|
||||||
this.userValidMessage = "User session has expired. Please login again.";
|
this.userValidMessage = "User session has expired. Please login again.";
|
||||||
|
@ -159,7 +161,7 @@ export class MailPrefsComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreNotification(notifications: any, index: number) {
|
restoreNotification(index: number) {
|
||||||
console.info("Restore Notification");
|
console.info("Restore Notification");
|
||||||
console.info(this.notifications[index]);
|
console.info(this.notifications[index]);
|
||||||
this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] ));
|
this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] ));
|
||||||
|
|
Loading…
Reference in New Issue