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
Resend link working; form styles adapted; notifications added
Inga Mai895bc6a50acd
diff --git a/app/assets/stylesheets/content/_enterprise.sass b/app/assets/stylesheets/content/_enterprise.sassindex 02439a5b045..a48f0373862 100644--- a/app/assets/stylesheets/content/_enterprise.sass+++ b/app/assets/stylesheets/content/_enterprise.sass@@ -22,16 +22,3 @@limargin: 15px-#enterprise-trial-form- .form--field-instructions- color: $content-form-danger-zone-bg-color- margin-left: 0--#resend-link- float: right--.status--confirmed- color: $button--alt-highlight-background-color-.status--waiting- color: orange-diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rbindex 16abdedd431..2ed98b73b79 100644--- a/app/controllers/enterprises_controller.rb+++ b/app/controllers/enterprises_controller.rb@@ -40,13 +40,7 @@ class EnterprisesController < ApplicationControllerdef create@token = EnterpriseToken.current || EnterpriseToken.new@token.encoded_token = params[:enterprise_token][:encoded_token]-- if @token.save- flash[:notice] = t(:notice_successful_update)- redirect_to action: :show- else- render action: :show- end+ @token.saveenddef destroydiff --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 e7c8e2769d1..88720d63d00 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@@ -6,11 +6,10 @@<h3 *ngIf="!status"> {{ text.label_test_ee }}</h3><h3 *ngIf="status === 'mailSubmitted'">Confirmation of email-address</h3><h3 *ngIf="status === 'startTrial'">Next steps</h3>- <a class="op-modal--modal-close-button" *ngIf="showClose">- <i- class="icon-close"- (click)="closeModal($event)"- [attr.title]="text.close_popup">+ <a *ngIf="showClose" class="op-modal--modal-close-button">+ <i class="icon-close"+ (click)="closeModal($event)"+ [attr.title]="text.close_popup"></i></a></div>@@ -18,49 +17,46 @@<div class="op-modal--modal-body"><div *ngIf="!status"><form id="enterprise-trial-form" class="form" [formGroup]="enterpriseTrialForm">- <div class="form--field -required">+ <div class="form--field -wide-label -required"><label class="form--label">{{ text.label_company }}</label><div class="form--field-container"><div class="form--text-field-container"><input type="text"class="form--text-field"- formControlName="company"- required>+ formControlName="company"></div></div></div>- <div class="form--field -required">+ <div class="form--field -wide-label -required"><label class="form--label">{{ text.label_first_name }}</label><div class="form--field-container"><div class="form--text-field-container"><input type="text"class="form--text-field"- formControlName="first_name"- required>+ formControlName="first_name"></div></div></div>- <div class="form--field -required">+ <div class="form--field -wide-label -required"><label class="form--label">{{ text.label_last_name }}</label><div class="form--field-container"><div class="form--text-field-container"><input type="text"class="form--text-field"- formControlName="last_name"- required>+ formControlName="last_name"></div></div></div>- <div class="form--field -required">+ <div class="form--field -wide-label -required" [ngClass]="{ '-error': this.errorMsg }"><label class="form--label">{{ text.label_email }}</label>- <div class="form--field-container" [ngClass]="{ '-required-highlighting': this.errorMsg }">+ <div class="form--field-container"><div class="form--text-field-container"><input type="email" class="form--text-field" formControlName="email" (blur)="checkMailField()"></div></div><div *ngIf="this.errorMsg" class="form--field-instructions">{{ this.errorMsg }}</div></div>- <div class="form--field -required">+ <div class="form--field -wide-label -required"><label class="form--label">{{ text.label_domain }}</label><div class="form--field-container"><div class="form--text-field-container">@@ -68,42 +64,39 @@</div></div></div>- <div class="form--field -required -trailing-label">- <label class="form--label -visible-overflow" for="check-terms-of-service">- <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>.- </span>- <span class="tooltip--right"- data-tooltip="You already confirmed the terms of service when you created your OpenProject trial.">- <i class="icon icon-info1"></i>- </span>- </label>+ <div class="form--field -required"><div class="form--field-container">- <div class="form--check-box-container">- <input class="form--check-box"- id="check-terms-of-service"- required type="checkbox"- formControlName="general_consent">- </div>+ <label class="form--label-with-check-box">+ <div class="form--check-box-container">+ <input type="checkbox"+ class="form--check-box"+ 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>.+ </span>+ <span class="tooltip--right"+ data-tooltip="You already confirmed the terms of service when you created your OpenProject trial.">+ <i class="icon icon-info1"></i>+ </span>+ </label></div></div>- <div class="form--field -trailing-label">- <label class="form--label"- for="receive_newsletter">- <span>I want to receive the OpenProject- <a href="https://www.openproject.com/newsletter/" target="_blank">- newsletter</a>.- </span>- </label>+ <div class="form--field"><div class="form--field-container">- <div class="form--check-box-container">- <input type="checkbox"- id="receive_newsletter"- name="receive_newsletter"- formControlName="newsletter_consent">- </div>+ <label class="form--label-with-check-box">+ <div class="form--check-box-container">+ <input type="checkbox"+ class="form--check-box"+ formControlName="newsletter_consent">+ </div>+ <span>I want to receive the OpenProject+ <a href="https://www.openproject.com/newsletter/" target="_blank">+ newsletter</a>.+ </span>+ </label></div></div></form>@@ -116,7 +109,7 @@<span>Status: </span><span *ngIf="!confirmed; else confirmedStatus" class="status--waiting">email sent - waiting for confirmation- <a id="resend-link" href="{{ baseUrl + resendLink }}" target="_blank">{{ text.resend }}</a>+ <a id="resend-link" (click)="resendMail()">{{ text.resend }}</a></span><ng-template #confirmedStatus><span class="status--confirmed">confirmed ✓</span>@@ -150,7 +143,14 @@(click)="startEnterpriseTrial()"[textContent]="text.button_continue"[attr.title]="text.button_continue"- [disabled]="!confirmed">+ [disabled]="!confirmed"+ [hidden]="status === 'startTrial'">+ </button>+ <button *ngIf="status === 'startTrial'"+ class="confirm-form-submit--continue button -highlight"+ (click)="closeModal($event)"+ [textContent]="text.button_continue"+ [attr.title]="text.button_continue"></button></ng-template></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.sassnew file mode 100644index 00000000000..8a86e985107--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass@@ -0,0 +1,21 @@+@import 'helpers'++.op-modal--modal-body+ max-height: 65vh++#enterprise-trial-form+ .-error+ .form--field-instructions,+ .form--label,+ .form--label::after+ color: var(--content-form-danger-zone-bg-color)+ .form--text-field+ border: 1px solid var(--content-form-danger-zone-bg-color)++#resend-link+ float: right++.status--confirmed+ color: var(--button--alt-highlight-background-color)+.status--waiting+ color: orange\ No newline at end of filediff --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 2515e3d9e3f..664471d0607 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@@ -33,10 +33,10 @@ 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 {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";import {enterpriseEditionUrl} from "core-app/globals/constants.const";import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";+import {NotificationsService} from "core-app/modules/common/notifications/notifications.service";export interface EnterpriseTrialOptions {text:{@@ -51,7 +51,8 @@ export interface EnterpriseTrialOptions {}@Component({- templateUrl: './enterprise-trial.modal.html'+ templateUrl: './enterprise-trial.modal.html',+ styleUrls: ['./enterprise-trial.modal.sass']})export class EnterpriseTrialModal extends OpModalComponent {@Input() public opReferrer:string;@@ -103,7 +104,7 @@ export class EnterpriseTrialModal extends OpModalComponent {readonly I18n:I18nService,protected http:HttpClient,readonly pathHelper:PathHelperService,- protected halNotification:HalResourceNotificationService,+ protected notificationsService:NotificationsService,private formBuilder:FormBuilder) {super(locals, cdRef, elementRef);@@ -137,12 +138,12 @@ export class EnterpriseTrialModal extends OpModalComponent {this.confirmMailAddress();}).catch((error:HttpErrorResponse) => {- // TODO: on error -> use notificationService? or show other msg- if (error.status === 422 || error.status === 400) { // user already created a trial+ // mail is invalid or user already created a trial+ if (error.status === 422 || error.status === 400) {this.errorMsg = error.error.description;} else {- console.log('sendForm: Error in else', error.error.description);// 500 -> internal error occured+ this.notificationsService.addWarning(error.error.description || I18n.t('js.error.internal'));}});}@@ -153,25 +154,20 @@ export class EnterpriseTrialModal extends OpModalComponent {.get<any>(this.baseUrl + this.trialLink).toPromise().then((res:any) => {- // returns token if mail was confirmed// show confirmed status and enable continue btnthis.confirmed = true;-- // save token in backend+ // returns token if mail was confirmed -> save token in backendthis.token = res.token;this.saveToken(this.token);}).catch((error:HttpErrorResponse) => {- let message:undefined|string;- // 2.1) returns error 422 while waiting of confirmation+ // returns error 422 while waiting of confirmationif (error.status === 422 && error.error.identifier === 'waiting_for_email_verification') {- console.log('comfirmMailaddress: Error 422: ', error.error.identifier);// open next modal window// status waitingthis.status = 'mailSubmitted';// get resend button link- // TODO: does not work yetthis.resendLink = error.error._links.resend.href;// TODO add limit for retrying@@ -180,16 +176,13 @@ export class EnterpriseTrialModal extends OpModalComponent {if (!this.cancelled) {this.confirmMailAddress();}- }, 10000);+ }, 5000);} else if (_.get(error, 'error._type') === 'Error') {- message = error.error.message;+ this.notificationsService.addWarning(error.error.message);} else {- // The backend returned an unsuccessful response code.- message = error.error;+ // backend returned an unsuccessful response code+ this.notificationsService.addWarning(error.error);}-- this.halNotification.handleRawError(message);- return message || I18n.t('js.error.internal');});}@@ -200,16 +193,22 @@ export class EnterpriseTrialModal extends OpModalComponent {this.http.post(this.pathHelper.api.v3.appBasePath + '/admin/enterprise', { enterprise_token: { encoded_token: token } }, { withCredentials: true }).toPromise().then((res:any) => {- // TODO show token to copy?+ // TODO: needs clarification: show token to copy?+ console.log('saveToken() success: ', res);}).catch((error:HttpErrorResponse) => {+ console.log('saveToken() failed: ', error.error);});}+ // TODO: needs specificationpublic startEnterpriseTrial() {// open onboarding modalthis.status = 'startTrial';- console.log("Start enterprise trial!", this.status);+ console.log(this.status);+ // on continue:+ // this.closeModal();+ // reload page to show enterprise trial}public checkMailField() {@@ -224,6 +223,23 @@ export class EnterpriseTrialModal extends OpModalComponent {// cancel all actions (e.g. an already send request)this.cancelled = true;this.closeMe(event);+ // refresh page to show trial+ if (this.status === 'startTrial' || this.confirmed) {+ window.location.reload();+ }+ }++ public resendMail() {+ this.http.post(this.baseUrl + this.resendLink, {})+ .toPromise()+ .then((enterpriseTrial:any) => {+ console.log('Mail has been resent.');+ this.notificationsService.addSuccess('Mail has been resent. Please check your mails and click the confirmation link provided.');+ })+ .catch((error:HttpErrorResponse) => {+ console.log('An Error occured: ', error);+ this.notificationsService.addWarning('Could not resend mail.');+ });}}diff --git a/frontend/src/app/components/enterprise/enterprise.component.sass b/frontend/src/app/components/enterprise/enterprise.component.sassdeleted file mode 100644index 4df2e322e98..00000000000--- a/frontend/src/app/components/enterprise/enterprise.component.sass+++ /dev/null@@ -1 +0,0 @@-@import 'helpers'\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise.component.ts b/frontend/src/app/components/enterprise/enterprise.component.tsindex 2a5ab9021f2..5f6ee9796c6 100644--- a/frontend/src/app/components/enterprise/enterprise.component.ts+++ b/frontend/src/app/components/enterprise/enterprise.component.ts@@ -34,8 +34,7 @@ import {OpModalService} from "core-components/op-modals/op-modal.service";@Component({selector: 'enterprise',- templateUrl: './enterprise.component.html',- styleUrls: ['./enterprise.component.sass']+ templateUrl: './enterprise.component.html'})export class EnterpriseComponent {public text = {