Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
fix(web): Remove inputs and outputs properties in auth-modal, replace…
Browse files Browse the repository at this point in the history
… them to bindIO
  • Loading branch information
EndyKaufman committed Feb 6, 2019
1 parent a8c6469 commit 5a71d39
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNotEmpty, Validate } from 'class-validator';
import { IsEmail, IsNotEmpty, Validate } from 'class-validator';
import { IModel } from 'ngx-repository';
import { EqualsToOtherProperty } from '../../utils/custom-validators';
import { translate } from '../../utils/translate';
Expand All @@ -19,6 +19,9 @@ export class AuthModalModel implements IModel {
@IsNotEmpty({
groups: [AuthModalTypeEnum.SignIn.toString(), AuthModalTypeEnum.#.toString()]
})
@IsEmail(undefined, {
groups: [AuthModalTypeEnum.SignIn.toString(), AuthModalTypeEnum.#.toString()]
})
email: string = undefined;
@IsNotEmpty({
groups: [AuthModalTypeEnum.SignIn.toString(), AuthModalTypeEnum.#.toString()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@
class="col-md-6"
*ngIf="!simpleMode">
<form-group
[checkIsDirty]="checkIsDirty"
[form]="form"
[bindIO]
[title]="strings.roles">
<div class="checkboxes-group form-control">
<div class="checkbox">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,10 @@
[formGroup]="form"
novalidate>
<prompt-form-modal
[title]="title"
[message]="message"
[infoMessage]="signInType === type ? signInInfoMessage : #InfoMessage"
[errorMessage]="errorMessage"
[readonly]="readonly"
[noTitle]="noTitle"
[yesTitle]="yesTitle"
(no)="onNoClick()"
(yes)="onYesClick()"
[data]="data"
[processing]="processing$ | async"
[leftFooterButtonsTemplate]="signOutType !== type && !readonly ? leftFooterButtonsTemplate : null"
[footerButtonsTemplate]="signOutType !== type && !readonly ? socialFooterButtonsTemplate : null"
#promptFormModal
[yesClass]="yesClass$ | async"
[noClass]="noClass$ | async">
#promptFormModal>
<form-group
[bindIO]
name="username"
Expand Down
20 changes: 17 additions & 3 deletions libs/rucken/web/src/lib/modules/auth-modal/auth-modal.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChangeDetectionStrategy, Component, Inject, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnInit, ViewChild } from '@angular/core';
import { AuthModalComponent, AUTH_MODAL_CONFIG_TOKEN, IAuthModalConfig } from '@rucken/core';
import { BindIoInner } from 'ngx-bind-io';
import { BindIoInner, NgxBindIoService } from 'ngx-bind-io';
import { PromptFormModalComponent } from '../../components/prompt-form-modal/prompt-form-modal.component';

@BindIoInner()
@Component({
Expand All @@ -9,9 +10,22 @@ import { BindIoInner } from 'ngx-bind-io';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class WebAuthModalComponent extends AuthModalComponent implements OnInit {
@ViewChild('promptFormModal')
promptFormModal: PromptFormModalComponent;
constructor(
@Inject(AUTH_MODAL_CONFIG_TOKEN) private _authModalConfig: IAuthModalConfig
@Inject(AUTH_MODAL_CONFIG_TOKEN) private _authModalConfig: IAuthModalConfig,
private _ngxBindIoService: NgxBindIoService,
private _changeDetectorRef: ChangeDetectorRef
) {
super(_authModalConfig);
}
ngOnInit() {
super.ngOnInit();
this._ngxBindIoService.linkHostToInner(
this,
this.promptFormModal,
undefined,
this._changeDetectorRef
);
}
}
3 changes: 1 addition & 2 deletions libs/rucken/web/src/lib/modules/modals/modals.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { isPlatformServer } from '@angular/common';
import { Inject, Injectable, PLATFORM_ID, TemplateRef, isDevMode } from '@angular/core';
import { Inject, Injectable, isDevMode, PLATFORM_ID, TemplateRef } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ErrorsExtractor, IModalRef, ModalsService } from '@rucken/core';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { MessageModalComponent } from './message-modal.component';
import { NgxBindIoService } from 'ngx-bind-io';
@Injectable()
export class WebModalsService extends ModalsService {
componentInfoModal: MessageModalComponent;
Expand Down

0 comments on commit 5a71d39

Please # to comment.