Skip to content

Commit

Permalink
fix file picker
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hartmann <[email protected]>
  • Loading branch information
Chartman123 committed Aug 24, 2024
1 parent 004b5d2 commit 738731e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
**/.svn
**/.hg

# Github workflows
.github/

# 3rdparty dependencies
**/node_modules
**/vendor
Expand Down
64 changes: 32 additions & 32 deletions src/views/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -736,13 +736,40 @@ export default {
t('forms', 'Choose spreadsheet location'),
)
.setMultiSelect(false)
.allowDirectories()
.allowDirectories(true)
.setButtonFactory((selectedNodes, currentPath, currentView) => {
if (selectedNodes.length === 1) {
const extension = selectedNodes[0].extension
.slice(1)
.toLowerCase()
if (SUPPORTED_FILE_FORMATS[extension]) {
?.slice(1)
?.toLowerCase()
if (!extension) {
return [
{
label: t('forms', 'Create XLSX'),
icon: IconFileExcelSvg,
callback() {
fileFormat = 'xlsx'
},
type: 'secondary',
},
{
label: t('forms', 'Create CSV'),
icon: IconFileDelimitedSvg,
callback() {
fileFormat = 'csv'
},
type: 'secondary',
},
{
label: t('forms', 'Create ODS'),
icon: IconTableSvg,
callback() {
fileFormat = 'ods'
},
type: 'primary',
},
]
} else if (SUPPORTED_FILE_FORMATS[extension]) {
return [
{
label: t('forms', 'Select {file}', {
Expand All @@ -756,36 +783,9 @@ export default {
},
]
}
return []
}
return [
{
label: t('forms', 'Create XLSX'),
icon: IconFileExcelSvg,
callback() {
fileFormat = 'xlsx'
},
type: 'secondary',
},
{
label: t('forms', 'Create CSV'),
icon: IconFileDelimitedSvg,
callback() {
fileFormat = 'csv'
},
type: 'secondary',
},
{
label: t('forms', 'Create ODS'),
icon: IconTableSvg,
callback() {
fileFormat = 'ods'
},
type: 'primary',
},
]
return []
})
.build()
Expand Down

0 comments on commit 738731e

Please sign in to comment.