Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
morpheus.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daria Zenkova
morpheus.js
Commits
024f617f
Commit
024f617f
authored
Apr 01, 2016
by
joshua-gould
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autocomplete - get current token
parent
a54e89ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
src/matrix/metadata_util.js
src/matrix/metadata_util.js
+11
-15
No files found.
src/matrix/metadata_util.js
View file @
024f617f
...
...
@@ -163,10 +163,11 @@ morpheus.MetadataUtil.autocomplete = function(model) {
var
matches
=
[];
var
regex
=
null
;
var
searchModel
=
model
;
var
token
=
tokens
!=
null
&&
tokens
.
length
>
0
?
tokens
[
tokens
.
length
-
1
]
:
null
;
var
token
=
tokens
!=
null
&&
tokens
.
length
>
0
?
tokens
[
tokens
.
selectionStartIndex
]
:
''
;
token
=
$
.
trim
(
token
);
try
{
if
(
token
!=
null
&&
token
!=
=
''
)
{
if
(
token
!==
''
)
{
var
field
=
null
;
var
semi
=
token
.
indexOf
(
'
:
'
);
if
(
semi
>
0
)
{
// field search?
...
...
@@ -191,7 +192,7 @@ morpheus.MetadataUtil.autocomplete = function(model) {
var
set
=
new
morpheus
.
Set
();
// regex used to determine if a string starts with substring `q`
regex
=
new
RegExp
(
'
^
'
+
token
,
'
i
'
);
regex
=
new
RegExp
(
'
^
'
+
morpheus
.
Util
.
escapeRegex
(
token
)
,
'
i
'
);
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
var
max
=
10
;
...
...
@@ -247,11 +248,7 @@ morpheus.MetadataUtil.autocomplete = function(model) {
var
field
=
array
[
1
];
var
val
=
array
[
0
];
matches
.
push
({
value
:
(
field
.
indexOf
(
'
'
)
>
0
?
(
'
"
'
+
field
+
'
"
'
)
:
field
)
+
'
:
'
+
(
val
.
indexOf
(
'
'
)
>
0
?
(
'
"
'
+
val
+
'
"
'
)
:
val
),
value
:
field
+
'
:
'
+
val
,
label
:
'
<span style="font-weight:300;">
'
+
field
+
'
:</span>
'
+
'
<span style="font-weight:900;">
'
+
val
...
...
@@ -275,11 +272,10 @@ morpheus.MetadataUtil.autocomplete = function(model) {
||
dataType
===
'
[string]
'
)
{
if
(
regex
.
test
(
field
))
{
matches
.
push
({
value
:
(
field
.
indexOf
(
'
'
)
>
0
?
(
'
"
'
+
field
+
'
"
'
)
:
field
)
+
'
:
'
,
value
:
field
+
'
:
'
,
label
:
'
<span style="font-weight:300;">
'
+
field
+
'
:</span>
'
+
'
:</span>
'
,
show
:
true
});
}
}
...
...
@@ -331,8 +327,8 @@ morpheus.MetadataUtil.DEFAULT_HIDDEN_FIELDS = new morpheus.Set();
'
pert_mfc_id
'
,
'
pert_time
'
,
'
pert_time_unit
'
,
'
pert_univ_id
'
,
'
pert_vehicle
'
,
'
pool_id
'
,
'
rna_plate
'
,
'
rna_well
'
,
'
count_mean
'
,
'
count_cv
'
,
'
provenance_code
'
].
forEach
(
function
(
name
)
{
morpheus
.
MetadataUtil
.
DEFAULT_HIDDEN_FIELDS
.
add
(
name
);
});
morpheus
.
MetadataUtil
.
DEFAULT_HIDDEN_FIELDS
.
add
(
name
);
});
morpheus
.
MetadataUtil
.
DEFAULT_FIELDS_TO_SHOW
=
{
'
cell_id
'
:
true
,
'
pert_idose
'
:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment