dynamic search placeholder text
This commit is contained in:
parent
6fbe640d15
commit
1995cee08d
|
@ -1,6 +1,7 @@
|
||||||
<div class="header header-search">
|
<div class="header header-search">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<input type="search" placeholder="{{'searchVault' | i18n}}" id="search" [(ngModel)]="searchText" />
|
<input type="search" placeholder="{{searchPlaceholder || ('searchVault' | i18n)}}" id="search"
|
||||||
|
[(ngModel)]="searchText" />
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,6 +23,7 @@ export class CiphersComponent implements OnInit {
|
||||||
|
|
||||||
ciphers: CipherView[] = [];
|
ciphers: CipherView[] = [];
|
||||||
searchText: string;
|
searchText: string;
|
||||||
|
searchPlaceholder: string = null;
|
||||||
private filter: (cipher: CipherView) => boolean = null;
|
private filter: (cipher: CipherView) => boolean = null;
|
||||||
|
|
||||||
constructor(private cipherService: CipherService) {
|
constructor(private cipherService: CipherService) {
|
||||||
|
|
|
@ -27,6 +27,8 @@ import { CipherView } from 'jslib/models/view/cipherView';
|
||||||
import { CollectionView } from 'jslib/models/view/collectionView';
|
import { CollectionView } from 'jslib/models/view/collectionView';
|
||||||
import { FolderView } from 'jslib/models/view/folderView';
|
import { FolderView } from 'jslib/models/view/folderView';
|
||||||
|
|
||||||
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-vault',
|
selector: 'app-vault',
|
||||||
template: template,
|
template: template,
|
||||||
|
@ -45,7 +47,7 @@ export class VaultComponent implements OnInit {
|
||||||
collectionId: string = null;
|
collectionId: string = null;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private router: Router, private location: Location,
|
constructor(private route: ActivatedRoute, private router: Router, private location: Location,
|
||||||
private componentFactoryResolver: ComponentFactoryResolver) {
|
private componentFactoryResolver: ComponentFactoryResolver, private i18nService: I18nService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
@ -138,12 +140,14 @@ export class VaultComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
async clearGroupingFilters() {
|
async clearGroupingFilters() {
|
||||||
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchVault');
|
||||||
await this.ciphersComponent.load();
|
await this.ciphersComponent.load();
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.go();
|
this.go();
|
||||||
}
|
}
|
||||||
|
|
||||||
async filterFavorites() {
|
async filterFavorites() {
|
||||||
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
||||||
await this.ciphersComponent.load((c) => c.favorite);
|
await this.ciphersComponent.load((c) => c.favorite);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.favorites = true;
|
this.favorites = true;
|
||||||
|
@ -151,6 +155,7 @@ export class VaultComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
async filterCipherType(type: CipherType) {
|
async filterCipherType(type: CipherType) {
|
||||||
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
|
||||||
await this.ciphersComponent.load((c) => c.type === type);
|
await this.ciphersComponent.load((c) => c.type === type);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -159,6 +164,7 @@ export class VaultComponent implements OnInit {
|
||||||
|
|
||||||
async filterFolder(folderId: string) {
|
async filterFolder(folderId: string) {
|
||||||
folderId = folderId === 'none' ? null : folderId;
|
folderId = folderId === 'none' ? null : folderId;
|
||||||
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
||||||
await this.ciphersComponent.load((c) => c.folderId === folderId);
|
await this.ciphersComponent.load((c) => c.folderId === folderId);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.folderId = folderId == null ? 'none' : folderId;
|
this.folderId = folderId == null ? 'none' : folderId;
|
||||||
|
@ -166,6 +172,7 @@ export class VaultComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
async filterCollection(collectionId: string) {
|
async filterCollection(collectionId: string) {
|
||||||
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
||||||
await this.ciphersComponent.load((c) => c.collectionIds.indexOf(collectionId) > -1);
|
await this.ciphersComponent.load((c) => c.collectionIds.indexOf(collectionId) > -1);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.collectionId = collectionId;
|
this.collectionId = collectionId;
|
||||||
|
|
|
@ -333,5 +333,18 @@
|
||||||
},
|
},
|
||||||
"ambiguous": {
|
"ambiguous": {
|
||||||
"message": "Avoid Ambiguous Characters"
|
"message": "Avoid Ambiguous Characters"
|
||||||
|
},
|
||||||
|
"searchCollection": {
|
||||||
|
"message": "Search collection"
|
||||||
|
},
|
||||||
|
"searchFolder": {
|
||||||
|
"message": "Search folder"
|
||||||
|
},
|
||||||
|
"searchFavorites": {
|
||||||
|
"message": "Search favorites"
|
||||||
|
},
|
||||||
|
"searchType": {
|
||||||
|
"message": "Search type",
|
||||||
|
"description": "Search item type"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue