This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vladimir Shakhov
committed
Jul 11, 2017
1 parent
d2b2ebc
commit a575891
Showing
52 changed files
with
882 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 0 additions & 103 deletions
103
src/app/shared/components/character-count-textfield/character-count-textfield.component.ts
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
src/app/shared/components/character-count-textfield/character-count.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="character-count" *ngIf="maxLength"> | ||
{{ value?.length || 0 }}/{{ maxLength }} | ||
</span> |
11 changes: 11 additions & 0 deletions
11
src/app/shared/components/character-count-textfield/character-count.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:host { | ||
position: relative; | ||
display: block; | ||
} | ||
|
||
.character-count { | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
font-size: 0.9em; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/app/shared/components/character-count-textfield/character-count.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
|
||
@Component({ | ||
selector: 'cs-character-count', | ||
templateUrl: 'character-count.component.html', | ||
styleUrls: ['character-count.component.scss'] | ||
}) | ||
export class CharacterCountComponent { | ||
@Input() public maxLength: number; | ||
@Input() public value: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { AbstractControl, ValidatorFn } from '@angular/forms'; | ||
|
||
|
||
export function forbiddenValuesValidator( | ||
forbiddenValues: Array<string> | ||
): ValidatorFn { | ||
return (c: AbstractControl) => { | ||
const isValid = !forbiddenValues.find(_ => _ === c.value); | ||
|
||
if (isValid) { | ||
return null; | ||
} | ||
return { | ||
forbiddenValuesValidator: { | ||
valid: false | ||
} | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Directive, Input, OnInit } from '@angular/core'; | ||
import { FormControl, NG_VALIDATORS, Validator, Validators } from '@angular/forms'; | ||
import { forbiddenValuesValidator } from './forbidden-values-validator'; | ||
|
||
|
||
@Directive({ | ||
// tslint:disable-next-line | ||
selector: '[forbiddenValues]', | ||
providers: [ | ||
{ provide: NG_VALIDATORS, useExisting: ForbiddenValuesDirective, multi: true } | ||
] | ||
}) | ||
export class ForbiddenValuesDirective implements OnInit, Validator { | ||
@Input() public forbiddenValues: Array<string>; | ||
private validator = Validators.nullValidator; | ||
|
||
public ngOnInit(): void { | ||
this.validator = forbiddenValuesValidator(this.forbiddenValues); | ||
} | ||
|
||
public validate(c: FormControl): { [key: string]: any; } { | ||
return this.validator(c); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Tag } from '../models'; | ||
|
||
|
||
export interface Taggable { | ||
id: string; | ||
resourceType: string; | ||
tags: Array<Tag>; | ||
[key: string]: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/app/tags/tag-category-creation-dialog/tag-category-creation.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<h3 class="mdl-dialog__title">{{ 'CREATE_NEW_TAG_CATEGORY' | translate }}</h3> | ||
<form | ||
(ngSubmit)="onCreate()" | ||
#categoryForm="ngForm" | ||
novalidate | ||
> | ||
<div class="mdl-dialog__content"> | ||
|
||
<mdl-textfield | ||
type="text" | ||
name="domain" | ||
autofocus | ||
floating-label | ||
#categoryField="ngModel" | ||
[maxlength]="maxLength" | ||
[(ngModel)]="categoryName" | ||
[forbiddenValues]="categoryNames" | ||
[label]="'TAG_CATEGORY_NAME' | translate" | ||
[error-msg]="categoryNameErrorMessage | translate" | ||
[class.is-invalid]="categoryField.invalid && !categoryField.pristine" | ||
></mdl-textfield> | ||
<cs-character-count | ||
[value]="categoryName" | ||
[maxLength]="maxLength" | ||
></cs-character-count> | ||
|
||
</div> | ||
|
||
<div class="mdl-dialog__actions"> | ||
<button | ||
mdl-button | ||
mdl-colored="primary" | ||
mdl-ripple | ||
type="submit" | ||
[disabled]="!categoryForm.valid" | ||
> | ||
{{ 'CREATE' | translate }} | ||
</button> | ||
<button | ||
mdl-button | ||
mdl-colored="primary" | ||
mdl-ripple | ||
type="button" | ||
(click)="onCancel()" | ||
> | ||
{{ 'CANCEL' | translate }} | ||
</button> | ||
</div> | ||
</form> |
File renamed without changes.
Oops, something went wrong.