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

Extract status checks into methods and summarise strings

Henriette Dinger0453f8e46763
diff --git a/app/views/enterprises/_info.html.erb b/app/views/enterprises/_info.html.erb
index 9ba419286c4..40a47383ebc 100644
--- a/app/views/enterprises/_info.html.erb
+++ b/app/views/enterprises/_info.html.erb
@@ -45,7 +45,12 @@ See docs/COPYRIGHT.rdoc for more details.
data-cb-plan-id="enterprise-edition---annual-user-license">
<%= t('admin.enterprise.book_now') %>
</a>
- <%= static_link_to :upsale_get_quote %>
+
+ <% quote_link = OpenProject::Static::Links.links.fetch :upsale_get_quote %>
+ <%= link_to t(quote_link[:label]),
+ quote_link[:href],
+ target: '_blank',
+ class: 'button -highlight'%>
</div>
<div class="info-boxes upsale-benefits">
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index e23ab7ebc20..20f86031adf 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -184,9 +184,11 @@ en:
enterprise:
trial:
confirmation: "Confirmation of email address"
- confirmation_info: "We sent you and email. Please check your emails and click the confirmation link provided to start your 14 days trial."
+ confirmation_info: "We sent you an email. Please check your emails and click the confirmation link provided to start your 14 days trial."
form:
- general_consent: "I agree with the"
+ general_consent: >
+ I agree with the <a target="_blank" href="%{link_terms}">terms of service</a>
+ and the <a target="_blank" href="%{link_privacy}">privacy policy</a>.
invalid_email: "Invalid email address"
label_company: "Company"
label_first_name: "First name"
@@ -197,13 +199,9 @@ en:
label_maximum_users: "Maximum active users"
label_starts_at: "Starts at"
label_expires_at: "Expires at"
- privacy_policy: "privacy policy"
- receive_newsletter: "I want to receive the OpenProject"
- newsletter: "newsletter"
- terms_of_service: "terms of service"
- label_status:
- email_not_received: "You did not receive an email? Resend email or"
- try_another_email: "try with another email address"
+ receive_newsletter: I want to receive the OpenProject <a target="_blank" href="%{link}">newsletter</a>.
+ email_not_received: "You did not receive an email? You can resend the email with the link on the right."
+ try_another_email: "Or try it with another email address."
try_another_email_hint: "Please be aware that your previous email address gets invalid if you try again with a new one."
next_steps: "Next steps"
next_step: "In the next step we will send you an email to the email-address provided."
diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.html b/frontend/src/app/components/enterprise/enterprise-base.component.html
index aef3cc291f8..c495f0d5499 100644
--- a/frontend/src/app/components/enterprise/enterprise-base.component.html
+++ b/frontend/src/app/components/enterprise/enterprise-base.component.html
@@ -11,7 +11,7 @@
<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>
+ <a (click)="openTrialModal()">{{ text.try_another_email }}</a><br>
{{ text.try_another_email_hint }}
</p>
</ng-template>
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 16a93e20bc5..8ea5d736dd7 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
@@ -33,7 +33,7 @@
<label class="form--label">{{ text.label_email }}</label>
<div class="form--field-container">
<div class="form--text-field-container"
- [ngClass]="{'-required-highlighting' : eeTrialService.errorMsg}">
+ [ngClass]="{ '-required-highlighting' : eeTrialService.errorMsg }">
<input type="email" class="form--text-field" formControlName="email" (blur)="checkMailField()">
</div>
</div>
@@ -56,11 +56,7 @@
formControlName="general_consent"
required>
</div>
- <span>{{ text.general_consent }}
- <a [href]="termsOfServiceURL" target="_blank">{{ text.terms_of_service }}</a>
- and the
- <a [href]="legalNoticeURL" target="_blank">{{ text.privacy_policy }}</a>.
- </span>
+ <span [innerHTML]="text.general_consent"></span>
</label>
</div>
</div>
@@ -72,10 +68,7 @@
class="form--check-box"
formControlName="newsletter_consent">
</div>
- <span>{{ text.receive_newsletter }}
- <a [href]="newsletterURL" target="_blank">
- {{ text.newsletter }}</a>.
- </span>
+ <span [innerHtml]="text.receive_newsletter"></span>
</label>
</div>
</div>
diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.sass b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.sass
deleted file mode 100644
index 30aa4a1300a..00000000000
--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.sass
+++ /dev/null
@@ -1,8 +0,0 @@
-@import 'helpers'
-
-#enterprise-trial-form
- .-error
- .form--field-instructions,
- .form--label,
- .form--label::after
- color: var(--content-form-danger-zone-bg-color)
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 1903d7919c1..cdc2ecf16d8 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
@@ -31,14 +31,13 @@ import {FormBuilder, Validators} from "@angular/forms";
import {I18nService} from "app/modules/common/i18n/i18n.service";
import {EnterpriseTrialService} from "core-components/enterprise/enterprise-trial.service";
-export const termsOfServiceURL = 'https://www.openproject.com/terms-of-service/';
-export const legalNoticeURL = 'https://www.openproject.com/legal-notice/';
-export const newsletterURL = 'https://www.openproject.com/newsletter/';
+const termsOfServiceURL = 'https://www.openproject.com/terms-of-service/';
+const legalNoticeURL = 'https://www.openproject.com/legal-notice/';
+const newsletterURL = 'https://www.openproject.com/newsletter/';
@Component({
selector: 'enterprise-trial-form',
- templateUrl: './ee-trial-form.component.html',
- styleUrls: ['./ee-trial-form.component.sass']
+ templateUrl: './ee-trial-form.component.html'
})
export class EETrialFormComponent {
// enterprise trial form
@@ -52,11 +51,11 @@ export class EETrialFormComponent {
newsletter_consent: null,
});
- readonly termsOfServiceURL = termsOfServiceURL;
- readonly legalNoticeURL = legalNoticeURL;
- readonly newsletterURL = newsletterURL;
public text = {
- general_consent: this.I18n.t('js.admin.enterprise.trial.form.general_consent'),
+ general_consent: this.I18n.t('js.admin.enterprise.trial.form.general_consent', {
+ link_terms: termsOfServiceURL,
+ link_privacy: legalNoticeURL
+ }),
invalid_email: this.I18n.t('js.admin.enterprise.trial.form.invalid_email'),
label_test_ee: this.I18n.t('js.admin.enterprise.trial.form.test_ee'),
label_company: this.I18n.t('js.admin.enterprise.trial.form.label_company'),
@@ -66,8 +65,7 @@ export class EETrialFormComponent {
label_domain: this.I18n.t('js.admin.enterprise.trial.form.label_domain'),
next_step: this.I18n.t('js.admin.enterprise.trial.next_step'),
privacy_policy: this.I18n.t('js.admin.enterprise.trial.form.privacy_policy'),
- receive_newsletter: this.I18n.t('js.admin.enterprise.trial.form.receive_newsletter'),
- newsletter: this.I18n.t('js.admin.enterprise.trial.form.newsletter'),
+ receive_newsletter: this.I18n.t('js.admin.enterprise.trial.form.receive_newsletter',{ link: newsletterURL }),
terms_of_service: this.I18n.t('js.admin.enterprise.trial.form.terms_of_service')
};
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 d82f4ba2611..91cfa6c4c16 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
@@ -44,7 +44,7 @@
[disabled]="!trialForm || trialForm.invalid"
[textContent]="text.button_submit"
[attr.title]="text.button_submit"
- [hidden]="eeTrialService.status === 'mailSubmitted' && !eeTrialService.cancelled">
+ [hidden]="eeTrialService.mailSubmitted && !eeTrialService.cancelled">
</button>
<button class="confirm-form-submit--cancel button"
(click)="closeModal($event)"
@@ -58,9 +58,9 @@
[textContent]="text.button_continue"
[attr.title]="text.button_continue"
[disabled]="!eeTrialService.confirmed"
- [hidden]="eeTrialService.status === 'startTrial'">
+ [hidden]="eeTrialService.trialStarted">
</button>
- <button *ngIf="eeTrialService.status === 'startTrial'"
+ <button *ngIf="eeTrialService.trialStarted"
class="confirm-form-submit--continue button -highlight"
(click)="closeModal($event)"
[textContent]="text.button_continue"
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 12df5f2f5b6..18c1ab0a119 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
@@ -92,24 +92,23 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewI
public startEnterpriseTrial() {
// open onboarding modal screen
- this.eeTrialService.status = 'startTrial';
+ this.eeTrialService.setStartTrialStatus();
}
public headerText() {
- switch (this.eeTrialService.status) {
- case 'mailSubmitted':
- return this.text.heading_confirmation;
- case 'startTrial':
- return this.text.heading_next_steps;
- default:
- return this.text.heading_test_ee;
+ if (this.eeTrialService.mailSubmitted) {
+ return this.text.heading_confirmation;
+ } else if(this.eeTrialService.trialStarted) {
+ return this.text.heading_next_steps;
+ } else {
+ return this.text.heading_test_ee;
}
}
public closeModal(event:any) {
this.closeMe(event);
// refresh page to show enterprise trial
- if (this.eeTrialService.status === 'startTrial' || this.eeTrialService.confirmed) {
+ if (this.eeTrialService.trialStarted || this.eeTrialService.confirmed) {
window.location.reload();
}
this.eeTrialService.modalOpen = false;
@@ -122,7 +121,7 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewI
public openWindow():number {
if (!this.eeTrialService.status || this.eeTrialService.cancelled) {
return 1;
- } else if (this.eeTrialService.status === 'mailSubmitted' && !this.eeTrialService.cancelled) {
+ } else if (this.eeTrialService.mailSubmitted && !this.eeTrialService.cancelled) {
return 2;
} else {
return 3;
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
index 5007947104e..6937b015e84 100644
--- 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
@@ -4,13 +4,13 @@
<p>
<span>{{ text.status_label }} </span>
<span *ngIf="!eeTrialService.confirmed; else confirmedStatus" class="status--waiting">
- {{ text.status_waiting }}
- <a id="resend-link" (click)="resendMail()">{{ text.resend }}</a>
+ {{ text.status_waiting }}
+ <a id="resend-link" (click)="resendMail()">{{ text.resend }}</a>
<p *ngIf="eeTrialService.cancelled">{{ text.session_timeout }}</p>
</span>
<ng-template #confirmedStatus>
- <span class="status--confirmed">{{ text.status_confirmed }} &#x2713;</span>
+ <span class="status--confirmed icon-yes">{{ text.status_confirmed }}</span>
</ng-template>
-</p>
\ No newline at end of file
+</p>
diff --git a/frontend/src/app/components/enterprise/enterprise-trial.service.ts b/frontend/src/app/components/enterprise/enterprise-trial.service.ts
index cce9cd244e8..e76712203db 100644
--- a/frontend/src/app/components/enterprise/enterprise-trial.service.ts
+++ b/frontend/src/app/components/enterprise/enterprise-trial.service.ts
@@ -153,4 +153,16 @@ export class EnterpriseTrialService {
}, delay);
}
}
-}
\ No newline at end of file
+
+ public setStartTrialStatus() {
+ this.status = 'startTrial';
+ }
+
+ public get trialStarted():boolean {
+ return this.status === 'startTrial';
+ }
+
+ public get mailSubmitted():boolean {
+ return this.status === 'mailSubmitted';
+ }
+}