mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
copy text in pollService, handle pass link
This commit is contained in:
parent
01a2e40b71
commit
60d846694a
@ -20,8 +20,17 @@
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<app-language-selector></app-language-selector>
|
||||
<div class="pull-right right-end-bar">
|
||||
<!-- <button-->
|
||||
<!-- *ngIf="linkToHome"-->
|
||||
<!-- class="has-no-border nav-button cancel-button "-->
|
||||
<!-- [routerLink]="'/'"-->
|
||||
<!-- id="display_cancel_popup_button"-->
|
||||
<!-- aria-haspopup="dialog"-->
|
||||
<!-- >-->
|
||||
<!-- {{ 'nav.leave' | translate }} <i class="fa fa-times"></i>-->
|
||||
<!-- </button>-->
|
||||
<app-language-selector class=""></app-language-selector>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mobile-menu" *ngIf="mobileMenuVisible">
|
||||
|
@ -15,10 +15,11 @@ import { environment } from '../../../../environments/environment';
|
||||
export class HeaderComponent implements OnInit {
|
||||
@Input() public appTitle = environment.appTitle;
|
||||
@Input() public appLogo = environment.appLogo;
|
||||
@Input() public linkToHome: boolean = true;
|
||||
mobileMenuVisible = false;
|
||||
public environment = environment;
|
||||
|
||||
constructor(private userService: UserService) {}
|
||||
constructor() {}
|
||||
|
||||
public ngOnInit(): void {}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ import { Owner } from '../models/owner.model';
|
||||
import { Stack } from '../models/stack.model';
|
||||
import { Vote } from '../models/vote.model';
|
||||
import { defaultTimeOfDay } from '../../../../mocks/old-stuff/config/defaultConfigs';
|
||||
import { ClipboardService } from 'ngx-clipboard';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@ -63,6 +65,8 @@ export class PollService implements Resolve<Poll> {
|
||||
private titleService: Title,
|
||||
public DateUtilitiesService: DateUtilitiesService,
|
||||
public route: ActivatedRoute,
|
||||
private _clipboardService: ClipboardService,
|
||||
private translate: TranslateService,
|
||||
@Inject(DOCUMENT) private document: any,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
@ -611,19 +615,23 @@ export class PollService implements Resolve<Poll> {
|
||||
// http://localhost:4200/#/poll/citron/consultation/secure/1c01ed9c94fc640a1be864f197ff808c
|
||||
|
||||
let url = '';
|
||||
let suffix_password = '';
|
||||
if (this._poll && this._poll.getValue) {
|
||||
const polltemp = this._poll.getValue();
|
||||
if (polltemp) {
|
||||
url = `${environment.frontDomain}/#/poll/${polltemp.custom_url}/consultation`;
|
||||
const currentPoll = this._poll.getValue();
|
||||
if (currentPoll.password) {
|
||||
// handle pass access
|
||||
suffix_password = '/prompt';
|
||||
}
|
||||
if (currentPoll) {
|
||||
url = `${environment.frontDomain}/#/poll/${currentPoll.custom_url}/consultation${suffix_password}`;
|
||||
} else {
|
||||
url = `${environment.frontDomain}/#/poll/${this.form.value.custom_url}/consultation`;
|
||||
url = `${environment.frontDomain}/#/poll/${this.form.value.custom_url}/consultation${suffix_password}`;
|
||||
}
|
||||
} else {
|
||||
url = `${environment.frontDomain}/#/poll/${this.form.value.custom_url}/consultation`;
|
||||
url = `${environment.frontDomain}/#/poll/${this.form.value.custom_url}/consultation${suffix_password}`;
|
||||
}
|
||||
|
||||
console.log('getParticipationUrl', url);
|
||||
// TODO handle pass access
|
||||
return url;
|
||||
}
|
||||
|
||||
@ -786,4 +794,17 @@ export class PollService implements Resolve<Poll> {
|
||||
console.log('newpoll', newpoll);
|
||||
return newpoll;
|
||||
}
|
||||
|
||||
/**
|
||||
* copy public url of new poll
|
||||
* @param textToCopy
|
||||
*/
|
||||
copyText(textToCopy: string) {
|
||||
this._clipboardService.copyFromContent(textToCopy);
|
||||
console.log("this.translate.get('success.copy_message')", this.translate.get('success.copy_message'));
|
||||
this.translate.get('success.copy_message').subscribe((resp) => {
|
||||
console.log('resp', resp);
|
||||
this.toastService.display(`${resp} ${textToCopy}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
<div class="column is-narrow">
|
||||
<button
|
||||
class="is-primary button"
|
||||
(click)="copyText(pollService.getParticipationUrl())"
|
||||
(click)="pollService.copyText(pollService.getParticipationUrl())"
|
||||
>
|
||||
{{ 'success.copy' | translate }}
|
||||
</button>
|
||||
|
@ -23,9 +23,8 @@ export class SuccessComponent {
|
||||
constructor(
|
||||
public pollService: PollService,
|
||||
private dateUtils: DateUtilitiesService,
|
||||
private _clipboardService: ClipboardService,
|
||||
|
||||
private toastService: ToastService,
|
||||
private translate: TranslateService,
|
||||
private titleService: Title
|
||||
) {
|
||||
this.titleService.setTitle(
|
||||
@ -36,17 +35,4 @@ export class SuccessComponent {
|
||||
sendToEmail() {
|
||||
alert('todo');
|
||||
}
|
||||
|
||||
/**
|
||||
* copy public url of new poll
|
||||
* @param participationUrl
|
||||
*/
|
||||
copyText(participationUrl: string) {
|
||||
this._clipboardService.copyFromContent(participationUrl);
|
||||
console.log("this.translate.get('success.copy_message')", this.translate.get('success.copy_message'));
|
||||
this.translate.get('success.copy_message').subscribe((resp) => {
|
||||
console.log('resp', resp);
|
||||
this.toastService.display(`${resp} ${participationUrl}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,52 +1,26 @@
|
||||
<div class="step-info">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<a
|
||||
class="logo-home-link navbar-item pull-left is-hidden-mobile"
|
||||
[routerLink]="['/']"
|
||||
routerLinkActive="active"
|
||||
>
|
||||
<img
|
||||
class="stepper-app-logo logo"
|
||||
*ngIf="environment.appLogo"
|
||||
src="{{ environment.appLogo }}"
|
||||
alt="accueil {{ environment.appTitle }}"
|
||||
/>
|
||||
</a>
|
||||
<h1>
|
||||
<span class="step-title-poll" *ngIf="pollService.step_current == 1">
|
||||
{{ 'creation.title' | translate }}
|
||||
</span>
|
||||
|
||||
<span *ngIf="pollService.step_current > 1">
|
||||
<span class="step-title-poll poll-title-filled" *ngIf="pollService.form.value.title.length">
|
||||
{{ pollService.form.value.title }}
|
||||
</span>
|
||||
<span class="step-title-poll poll-title-empty" *ngIf="!pollService.form.value.title.length">
|
||||
{{ 'nav.no_title' | translate }}
|
||||
</span>
|
||||
</span>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="column has-text-right">
|
||||
<app-language-selector class="nav-button"></app-language-selector>
|
||||
<button
|
||||
class="has-no-border nav-button cancel-button"
|
||||
[routerLink]="'/'"
|
||||
id="display_cancel_popup_button"
|
||||
aria-haspopup="dialog"
|
||||
>
|
||||
{{ 'nav.leave' | translate }} <i class="fa fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app-header [linkToHome]="true"></app-header>
|
||||
|
||||
<section class="poll_loaded padded consultation" *ngIf="!fetching && poll">
|
||||
<div class="step">
|
||||
<section class="main-title-poll rounded-block">
|
||||
<div class="rounded-block">
|
||||
<label for="public_share_link">
|
||||
{{ 'success.link' | translate }}
|
||||
</label>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<input type="text" [value]="pollService.getParticipationUrl()" id="public_share_link" />
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
<button
|
||||
class="is-primary button"
|
||||
(click)="pollService.copyText(pollService.getParticipationUrl())"
|
||||
>
|
||||
{{ 'success.copy' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<h2 class="title is-2">
|
||||
@ -58,6 +32,31 @@
|
||||
{{ 'participation.menu_label' | translate }}
|
||||
<i class="fa fa-chevron-down"></i>
|
||||
</button>
|
||||
<div class="dropdown is-active">
|
||||
<div class="dropdown-trigger">
|
||||
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu2">
|
||||
<span>Content</span>
|
||||
<span class="icon is-small">
|
||||
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dropdown-menu" id="dropdown-menu2" role="menu">
|
||||
<div class="dropdown-content">
|
||||
<div class="dropdown-item">
|
||||
<p>You can insert <strong>any type of content</strong> within the dropdown menu.</p>
|
||||
</div>
|
||||
<hr class="dropdown-divider" />
|
||||
<div class="dropdown-item">
|
||||
<p>You simply need to use a <code><div></code> instead.</p>
|
||||
</div>
|
||||
<hr class="dropdown-divider" />
|
||||
<a href="#" class="dropdown-item">
|
||||
This is a link
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -796,7 +796,7 @@
|
||||
"GL": "gl",
|
||||
"HU": "hu",
|
||||
"IT": "It",
|
||||
"JA": "Ja",
|
||||
"JA": "Ja",
|
||||
"NL": "Nl",
|
||||
"OC": "Oc",
|
||||
"SV": "Sv"
|
||||
|
Loading…
Reference in New Issue
Block a user