diff --git a/girder/girder_large_image/web_client/templates/itemList.pug b/girder/girder_large_image/web_client/templates/itemList.pug index a95b653b6..c42a5f38b 100644 --- a/girder/girder_large_image/web_client/templates/itemList.pug +++ b/girder/girder_large_image/web_client/templates/itemList.pug @@ -12,11 +12,10 @@
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'
@@ -45,90 +44,89 @@
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; - } - }); -
- <#{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' -
- 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; + } + }); +
+ <#{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' +
+ if downloadLinks +
+ + + +
+ 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 - 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 -
- - - -
-
- 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, '&').replace(//, '>').replace(/"/, '"').replace(/'/, ''').replace(/\./g, '.­').replace(/_/g, '_­') - 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 - -
+
+ 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, '&').replace(//, '>').replace(/"/, '"').replace(/'/, ''').replace(/\./g, '.­').replace(/_/g, '_­') + 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 + +