max tags
This commit is contained in:
@@ -31,7 +31,8 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<ui-tagspicker [(model)]="entry.tags" placeholder="{{'submission.tags' | i18n}}"></ui-tagspicker>
|
||||
<ui-tagspicker [(model)]="entry.tags" placeholder="{{'submission.tags' | i18n}}" [max]="settings.maxTags">
|
||||
</ui-tagspicker>
|
||||
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { MatChipInputEvent } from '@angular/material/chips';
|
||||
import { TagsService } from 'src/app/services/tags.service';
|
||||
import { SettingsService } from 'src/app/services/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'page-entry-edit',
|
||||
@@ -23,11 +24,13 @@ export class PageEntryEdit implements OnInit {
|
||||
working: boolean = false;
|
||||
success: boolean = false;
|
||||
form: FormGroup;
|
||||
settings: any;
|
||||
readonly tagsSeparatorKeysCodes = [ ENTER, COMMA, SPACE ] as const;
|
||||
@ViewChild('formDirective') private formDirective: NgForm;
|
||||
|
||||
constructor(private entriesService: EntriesService,
|
||||
private tagsService: TagsService,
|
||||
private settingsService: SettingsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private snackBar: MatSnackBar) { }
|
||||
@@ -40,6 +43,10 @@ export class PageEntryEdit implements OnInit {
|
||||
text: [ '', Validators.nullValidator ],
|
||||
});
|
||||
|
||||
this.settingsService.settings.subscribe((settings) => {
|
||||
this.settings = settings;
|
||||
});
|
||||
|
||||
this.form.get('entryType').disable();
|
||||
|
||||
this.form.get('entryType').valueChanges.subscribe((value) => {
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<ui-tagspicker [(model)]="tags" placeholder="{{'submission.tags' | i18n}}"></ui-tagspicker>
|
||||
<ui-tagspicker [(model)]="tags" placeholder="{{'submission.tags' | i18n}}" [max]="settings.maxTags">
|
||||
</ui-tagspicker>
|
||||
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { FormBuilder, FormGroup, Validators, NgForm } from '@angular/forms';
|
||||
import { COMMA, ENTER, SPACE } from '@angular/cdk/keycodes';
|
||||
import { distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
||||
import { MatChipInputEvent } from '@angular/material/chips';
|
||||
import { SettingsService } from 'src/app/services/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'page-submission',
|
||||
@@ -19,9 +20,11 @@ export class PageSubmission implements OnInit {
|
||||
form: FormGroup;
|
||||
readonly tagsSeparatorKeysCodes = [ ENTER, COMMA, SPACE ] as const;
|
||||
tags: string[] = [];
|
||||
settings: any;
|
||||
@ViewChild('formDirective') private formDirective: NgForm;
|
||||
|
||||
constructor(private entriesService: EntriesService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router,
|
||||
private formBuilder: FormBuilder) { }
|
||||
|
||||
@@ -33,6 +36,10 @@ export class PageSubmission implements OnInit {
|
||||
text: [ '', Validators.nullValidator ],
|
||||
});
|
||||
|
||||
this.settingsService.settings.subscribe((settings) => {
|
||||
this.settings = settings;
|
||||
});
|
||||
|
||||
this.form.get('entryType').setValue(this.entryType);
|
||||
|
||||
this.form.get('entryType').valueChanges.subscribe((value) => {
|
||||
|
||||
Reference in New Issue
Block a user