mirror of
https://github.com/NicolasConstant/sengi
synced 2025-01-31 02:37:10 +01:00
fix language saving
This commit is contained in:
parent
98e7d54c33
commit
503cb6c9d4
@ -57,7 +57,7 @@
|
||||
<button (click)="onRemoveLang(l)">remove</button>
|
||||
</div>
|
||||
<div class="sub-section">
|
||||
<input type="text" (input)="onSearchLang($event.target.value)" />
|
||||
<input type="text" (input)="onSearchLang($event.target.value)" [(ngModel)]="searchLang" />
|
||||
</div>
|
||||
<div *ngFor="let l of searchedLangs">
|
||||
{{ l.iso639 }}
|
||||
|
@ -137,14 +137,23 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
configuredLangs: ILanguage[] = [];
|
||||
searchedLangs: ILanguage[] = [];
|
||||
|
||||
searchLang: string;
|
||||
|
||||
onSearchLang(input: string) {
|
||||
console.warn(input);
|
||||
this.searchedLangs = this.languageService.searchLanguage(input);
|
||||
}
|
||||
|
||||
onAddLang(lang: ILanguage): boolean {
|
||||
if(this.configuredLangs.find(x => x.iso639 === lang.iso639)) return false;
|
||||
|
||||
this.configuredLangs.push(lang);
|
||||
this.languageService.addLanguage(lang);
|
||||
|
||||
this.searchLang = '';
|
||||
this.searchedLangs.length = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,8 @@ export class LanguageService {
|
||||
}
|
||||
|
||||
getConfiguredLanguages(): ILanguage[] {
|
||||
return this.settingsService.getSettings().configuredLanguages;
|
||||
const langs = this.settingsService.getSettings().configuredLanguages;
|
||||
return langs;
|
||||
}
|
||||
|
||||
addLanguage(lang: ILanguage){
|
||||
|
@ -178,6 +178,7 @@ export class SettingsState {
|
||||
newSettings.autoFollowOnListEnabled = oldSettings.autoFollowOnListEnabled;
|
||||
newSettings.twitterBridgeEnabled = oldSettings.twitterBridgeEnabled;
|
||||
newSettings.twitterBridgeInstance = oldSettings.twitterBridgeInstance;
|
||||
newSettings.configuredLanguages = oldSettings.configuredLanguages;
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user