Skip to content

Commit

Permalink
Merge pull request #1720 from girder/always-show-all-columns
Browse files Browse the repository at this point in the history
Always show all columns
  • Loading branch information
jeffbaumes authored Nov 7, 2024
2 parents fbb2656 + faa170a commit 890bc44
Showing 1 changed file with 84 additions and 86 deletions.
170 changes: 84 additions & 86 deletions girder/girder_large_image/web_client/templates/itemList.pug
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
<div class="table-cell text-center w-8">
</div>
for column, colidx in itemList.columns
if column.type !== 'image' || hasAnyLargeImage
if column.title !== undefined
- colNames[colidx] = column.title
else
- colNames[colidx] = `${column.value.substr(0, 1).toUpperCase()}${column.value.substr(1)}`
if column.title !== undefined
- colNames[colidx] = column.title
else
- colNames[colidx] = `${column.value.substr(0, 1).toUpperCase()}${column.value.substr(1)}`
- var sortable = (column.type === 'record' && column.value !== 'controls') || column.type === 'metadata'
<div class="table-cell li-item-list-header #{sortable ? 'sortable' : ''}" column_type="#{column.type}", column_value="#{column.value}" scope="col">
<div class="flex items-left my-2 mx-4">
Expand Down Expand Up @@ -45,90 +44,89 @@
</label>
</div>
for column, colidx in itemList.columns
if column.type !== 'image' || hasAnyLargeImage
-
var divtype = column.type !== 'record' || column.value !== 'controls' ? 'a' : 'span';
var classes = divtype == 'a' ? ['g-item-list-link']: [];
if (('' + column.type + column.value).match(/^[a-zA-Z][a-zA-Z0-9-_]*$/)) classes.push(`li-column-${column.type}-${column.value}`);
if (('' + column.type).match(/^[a-zA-Z][a-zA-Z0-9-_]*$/)) classes.push(`li-column-${column.type}`);
var skip = false;
(column.only || []).forEach((only) => {
if (!(only || {}).match) {
return;
}
var onlyval = (only.type === 'record' && only.value === 'name') ? item.name() : (only.type === 'record' && only.value === 'description') ? item.get(only.value) : '';
if (only.type === 'metadata') {
onlyval = item.get('meta') || {};
only.value.split('.').forEach((part) => {
onlyval = (onlyval || {})[part];
})
}
if (onlyval.match(new RegExp(only.match, 'i')) === null) {
skip = true;
}
});
<div class="#{layoutMode == 'grid' ? 'inline-block' : 'table-cell'} align-middle">
<#{divtype} class="li-item-list-cell #{classes.join(' ')} flex items-left mx-4" g-item-cid="#{item.cid}" href="#{item._href ? item._href : `#item/${item.id}`}" title="#{colNames[colidx]}" target="#{item._href && item._hrefTarget ? item._hrefTarget : undefined}">
if !skip && column.label
= column.label
if skip
//- ignore
else if column.type === 'record'
if column.value === 'name'
= item.name()
else if column.value === 'controls'
<div class="flex items-center justify-left">
if downloadLinks
-
var divtype = column.type !== 'record' || column.value !== 'controls' ? 'a' : 'span';
var classes = divtype == 'a' ? ['g-item-list-link']: [];
if (('' + column.type + column.value).match(/^[a-zA-Z][a-zA-Z0-9-_]*$/)) classes.push(`li-column-${column.type}-${column.value}`);
if (('' + column.type).match(/^[a-zA-Z][a-zA-Z0-9-_]*$/)) classes.push(`li-column-${column.type}`);
var skip = false;
(column.only || []).forEach((only) => {
if (!(only || {}).match) {
return;
}
var onlyval = (only.type === 'record' && only.value === 'name') ? item.name() : (only.type === 'record' && only.value === 'description') ? item.get(only.value) : '';
if (only.type === 'metadata') {
onlyval = item.get('meta') || {};
only.value.split('.').forEach((part) => {
onlyval = (onlyval || {})[part];
})
}
if (onlyval.match(new RegExp(only.match, 'i')) === null) {
skip = true;
}
});
<div class="#{layoutMode == 'grid' ? 'inline-block' : 'table-cell'} align-middle">
<#{divtype} class="li-item-list-cell #{classes.join(' ')} flex items-left mx-4" g-item-cid="#{item.cid}" href="#{item._href ? item._href : `#item/${item.id}`}" title="#{colNames[colidx]}" target="#{item._href && item._hrefTarget ? item._hrefTarget : undefined}">
if !skip && column.label
= column.label
if skip
//- ignore
else if column.type === 'record'
if column.value === 'name'
= item.name()
else if column.value === 'controls'
<div class="flex items-center justify-left">
if downloadLinks
<div class="group relative">
<a class="hover:bg-zinc-200 px-2 py-1 rounded-full tracking-wider uppercase text-lg" href="#{item.downloadUrl()}" title="Download File" >
<i class="ri-file-download-line"></i>
</a>
</div>
if availableApps && availableApps.items[item.id]
- const apps = Object.entries(availableApps.items[item.id]).sort(([name1, app1], [name2, app2]) => { let diff = (app1.priority || 0) - (app2.priority || 0); return diff ? diff : (registeredApps[name1].name.toLowerCase() > registeredApps[name2].name.toLowerCase() ? 1 : -1); })
for app in apps
<div class="group relative">
<a class="hover:bg-zinc-200 px-2 py-1 rounded-full tracking-wider uppercase text-lg" href="#{item.downloadUrl()}" title="Download File" >
<i class="ri-file-download-line"></i>
<a class="g-hui-open-link hover:bg-zinc-200 px-2 py-1 rounded-full tracking-wider uppercase text-lg" title="#{'Open in ' + registeredApps[app[0]].name}", href="#{app[1].url}" target="_blank">
<i class="ri-external-link-line"></i>
</a>
</div>
if availableApps && availableApps.items[item.id]
- const apps = Object.entries(availableApps.items[item.id]).sort(([name1, app1], [name2, app2]) => { let diff = (app1.priority || 0) - (app2.priority || 0); return diff ? diff : (registeredApps[name1].name.toLowerCase() > registeredApps[name2].name.toLowerCase() ? 1 : -1); })
for app in apps
<div class="group relative">
<a class="g-hui-open-link hover:bg-zinc-200 px-2 py-1 rounded-full tracking-wider uppercase text-lg" title="#{'Open in ' + registeredApps[app[0]].name}", href="#{app[1].url}" target="_blank">
<i class="ri-external-link-line"></i>
</a>
</div>
</div>
else if column.value === 'size'
= formatSize(item.get('size'))
else if column.value === 'description'
= item.get(column.value)
else if column.type === 'image' && item.get('largeImage')
.large_image_thumbnail(extra-image=column.value !== 'thumbnail' ? column.value : undefined, style=`width: ${column.width || 160}px; height: ${column.height || 100}px`, g-item-cid=column.value === 'thumbnail' ? item.cid : undefined)
- var imageName = column.value === 'thumbnail' ? column.value : `images/${column.value}`;
img.waiting(deferred-src=`${apiRoot}/item/${item.id}/tiles/${imageName}?width=${column.width || 160}&height=${column.height || 100}`)
else if column.type === 'metadata'
-
let value = item.get('meta') || {}
column.value.split('.').forEach((part) => {
value = (value || {})[part];
})
if column.edit && accessLevel >= AccessType.WRITE
- if ((value === '' || value === undefined) && column.default) { value = column.default; }
span.large_image_metadata.lientry_edit(column-idx=colidx)
if column.enum
select.input-sm.form-control.g-widget-metadata-value-input.g-widget-metadata-lientry(title=column.description)
for enumval in column.enum
option(value=enumval, selected=('' + enumval) === ('' + value) ? 'selected' : null)
= enumval
else
input.input-sm.form-control.g-widget-metadata-value-input.g-widget-metadata-column(placeholder=column.description || "Value", value=value, title=column.description)
else
span.large_image_metadata
if column.format === 'text' && value
//- allow long strings to be hyphenated at periods and underscores
!= String(value).replace(/&/g, '&amp;').replace(/</, '&lt;').replace(/>/, '&gt;').replace(/"/, '&quot').replace(/'/, '&#39;').replace(/\./g, '.&shy;').replace(/_/g, '_&shy;')
else
= value
if value && column.format !== 'count'
span.li-item-list-cell-filter(title="Only show items that match this metadata value exactly", filter-value=value, column-value=column.value)
i.icon-filter
</#{divtype}>
</div>
</div>
else if column.value === 'size'
= formatSize(item.get('size'))
else if column.value === 'description'
= item.get(column.value)
else if column.type === 'image' && item.get('largeImage')
.large_image_thumbnail(extra-image=column.value !== 'thumbnail' ? column.value : undefined, style=`width: ${column.width || 160}px; height: ${column.height || 100}px`, g-item-cid=column.value === 'thumbnail' ? item.cid : undefined)
- var imageName = column.value === 'thumbnail' ? column.value : `images/${column.value}`;
img.waiting(deferred-src=`${apiRoot}/item/${item.id}/tiles/${imageName}?width=${column.width || 160}&height=${column.height || 100}`)
else if column.type === 'metadata'
-
let value = item.get('meta') || {}
column.value.split('.').forEach((part) => {
value = (value || {})[part];
})
if column.edit && accessLevel >= AccessType.WRITE
- if ((value === '' || value === undefined) && column.default) { value = column.default; }
span.large_image_metadata.lientry_edit(column-idx=colidx)
if column.enum
select.input-sm.form-control.g-widget-metadata-value-input.g-widget-metadata-lientry(title=column.description)
for enumval in column.enum
option(value=enumval, selected=('' + enumval) === ('' + value) ? 'selected' : null)
= enumval
else
input.input-sm.form-control.g-widget-metadata-value-input.g-widget-metadata-column(placeholder=column.description || "Value", value=value, title=column.description)
else
span.large_image_metadata
if column.format === 'text' && value
//- allow long strings to be hyphenated at periods and underscores
!= String(value).replace(/&/g, '&amp;').replace(/</, '&lt;').replace(/>/, '&gt;').replace(/"/, '&quot').replace(/'/, '&#39;').replace(/\./g, '.&shy;').replace(/_/g, '_&shy;')
else
= value
if value && column.format !== 'count'
span.li-item-list-cell-filter(title="Only show items that match this metadata value exactly", filter-value=value, column-value=column.value)
i.icon-filter
</#{divtype}>
</div>
</div>
</div>

Expand Down

0 comments on commit 890bc44

Please sign in to comment.