Skip to content

Commit 7324b0b

Browse files
authored
Merge pull request #439 from DigitalSlideArchive/searchable-fields-metadata-plot
Make metadata plot dialog select boxes searchable
2 parents b6e1217 + 6632bfc commit 7324b0b

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ repos:
5353
rev: v0.0.18
5454
hooks:
5555
- id: circleci-config-validate
56-
- repo: https://github.com/ThisIsManta/stylus-supremacy
57-
rev: v4.0.0
58-
hooks:
59-
- id: stylus-supremacy
60-
language_version: "22.10.0"
61-
args:
62-
- '--options'
63-
- './histomicsui/web_client/package.json'
56+
# - repo: https://github.com/ThisIsManta/stylus-supremacy
57+
# rev: v4.0.0
58+
# hooks:
59+
# - id: stylus-supremacy
60+
# language_version: "22.12.0"
61+
# args:
62+
# - '--options'
63+
# - './histomicsui/web_client/package.json'
6464
- repo: https://github.com/astral-sh/ruff-pre-commit
6565
# Ruff version.
66-
rev: v0.7.0
66+
rev: v0.8.3
6767
hooks:
6868
- id: ruff
6969
args: [--fix, --exit-non-zero-on-fix]

histomicsui/web_client/dialogs/metadataPlot.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import $ from 'jquery';
2+
import 'select2';
3+
import 'select2/dist/css/select2.css';
24

35
import View from '@girder/core/views/View';
46

@@ -23,6 +25,13 @@ const MetadataPlotDialog = View.extend({
2325
plotOptions: this.plotOptions
2426
})
2527
).girderModal(this);
28+
// this adds search functionality to the select boxes, but not to the
29+
// multiple select, since the select2 tool breaks some traditional
30+
// aspects of multiple select
31+
this.$('.h-plot-select').not('[multiple]').select2({
32+
dropdownParent: $('.modal-body'),
33+
width: '100%'
34+
});
2635

2736
return this;
2837
},

histomicsui/web_client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"copy-webpack-plugin": "^4.5.2",
4040
"petite-vue": "^0.4.1",
4141
"plotly.js": "2.34.0",
42+
"select2": "4.1.0-rc.0",
4243
"sinon": "^2.1.0",
4344
"tinycolor2": "~1.4.1",
4445
"url-search-params-polyfill": "^8.1.1",

histomicsui/web_client/stylesheets/dialogs/metadataPlot.styl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@
55

66
select
77
height calc(100% - 24px)
8+
9+
.select2-container
10+
display block
11+
font-size 14px
12+
line-height 1.42857143
13+
color #222
14+
15+
.select2-results__option
16+
padding 0 6px

histomicsui/web_client/templates/dialogs/metadataPlot.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
label(for='h-plot-series-' + series.key) #{series.label}
3333
if series.comment
3434
p.g-hui-description #{series.comment}
35-
select.form-control(id='h-plot-series-' + series.key, multiple=series.multiple)
35+
select.h-plot-select.form-control(id='h-plot-series-' + series.key, multiple=series.multiple)
3636
if !series.number
3737
option(value='_none_', selected=plotConfig[series.key] === undefined) None
3838
each opt, optidx in plotOptions

0 commit comments

Comments
 (0)