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

32 lines
888 B
TypeScript
Raw Normal View History

2019-08-11 16:21:49 +02:00
import {Component, OnInit} from '@angular/core';
2019-08-10 16:57:36 +02:00
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../config.service';
@Component({
2019-08-11 16:21:49 +02:00
selector: 'framadate-visibility',
templateUrl: './visibility.component.html',
styleUrls: ['./visibility.component.scss']
2019-08-10 16:57:36 +02:00
})
export class VisibilityComponent extends BaseComponent implements OnInit {
showCustomPassword = false;
2019-08-10 16:57:36 +02:00
2019-08-11 16:21:49 +02:00
constructor(public config: ConfigService) {
super(config);
}
2019-08-10 16:57:36 +02:00
2019-08-11 16:21:49 +02:00
ngOnInit() {
this.config.customUrl = this.makeUuid();
}
/**
* generate unique id to have a default url for future poll
*/
makeUuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
2019-08-11 16:21:49 +02:00
}
2019-08-10 16:57:36 +02:00
}