OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Outsource youtube url and *ngIf conditions from html templates
Inga Mai6550e0421ff3
diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.html b/frontend/src/app/components/enterprise/enterprise-base.component.htmlindex 7ce8341d454..aef3cc291f8 100644--- a/frontend/src/app/components/enterprise/enterprise-base.component.html+++ b/frontend/src/app/components/enterprise/enterprise-base.component.html@@ -1,16 +1,20 @@-<p *ngIf="!eeTrialService.status">- <b>{{ text.become_hero }}</b><br>- {{ text.you_contribute }}-</p>+<div *ngIf="noTrialRequested; else alreadyRequested">+ <p>+ <b>{{ text.become_hero }}</b><br>+ {{ text.you_contribute }}+ </p>+ <button class="button -alt-highlight" (click)="openTrialModal()">+ {{ text.button_trial }}+ </button>+</div>-<div *ngIf="eeTrialService.status">+<ng-template #alreadyRequested><enterprise-trial-waiting></enterprise-trial-waiting><p class="confirmation-hint">{{ text.email_not_received }}<a (click)="openTrialModal()">{{ text.try_another_email }}.</a><br>{{ text.try_another_email_hint }}</p>-</div>+</ng-template>++-<button *ngIf="!eeTrialService.status" class="button -alt-highlight" (click)="openTrialModal()">- {{ text.button_trial }}-</button>diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.ts b/frontend/src/app/components/enterprise/enterprise-base.component.tsindex ee811393165..45695fe5eb0 100644--- a/frontend/src/app/components/enterprise/enterprise-base.component.ts+++ b/frontend/src/app/components/enterprise/enterprise-base.component.ts@@ -62,6 +62,10 @@ export class EnterpriseBaseComponent {this.eeTrialService.modalOpen = true;this.opModalService.show(EnterpriseTrialModal, this.injector);}++ public get noTrialRequested() {+ return this.eeTrialService.status === undefined;+ }}DynamicBootstrapper.register({diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.html b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.htmlindex a17e2e90a19..d82f4ba2611 100644--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.html+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.html@@ -10,17 +10,17 @@</a></div>- <div class="op-modal--modal-body">+ <div [ngSwitch]="openWindow()" class="op-modal--modal-body"><!-- first modal window -->- <div *ngIf="!eeTrialService.status || eeTrialService.cancelled">+ <div *ngSwitchCase="1"><enterprise-trial-form></enterprise-trial-form></div><!-- second modal window -->- <div *ngIf="eeTrialService.status === 'mailSubmitted' && !eeTrialService.cancelled">+ <div *ngSwitchCase="2"><enterprise-trial-waiting></enterprise-trial-waiting></div><!-- third modal window -->- <div *ngIf="eeTrialService.status === 'startTrial'">+ <div *ngSwitchCase="3"><div class="onboarding--video-block"><div class="onboarding--video-text"><span>{{ text.quick_overview }}</span>@@ -29,8 +29,8 @@<iframe frameborder="0"height="400"width="100%"- allowfullscreen=""- [src]="trustedEEVideoURL()">+ [src]="trustedEEVideoURL"+ allowfullscreen></iframe></div></div>diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.tsindex 2f8efd773ac..12df5f2f5b6 100644--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts@@ -27,7 +27,7 @@// ++import {AfterViewInit, ChangeDetectorRef, Component, ElementRef, Inject, Input, ViewChild} from "@angular/core";-import {DomSanitizer} from "@angular/platform-browser";+import {DomSanitizer, SafeResourceUrl} from "@angular/platform-browser";import {FormControl, FormGroup} from "@angular/forms";import {OpModalComponent} from "app/components/op-modals/op-modal.component";import {OpModalLocalsToken} from "app/components/op-modals/op-modal.service";@@ -36,6 +36,8 @@ import {I18nService} from "app/modules/common/i18n/i18n.service";import {EETrialFormComponent} from "core-components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component";import {EnterpriseTrialService} from "core-components/enterprise/enterprise-trial.service";+export const eeOnboardingVideoURL = 'https://www.youtube.com/embed/zLMSydhFSkw?autoplay=1';+@Component({selector: 'enterprise-trial-modal',templateUrl: './enterprise-trial.modal.html',@@ -53,7 +55,7 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewIpublic closeOnEscape = false;public closeOnOutsideClick = false;- public eeOnboardingVideoURL = 'https://www.youtube.com/embed/zLMSydhFSkw?autoplay=1';+ public trustedEEVideoURL:SafeResourceUrl;public text = {button_submit: this.I18n.t('js.modals.button_submit'),button_cancel: this.I18n.t('js.modals.button_cancel'),@@ -73,6 +75,7 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewIreadonly domSanitizer:DomSanitizer,public eeTrialService:EnterpriseTrialService) {super(locals, cdRef, elementRef);+ this.trustedEEVideoURL = this.trustedURL(eeOnboardingVideoURL);}ngAfterViewInit() {@@ -112,8 +115,18 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewIthis.eeTrialService.modalOpen = false;}- public trustedEEVideoURL() {- return this.domSanitizer.bypassSecurityTrustResourceUrl(this.eeOnboardingVideoURL);+ public trustedURL(url:string) {+ return this.domSanitizer.bypassSecurityTrustResourceUrl(url);+ }++ public openWindow():number {+ if (!this.eeTrialService.status || this.eeTrialService.cancelled) {+ return 1;+ } else if (this.eeTrialService.status === 'mailSubmitted' && !this.eeTrialService.cancelled) {+ return 2;+ } else {+ return 3;+ }}}