funky-framadate-front/src/app/features/old-stuff/pages/visibility/visibility.component.ts

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-04-22 12:56:18 +02:00
import { Location } from '@angular/common';
import { Component, OnInit } from '@angular/core';
2020-04-22 12:56:18 +02:00
2020-05-01 19:10:17 +02:00
import { environment } from '../../../../../environments/environment';
import { PollUtilities } from '../../config/PollUtilities';
2020-04-22 12:56:18 +02:00
import { ConfigService } from '../../services/config.service';
import { BaseComponent } from '../example/base-page/base.component';
2019-08-10 16:57:36 +02:00
@Component({
2020-04-22 12:56:18 +02:00
selector: 'app-visibility',
2020-04-21 10:50:26 +02:00
templateUrl: './visibility.component.html',
styleUrls: ['./visibility.component.scss'],
2019-08-10 16:57:36 +02:00
})
export class VisibilityComponent extends BaseComponent implements OnInit {
2020-04-22 12:56:18 +02:00
public location: Location;
public showCustomPassword = false;
public baseUrl = environment.api.baseHref;
2019-08-10 16:57:36 +02:00
2020-04-21 10:50:26 +02:00
constructor(public config: ConfigService, public utils: PollUtilities) {
super(config);
}
2019-08-10 16:57:36 +02:00
2020-04-22 12:56:18 +02:00
ngOnInit(): void {
2020-04-21 10:50:26 +02:00
this.config.customUrl = this.utils.makeSlug(this.config);
this.config.expirationDate = this.config
.addDaysToDate(this.config.expiracyDateDefaultInDays, new Date())
.toISOString()
.substring(0, 10);
}
2020-04-22 12:56:18 +02:00
public submitCreationAndGoToEnd(): void {
2020-04-21 10:50:26 +02:00
this.config.createPoll();
}
2019-08-10 16:57:36 +02:00
}