* 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="col-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="file">2. {{ "selectImportFile" | i18n }}</label>
|
<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
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
id="file"
|
id="file"
|
||||||
class="form-control-file"
|
class="form-control-file"
|
||||||
name="file"
|
name="file"
|
||||||
|
style="display: none"
|
||||||
[disabled]="importBlockedByPolicy$ | async"
|
[disabled]="importBlockedByPolicy$ | async"
|
||||||
|
(change)="setSelectedFile($event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,6 +25,7 @@ export class ImportComponent implements OnInit, OnDestroy {
|
||||||
importOptions: ImportOption[];
|
importOptions: ImportOption[];
|
||||||
format: ImportType = null;
|
format: ImportType = null;
|
||||||
fileContents: string;
|
fileContents: string;
|
||||||
|
fileSelected: File;
|
||||||
formPromise: Promise<ImportError>;
|
formPromise: Promise<ImportError>;
|
||||||
loading = false;
|
loading = false;
|
||||||
importBlockedByPolicy$ = this.policyService.policyAppliesToActiveUser$(
|
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) {
|
private async error(error: Error) {
|
||||||
await Swal.fire({
|
await Swal.fire({
|
||||||
heightAuto: false,
|
heightAuto: false,
|
||||||
|
|
|
@ -1192,6 +1192,12 @@
|
||||||
"selectImportFile": {
|
"selectImportFile": {
|
||||||
"message": "Select the import file"
|
"message": "Select the import file"
|
||||||
},
|
},
|
||||||
|
"chooseFile": {
|
||||||
|
"message": "Choose File"
|
||||||
|
},
|
||||||
|
"noFileChosen": {
|
||||||
|
"message": "No file chosen"
|
||||||
|
},
|
||||||
"orCopyPasteFileContents": {
|
"orCopyPasteFileContents": {
|
||||||
"message": "or copy/paste the import file contents"
|
"message": "or copy/paste the import file contents"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue