Skip to content

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

cleanup and DRY; youtube video added

Inga Maiccdd44fc5975
diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb
index 5dd1605a562..7fa9b74823c 100644
--- a/app/controllers/enterprises_controller.rb
+++ b/app/controllers/enterprises_controller.rb
@@ -33,6 +33,7 @@ class EnterprisesController < ApplicationController
before_action :augur_content_security_policy
before_action :chargebee_content_security_policy
+ before_action :youtube_content_security_policy
before_action :require_admin
before_action :check_user_limit, only: [:show]
diff --git a/app/helpers/enterprise_trial_helper.rb b/app/helpers/enterprise_trial_helper.rb
index cbbec620756..4f21a300701 100644
--- a/app/helpers/enterprise_trial_helper.rb
+++ b/app/helpers/enterprise_trial_helper.rb
@@ -11,5 +11,11 @@ module EnterpriseTrialHelper
style_src: %w(js.chargebee.com openproject-enterprise-test.chargebee.com),
frame_src: %w(js.chargebee.com openproject-enterprise-test.chargebee.com)
)
+ end
+
+ def youtube_content_security_policy
+ append_content_security_policy_directives(
+ frame_src: %w['self' https://www.youtube.com]
+ )
end
end
\ No newline at end of file
diff --git a/app/views/enterprises/_current.html.erb b/app/views/enterprises/_current.html.erb
index 96ae278ed28..b34724c4b25 100644
--- a/app/views/enterprises/_current.html.erb
+++ b/app/views/enterprises/_current.html.erb
@@ -1,43 +1,9 @@
-<div class="enterprise--active-token">
- <div class="attributes-group">
- <div class="attributes-key-value">
- <div class="attributes-key-value--key"><%= EnterpriseToken.human_attribute_name(:subscriber) %></div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span><%= @current_token.subscriber %></span>
- </div>
- </div>
- <div class="attributes-key-value--key"><%= EnterpriseToken.human_attribute_name(:mail) %></div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span><%= @current_token.mail %></span>
- </div>
- </div>
- <% Hash(@current_token.restrictions).each do |key, value| %>
- <div class="attributes-key-value--key"><%= EnterpriseToken.human_attribute_name("#{key}_restriction") %></div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span><%= value %></span>
- </div>
- </div>
- <% end %>
- <div class="attributes-key-value--key"><%= EnterpriseToken.human_attribute_name(:starts_at) %></div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span><%= format_date @current_token.starts_at %></span>
- </div>
- </div>
- <% if @current_token.will_expire? %>
- <div class="attributes-key-value--key"><%= EnterpriseToken.human_attribute_name(:expires_at) %></div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span><%= format_date @current_token.expires_at %></span>
- </div>
- </div>
- <% end %>
- </div>
- </div>
-</div>
+<enterprise-active-trial data-subscriber="<%= @current_token.subscriber %>"
+ data-email="<%= @current_token.mail %>"
+ data-restrictions="<%= @current_token.restrictions %>"
+ data-starts-at="<%= format_date @current_token.starts_at %>"
+ data-expires-at="<%= format_date @current_token.expires_at %>">
+</enterprise-active-trial>
<%= form_tag({ action: :destroy },
method: :delete) do %>
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 92627b20a58..229ab0f824d 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -183,20 +183,36 @@ en:
reset_to_defaults: 'Reset to defaults'
enterprise:
trial:
- label_company: 'Company'
- label_first_name: 'First name'
- label_last_name: 'Last name'
- label_email: 'Email'
- label_domain: 'Domain'
- next_step: 'In the next step we will send you an email to the email-address provided.'
- resend_link: 'Resend'
- test_ee: 'Test the Enterprise Edition 30 days for free'
+ confirmation: "Confirmation of email-address"
+ confirmation_info: "We sent you and email. Please check your mails and click the confirmation link provided to start your 14 days trial."
+ label_company: "Company"
+ label_first_name: "First name"
+ label_last_name: "Last name"
+ label_email: "Email"
+ label_domain: "Domain"
+ label_subscriber: "Subscriber"
+ label_maximum_users: "Maximum active users"
+ label_starts_at: "Starts at"
+ label_expires_at: "Expires at"
+ label_status: "Status:"
+ mail_not_received: "You did not receive a mail? Resend mail or"
+ try_another_mail: "try with another mail address"
+ next_steps: "Next steps"
+ next_step: "In the next step we will send you an email to the email-address provided."
+ privacy_policy: "privacy policy"
+ resend_link: "Resend"
+ resend_success: "Mail has been resent. Please check your mails and click the confirmation link provided."
+ resend_warning: "Could not resend mail"
+ session_timeout: "Your session timed out. Please try to resend mail."
+ status_waiting: "email sent - waiting for confirmation"
+ status_confirmed: "confirmed ✓"
+ terms_of_service: "terms of service"
+ test_ee: "Test the Enterprise Edition 14 days for free"
+ quick_overview: "Get a quick overview of project management and team collaboration with OpenProject Enterprise Edition."
upsale:
- button_start_trial: 'Start free trial'
- button_book_now: 'Book now'
- link_quote: 'Get a quote'
become_hero: "Become a hero!"
benefits:
+ description: "What are the benefits?"
high_security: "High security features"
high_security_text: "Our security features ensure a secure and enterprise-class business application."
installation: "Installation and alerts"
@@ -205,6 +221,9 @@ en:
premium_features_text: "Enjoy additional powerful premium features which make your OpenProject even better."
professional_support: "Professional support"
professional_support_text: "Our professional support service engineers guarantee quick and friendly issue solving."
+ button_start_trial: "Start free trial"
+ button_book_now: "Book now"
+ link_quote: "Get a quote"
you_contribute: "Developers need to pay their bills, too. With Enterprise Edition you substantially contribute to this Open-Source community effort."
custom_actions:
diff --git a/frontend/src/app/angular4-modules.ts b/frontend/src/app/angular4-modules.ts
index aaca5dd906e..e1ff39acffe 100644
--- a/frontend/src/app/angular4-modules.ts
+++ b/frontend/src/app/angular4-modules.ts
@@ -43,7 +43,8 @@ import {PasswordConfirmationModal} from "core-components/modals/request-for-conf
import {EnterpriseBaseComponent} from "core-components/enterprise/enterprise-base.component";
import {EnterpriseTrialModal} from "core-components/enterprise/enterprise-modal/enterprise-trial.modal";
import {EETrialFormComponent} from "core-components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component";
-import {EETrialWaitingComponent} from "core-components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component";
+import {EETrialWaitingComponent} from "core-components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component";
+import {EEActiveTrialComponent} from "core-components/enterprise/enterprise-active-trial/ee-active-trial.component";
import {EnterpriseTrialService} from "core-components/enterprise/enterprise-trial.service";
import {OpenprojectFieldsModule} from "core-app/modules/fields/openproject-fields.module";
import {OpenprojectCommonModule} from "core-app/modules/common/openproject-common.module";
@@ -163,6 +164,7 @@ import {OpenprojectMembersModule} from "core-app/modules/members/members.module"
EnterpriseTrialModal,
EETrialFormComponent,
EETrialWaitingComponent,
+ EEActiveTrialComponent,
// Main menu
MainMenuResizerComponent,
@@ -193,6 +195,7 @@ import {OpenprojectMembersModule} from "core-app/modules/members/members.module"
EnterpriseTrialModal,
EETrialFormComponent,
EETrialWaitingComponent,
+ EEActiveTrialComponent,
// Main menu
MainMenuResizerComponent,
diff --git a/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.html b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.html
new file mode 100644
index 00000000000..f4620e10c5a
--- /dev/null
+++ b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.html
@@ -0,0 +1,38 @@
+<div class="enterprise--active-token">
+ <div class="attributes-group">
+ <div class="attributes-key-value">
+ <div class="attributes-key-value--key">{{ text.label_subscriber }}</div>
+ <div class="attributes-key-value--value-container">
+ <div class="attributes-key-value--value -text">
+ <span>{{ subscriber }}</span>
+ </div>
+ </div>
+ <div class="attributes-key-value--key">{{ text.label_email }}</div>
+ <div class="attributes-key-value--value-container">
+ <div class="attributes-key-value--value -text">
+ <span>{{ email }}</span>
+ </div>
+ </div>
+ <!-- TODO % Hash(@current_token.restrictions).each do |key, value| %-->
+ <div class="attributes-key-value--key">{{ text.label_maximum_users}}</div>
+ <div class="attributes-key-value--value-container">
+ <div class="attributes-key-value--value -text">
+ <span>10</span>
+ </div>
+ </div>
+ <div class="attributes-key-value--key">{{ text.label_starts_at }}</div>
+ <div class="attributes-key-value--value-container">
+ <div class="attributes-key-value--value -text">
+ <span>{{ startsAt }}</span>
+ </div>
+ </div>
+ <!-- only show if token expires -->
+ <div *ngIf="expiresAt" class="attributes-key-value--key">{{ text.label_expires_at }}</div>
+ <div *ngIf="expiresAt" class="attributes-key-value--value-container">
+ <div class="attributes-key-value--value -text">
+ <span>{{ expiresAt }}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.sass b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.sass
new file mode 100644
index 00000000000..7d3f0c12d08
--- /dev/null
+++ b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.sass
@@ -0,0 +1,2 @@
+.attributes-group
+ margin-bottom: 1.25rem
\ No newline at end of file
diff --git a/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts
new file mode 100644
index 00000000000..986f4e3ec05
--- /dev/null
+++ b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts
@@ -0,0 +1,74 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2020 the OpenProject GmbH
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License version 3.
+//
+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+// Copyright (C) 2006-2013 Jean-Philippe Lang
+// Copyright (C) 2010-2013 the ChiliProject Team
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// See docs/COPYRIGHT.rdoc for more details.
+// ++
+
+import {Component, ElementRef, OnInit} from "@angular/core";
+import {I18nService} from "app/modules/common/i18n/i18n.service";
+import {EnterpriseTrialService} from "app/components/enterprise/enterprise-trial.service";
+import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";
+
+@Component({
+ selector: 'enterprise-active-trial',
+ templateUrl: './ee-active-trial.component.html',
+ styleUrls: ['./ee-active-trial.component.sass']
+})
+export class EEActiveTrialComponent implements OnInit {
+ public text = {
+ label_email: this.I18n.t('js.admin.enterprise.trial.label_email'),
+ label_expires_at: this.I18n.t('js.admin.enterprise.trial.label_expires_at'),
+ label_maximum_users: this.I18n.t('js.admin.enterprise.trial.label_maximum_users'),
+ label_starts_at: this.I18n.t('js.admin.enterprise.trial.label_starts_at'),
+ label_subscriber: this.I18n.t('js.admin.enterprise.trial.label_subscriber')
+ };
+ public subscriber = this.elementRef.nativeElement.dataset['subscriber'];
+ public email = this.elementRef.nativeElement.dataset['email'];
+ public restrictions = this.elementRef.nativeElement.dataset['restrictions'];
+ public startsAt = this.elementRef.nativeElement.dataset['startsAt'];
+ public expiresAt = this.elementRef.nativeElement.dataset['expiresAt'];
+
+ constructor(readonly elementRef:ElementRef,
+ readonly I18n:I18nService,
+ public eeTrialService:EnterpriseTrialService) {
+ }
+
+ ngOnInit() {
+ // TODO iterate over all restrictions
+ console.log('restrictions: ', this.restrictions);
+ // trial is not active yet
+ if (!this.subscriber) {
+ this.subscriber = this.eeTrialService.savedUserData.subscriber;
+ this.email = this.eeTrialService.savedUserData.email;
+ this.startsAt = '-';
+ this.expiresAt = '-';
+ }
+ }
+}
+
+DynamicBootstrapper.register({
+ selector: 'enterprise-active-trial', cls: EEActiveTrialComponent
+});
+
diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.html b/frontend/src/app/components/enterprise/enterprise-base.component.html
index e2d7a5fe353..ebebc647c42 100644
--- a/frontend/src/app/components/enterprise/enterprise-base.component.html
+++ b/frontend/src/app/components/enterprise/enterprise-base.component.html
@@ -5,51 +5,13 @@
<div *ngIf="eeTrialService.status === 'mailSubmitted'">
<enterprise-trial-waiting>
- <div class="enterprise--active-token">
- <div class="attributes-group">
- <div class="attributes-key-value">
- <div class="attributes-key-value--key">Subscriber</div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span>{{ eeTrialService.trialForm.first_name }}</span>
- </div>
- </div>
- <div class="attributes-key-value--key">Email</div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span>{{ eeTrialService.trialForm.email }}</span>
- </div>
- </div>
- <div class="attributes-key-value--key">Maximum active users</div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span>10</span>
- </div>
- </div>
- <div class="attributes-key-value--key">Valid since</div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span>-</span>
- </div>
- </div>
- <div class="attributes-key-value--key">Expires at</div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value -text">
- <span>-</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <p><b>We are waiting for your confirmation.</b></p>
+ <enterprise-active-trial></enterprise-active-trial>
</enterprise-trial-waiting>
- <p class="confirmation-hint">
- You did not receive a mail?
- <a (click)="eeTrialService.resendMail()">Resend mail</a> or try with
- <a (click)="openTrialModal()">another mail address.</a>
+ <p class="confirmation-hint">{{ text.mail_not_received }}
+ <a (click)="openTrialModal()">{{ text.try_another_mail }}.</a>
</p>
</div>
<button *ngIf="!eeTrialService.status" class="button -alt-highlight" (click)="openTrialModal()">
{{ text.button_trial }}
-</button>
\ No newline at end of file
+</button>
diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.sass b/frontend/src/app/components/enterprise/enterprise-base.component.sass
index cb7567840b4..210520e2e89 100644
--- a/frontend/src/app/components/enterprise/enterprise-base.component.sass
+++ b/frontend/src/app/components/enterprise/enterprise-base.component.sass
@@ -1,4 +1,7 @@
-@import 'helpers'
-
.button
- float: left
\ No newline at end of file
+ float: left
+
+.confirmation-hint
+ font-size: 0.9em
+ font-style: italic
+ margin-bottom: 2rem
diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.ts b/frontend/src/app/components/enterprise/enterprise-base.component.ts
index b50805cc7b7..3aa4b4f670c 100644
--- a/frontend/src/app/components/enterprise/enterprise-base.component.ts
+++ b/frontend/src/app/components/enterprise/enterprise-base.component.ts
@@ -39,13 +39,14 @@ import {EnterpriseTrialService} from "core-components/enterprise/enterprise-tria
styleUrls: ['./enterprise-base.component.sass']
})
export class EnterpriseBaseComponent {
-
public text = {
button_trial: this.I18n.t('js.admin.enterprise.upsale.button_start_trial'),
button_book: this.I18n.t('js.admin.enterprise.upsale.button_book_now'),
link_quote: this.I18n.t('js.admin.enterprise.upsale.link_quote'),
become_hero: this.I18n.t('js.admin.enterprise.upsale.become_hero'),
you_contribute: this.I18n.t('js.admin.enterprise.upsale.you_contribute'),
+ mail_not_received: this.I18n.t('js.admin.enterprise.trial.mail_not_received'),
+ try_another_mail: this.I18n.t('js.admin.enterprise.trial.try_another_mail')
};
constructor(protected I18n:I18nService,
@@ -54,7 +55,6 @@ export class EnterpriseBaseComponent {
public eeTrialService:EnterpriseTrialService) {
}
-
public openTrialModal() {
// cancel request and open first modal window
this.eeTrialService.cancelled = true;
diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.html b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.html
index 5fdc087fe7b..3b79739ee71 100644
--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.html
+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.html
@@ -55,9 +55,9 @@
formControlName="general_consent">
</div>
<span>I agree with the
- <a href="https://www.openproject.com/terms-of-service/" target="_blank">
- terms of service</a> and the
- <a href="https://www.openproject.com/legal-notice/" target="_blank">privacy policy</a>.
+ <a href="https://www.openproject.com/terms-of-service/" target="_blank">{{ text.terms_of_service }}</a>
+ and the
+ <a href="https://www.openproject.com/legal-notice/" target="_blank">{{ text.privacy_policy }}</a>.
</span>
</label>
</div>
diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.ts b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.ts
index 75909a619ec..a7bc6ddf4f0 100644
--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.ts
+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.ts
@@ -56,6 +56,8 @@ export class EETrialFormComponent {
label_email: this.I18n.t('js.admin.enterprise.trial.label_email'),
label_domain: this.I18n.t('js.admin.enterprise.trial.label_domain'),
next_step: this.I18n.t('js.admin.enterprise.trial.next_step'),
+ privacy_policy: this.I18n.t('js.admin.enterprise.trial.privacy_policy'),
+ terms_of_service: this.I18n.t('js.admin.enterprise.trial.terms_of_service')
};
constructor(readonly elementRef:ElementRef,
diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.html b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.html
deleted file mode 100644
index a27e52d3d65..00000000000
--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<ng-content></ng-content>
-
-<p>
- We sent you and email to {{ eeTrialService.trialForm.email }}
- Please check your mails and click the confirmation link provided to start your 14 days trial.
-</p>
-<p>
- <span>Status: </span>
- <span *ngIf="!eeTrialService.confirmed; else confirmedStatus" class="status--waiting">
- email sent - waiting for confirmation
- <a id="resend-link" (click)="eeTrialService.resendMail()">{{ text.resend }}</a>
-
- <p *ngIf="eeTrialService.cancelled">
- Sorry, session timed out. Please try to resend mail.
- </p>
- </span>
-
- <ng-template #confirmedStatus>
- <span class="status--confirmed">confirmed ✓</span>
- </ng-template>
-</p>
\ No newline at end of file
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.html
index feaefc8d34c..e939ba85d36 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
@@ -3,9 +3,9 @@
data-indicator-name="modal"
tabindex="0">
<div class="op-modal--modal-header">
- <h3 *ngIf="!eeTrialService.status"> {{ text.label_test_ee }}</h3>
- <h3 *ngIf="eeTrialService.status === 'mailSubmitted'">Confirmation of email-address</h3>
- <h3 *ngIf="eeTrialService.status === 'startTrial'">Next steps</h3>
+ <h3 *ngIf="!eeTrialService.status"> {{ text.heading_test_ee }}</h3>
+ <h3 *ngIf="eeTrialService.status === 'mailSubmitted'">{{ text.heading_confirmation }}</h3>
+ <h3 *ngIf="eeTrialService.status === 'startTrial'">{{ text.heading_next_steps }}</h3>
<a *ngIf="showClose" class="op-modal--modal-close-button">
<i class="icon-close"
(click)="closeModal($event)"
@@ -25,17 +25,16 @@
</div>
<!-- third modal window -->
<div *ngIf="eeTrialService.status === 'startTrial'">
- <h2>Get an overview</h2>
<div class="onboarding--video-block">
<div class="onboarding--video-text">
- <span>Get a quick overview of project management and team collaboration with OpenProject.</span>
+ <span>{{ text.quick_overview }}</span>
</div>
<div class="onboarding--video iframe-target-wrapper">
<iframe frameborder="0"
height="400"
width="100%"
allowfullscreen=""
- src="https://player.vimeo.com/video/163426858?autoplay=1">
+ src="https://www.youtube.com/embed/zLMSydhFSkw?autoplay=1">
</iframe>
</div>
</div>
diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass
index 4ff8beda103..9f4f72f694a 100644
--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass
+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass
@@ -1,4 +1,7 @@
@import 'helpers'
.op-modal--modal-body
- max-height: 65vh
\ No newline at end of file
+ max-height: 65vh
+
+ .onboarding--video-text
+ margin-bottom: 1.25rem
\ No newline at end of file
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.ts
index c651ac18e01..e313a8dad8b 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,24 +27,15 @@
// ++
import {AfterViewInit, ChangeDetectorRef, Component, ElementRef, Inject, Input, ViewChild} from "@angular/core";
-import {HttpClient, HttpErrorResponse} from "@angular/common/http";
-import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
+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";
import {OpModalLocalsMap} from "app/components/op-modals/op-modal.types";
import {I18nService} from "app/modules/common/i18n/i18n.service";
-import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";
-import {NotificationsService} from "core-app/modules/common/notifications/notifications.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 interface EnterpriseTrialOptions {
- text:{
- title:string;
- text:string;
- button_continue?:string;
- button_cancel?:string;
- };
closeByEscape?:boolean;
showClose?:boolean;
closeByDocument?:boolean;
@@ -74,31 +65,25 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewI
button_cancel: this.I18n.t('js.modals.button_cancel'),
button_continue: this.I18n.t('js.button_continue'),
close_popup: this.I18n.t('js.close_popup_title'),
- label_test_ee: this.I18n.t('js.admin.enterprise.trial.test_ee'),
+ heading_confirmation: this.I18n.t('js.admin.enterprise.trial.confirmation'),
+ heading_next_steps: this.I18n.t('js.admin.enterprise.trial.next_steps'),
+ heading_test_ee: this.I18n.t('js.admin.enterprise.trial.test_ee'),
next_step: this.I18n.t('js.admin.enterprise.trial.next_step'),
- resend: this.I18n.t('js.admin.enterprise.trial.resend_link'),
- title: this.I18n.t('js.modals.form_submit.title'),
- text: this.I18n.t('js.modals.form_submit.text'),
+ quick_overview: this.I18n.t('js.admin.enterprise.trial.quick_overview')
};
constructor(readonly elementRef:ElementRef,
@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
readonly cdRef:ChangeDetectorRef,
readonly I18n:I18nService,
- protected http:HttpClient,
- readonly pathHelper:PathHelperService,
- protected notificationsService:NotificationsService,
public eeTrialService:EnterpriseTrialService) {
super(locals, cdRef, elementRef);
// modal configuration
this.options = locals.options || {};
- this.closeOnEscape = _.defaultTo(this.options.closeByEscape, true);
+ this.closeOnEscape = _.defaultTo(this.options.closeByEscape, false);
this.closeOnOutsideClick = _.defaultTo(this.options.closeByDocument, true);
this.showClose = _.defaultTo(this.options.showClose, true);
-
- // override default texts if any
- this.text = _.defaults(this.options.text, this.text);
}
ngAfterViewInit() {
@@ -111,13 +96,12 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewI
this.trialForm.addControl('_type', new FormControl('enterprise-trial'));
this.eeTrialService.cancelled = false;
- this.eeTrialService.sendForm(this.trialForm.value);
+ this.eeTrialService.sendForm(this.trialForm);
}
}
- // TODO: add enterprise onboarding youtube video
public startEnterpriseTrial() {
- // open onboarding modal
+ // open onboarding modal screen
this.eeTrialService.status = 'startTrial';
}
diff --git a/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.html b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.html
new file mode 100644
index 00000000000..8070a95f187
--- /dev/null
+++ b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.html
@@ -0,0 +1,16 @@
+<ng-content></ng-content>
+
+<p>{{ text.confirmation_info }}</p>
+<p>
+ <span>{{ text.label_status }} </span>
+ <span *ngIf="!eeTrialService.confirmed; else confirmedStatus" class="status--waiting">
+ {{ text.status_waiting }}
+ <a id="resend-link" (click)="eeTrialService.resendMail()">{{ text.resend }}</a>
+
+ <p *ngIf="eeTrialService.cancelled">{{ text.session_timeout }}</p>
+ </span>
+
+ <ng-template #confirmedStatus>
+ <span class="status--confirmed">{{ text.status_confirmed }}</span>
+ </ng-template>
+</p>
\ No newline at end of file
diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.sass b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.sass
similarity index 77%
rename from frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.sass
rename to frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.sass
index cf9d64cea7a..af99346b61a 100644
--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.sass
+++ b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.sass
@@ -1,5 +1,3 @@
-@import 'helpers'
-
#resend-link
float: right
diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.ts b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts
similarity index 82%
rename from frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.ts
rename to frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts
index 2d861b562b6..fb9e7cf669d 100644
--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.ts
+++ b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts
@@ -37,7 +37,12 @@ import {EnterpriseTrialService} from "app/components/enterprise/enterprise-trial
})
export class EETrialWaitingComponent {
public text = {
- resend: this.I18n.t('js.admin.enterprise.trial.resend_link')
+ confirmation_info: this.I18n.t('js.admin.enterprise.trial.confirmation_info'),
+ label_status: this.I18n.t('js.admin.enterprise.trial.label_status'),
+ resend: this.I18n.t('js.admin.enterprise.trial.resend_link'),
+ session_timeout: this.I18n.t('js.admin.enterprise.trial.session_timeout'),
+ status_waiting: this.I18n.t('js.admin.enterprise.trial.status_waiting'),
+ status_confirmed: this.I18n.t('js.admin.enterprise.trial.status_confirmed')
};
constructor(readonly elementRef:ElementRef,
diff --git a/frontend/src/app/components/enterprise/enterprise-trial.service.ts b/frontend/src/app/components/enterprise/enterprise-trial.service.ts
index 72a210964fc..777156fb9ec 100644
--- a/frontend/src/app/components/enterprise/enterprise-trial.service.ts
+++ b/frontend/src/app/components/enterprise/enterprise-trial.service.ts
@@ -3,11 +3,19 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";
import {NotificationsService} from "core-app/modules/common/notifications/notifications.service";
-import {FormGroup} from "@angular/forms";
+import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
@Injectable()
export class EnterpriseTrialService {
+ private localStorageKey = 'openProject-enterprise-trial';
+
+ public text = {
+ resend_success: this.I18n.t('js.admin.enterprise.trial.resend_success'),
+ resend_warning: this.I18n.t('js.admin.enterprise.trial.resend_warning')
+ };
+
+ public savedUserData:any; // saved data in local storage
public trialForm:FormGroup;
public baseUrlAugur = 'https://augur.openproject-edge.com';
public trialLink:string;
@@ -21,7 +29,15 @@ export class EnterpriseTrialService {
constructor(readonly I18n:I18nService,
protected http:HttpClient,
readonly pathHelper:PathHelperService,
- protected notificationsService:NotificationsService) {
+ protected notificationsService:NotificationsService,
+ readonly formBuilder:FormBuilder) {
+ this.savedUserData = window.OpenProject.guardedLocalStorage(this.localStorageKey);
+ // user has already submitted a valid mail and received a confirmation link
+ if (this.savedUserData) {
+ this.savedUserData = JSON.parse(this.savedUserData);
+ this.resendLink = this.savedUserData.resend_link;
+ this.status = 'mailSubmitted';
+ }
}
// sends POST request with form object
@@ -32,10 +48,9 @@ export class EnterpriseTrialService {
const retries = 60; // keep trying for 5 minutes
// POST /public/v1/trials/
- this.http.post(this.baseUrlAugur + '/public/v1/trials', form)
+ this.http.post(this.baseUrlAugur + '/public/v1/trials', form.value)
.toPromise()
.then((enterpriseTrial:any) => {
- console.log('Form successfully send: ', this.trialForm);
this.trialLink = enterpriseTrial._links.self.href;
this.retryConfirmation(delay, retries);
@@ -60,9 +75,12 @@ export class EnterpriseTrialService {
.then((res:any) => {
// show confirmed status and enable continue btn
this.confirmed = true;
- // returns token if mail was confirmed -> save token in backend
- console.log('res.token_retrieved: ', res.token_retrieved);
- this.saveToken(res.token);
+
+ // returns token if mail was confirmed
+ // -> if token is new (token_retrieved: false) save token in backend
+ if (!res.token_retrieved) {
+ this.saveToken(res.token);
+ }
})
.catch((error:HttpErrorResponse) => {
// returns error 422 while waiting of confirmation
@@ -73,11 +91,19 @@ export class EnterpriseTrialService {
// get resend button link
this.resendLink = error.error._links.resend.href;
+
+ this.savedUserData = {
+ 'subscriber': this.trialForm.value.first_name + ' ' + this.trialForm.value.last_name,
+ 'email': this.trialForm.value.email,
+ 'resend_link': this.resendLink
+ };
+ window.OpenProject.guardedLocalStorage(this.localStorageKey, JSON.stringify(this.savedUserData));
+
} else if (_.get(error, 'error._type') === 'Error') {
this.notificationsService.addWarning(error.error.message);
} else {
// backend returned an unsuccessful response code
- this.notificationsService.addWarning(error.error);
+ this.notificationsService.addWarning(error.error || I18n.t('js.error.internal'));
}
});
}
@@ -85,15 +111,13 @@ export class EnterpriseTrialService {
// saves received token in controller
private saveToken(token:string) {
// POST /admin/enterprise (params[:enterprise_token][:encoded_token])
- // -> if token is new (token_retrieved: false) save token in ruby controller
this.http.post(this.pathHelper.api.v3.appBasePath + '/admin/enterprise', { enterprise_token: { encoded_token: token } }, { withCredentials: true })
.toPromise()
.then((res:any) => {
- console.log('saveToken() success: ', res);
+ window.localStorage.removeItem(this.localStorageKey);
})
.catch((error:HttpErrorResponse) => {
- console.log('saveToken() failed: ', error.error);
- this.notificationsService.addWarning(error.error.description || I18n.t('js.error.internal'));
+ this.notificationsService.addWarning(error.error || I18n.t('js.error.internal'));
});
}
@@ -119,14 +143,13 @@ export class EnterpriseTrialService {
this.http.post(this.baseUrlAugur + this.resendLink, {})
.toPromise()
.then((enterpriseTrial:any) => {
- this.notificationsService.addSuccess('Mail has been resent. Please check your mails and click the confirmation link provided.');
+ this.notificationsService.addSuccess(this.text.resend_success);
this.cancelled = false;
this.retryConfirmation(5000, 60);
})
.catch((error:HttpErrorResponse) => {
- console.log('An Error occured: ', error);
- this.notificationsService.addWarning('Could not resend mail.');
+ this.notificationsService.addWarning(this.text.resend_warning);
});
}
}
\ No newline at end of file