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>
|
||||
</select>
|
||||
</div>
|
||||
<!-- (click)="notifications[i].frequency = 168" -->
|
||||
</div>
|
||||
|
||||
<div 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" (click)="restoreNotification(notifications, i)">Reset</button>
|
||||
<div *ngIf="showSaveResetButtons" class="uk-float-right">
|
||||
<button type="submit" class="uk-button uk-button-primary" (click)="saveNotification(i)">Save Changes</button>
|
||||
<button type="submit" class="uk-button" (click)="restoreNotification(i)">Reset</button>
|
||||
</div>
|
||||
<!-- <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>
|
||||
|
|
|
@ -36,6 +36,8 @@ export class MailPrefsComponent {
|
|||
|
||||
private errorCodes: ErrorCodes;
|
||||
|
||||
@Input() showSaveResetButtons: boolean = true;
|
||||
|
||||
constructor (private _mailPrefsService: MailPrefsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
|
||||
this.errorCodes = new ErrorCodes();
|
||||
this.status = this.errorCodes.LOADING;
|
||||
|
@ -118,7 +120,7 @@ export class MailPrefsComponent {
|
|||
notification.notify = checked;
|
||||
}
|
||||
|
||||
saveNotification(notifications: any, index: number) {
|
||||
saveNotification(index: number) {
|
||||
if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) {
|
||||
if(!Session.isLoggedIn()){
|
||||
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(this.notifications[index]);
|
||||
this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] ));
|
||||
|
|
Loading…
Reference in New Issue