* Add translations for en and fi to test with * Fix file select not being translated * Add more translations for en and fi to test with * Update permission labels to locale version * Revert forms.scss file * Revert changes * Specify file selector button type Co-authored-by: Daniel James Smith <djsmith@web.de> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
3ed1221f7f
commit
768de03269
|
@ -291,12 +291,25 @@
|
|||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="file">2. {{ "selectImportFile" | i18n }}</label>
|
||||
<br />
|
||||
<div class="file-selector">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-primary"
|
||||
onclick="document.getElementById('file').click()"
|
||||
>
|
||||
{{ "chooseFile" | i18n }}
|
||||
</button>
|
||||
{{ this.fileSelected ? this.fileSelected.name : ("noFileChosen" | i18n) }}
|
||||
</div>
|
||||
<input
|
||||
type="file"
|
||||
id="file"
|
||||
class="form-control-file"
|
||||
name="file"
|
||||
style="display: none"
|
||||
[disabled]="importBlockedByPolicy$ | async"
|
||||
(change)="setSelectedFile($event)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -25,6 +25,7 @@ export class ImportComponent implements OnInit, OnDestroy {
|
|||
importOptions: ImportOption[];
|
||||
format: ImportType = null;
|
||||
fileContents: string;
|
||||
fileSelected: File;
|
||||
formPromise: Promise<ImportError>;
|
||||
loading = false;
|
||||
importBlockedByPolicy$ = this.policyService.policyAppliesToActiveUser$(
|
||||
|
@ -184,6 +185,11 @@ export class ImportComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
setSelectedFile(event: Event) {
|
||||
const fileInputEl = <HTMLInputElement>event.target;
|
||||
this.fileSelected = fileInputEl.files.length > 0 ? fileInputEl.files[0] : null;
|
||||
}
|
||||
|
||||
private async error(error: Error) {
|
||||
await Swal.fire({
|
||||
heightAuto: false,
|
||||
|
|
|
@ -1192,6 +1192,12 @@
|
|||
"selectImportFile": {
|
||||
"message": "Select the import file"
|
||||
},
|
||||
"chooseFile": {
|
||||
"message": "Choose File"
|
||||
},
|
||||
"noFileChosen": {
|
||||
"message": "No file chosen"
|
||||
},
|
||||
"orCopyPasteFileContents": {
|
||||
"message": "or copy/paste the import file contents"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue