Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
b96a530a
Commit
b96a530a
authored
Aug 04, 2014
by
igoshin
Committed by
Matija Obreza
Aug 11, 2014
Browse files
"Like" string filters, fix min and max values for numeric fields, <ENTER>
parent
17b95fb9
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/resources/content/language.properties
View file @
b96a530a
...
...
@@ -356,6 +356,8 @@ filter.remove=Remove filter
filter.autocomplete-placeholder
=
Type more than 3 characters...
filter.collMissId
=
Collecting mission ID
filter.storage
=
Type of Germplasm storage
filter.string.equals
=
Equals
filter.string.like
=
Like
search.page.title
=
Full-text Search
...
...
src/main/webapp/WEB-INF/jsp/accession/additional-filter.jsp
View file @
b96a530a
...
...
@@ -65,7 +65,7 @@
<div
class=
"ui-front"
>
<div
class=
"form-group input-group"
>
<span
class=
"input-group-btn"
>
<input
id=
"${normalizedKey}_input"
class=
"span2 form-control autocomplete-filter"
x-source=
"${filter.autocompleteUrl}"
placeholder=
"
<spring:message
code=
"filter.autocomplete-placeholder"
/>
"
type=
"text"
/>
<input
id=
"${normalizedKey}_input"
class=
"span2 form-control autocomplete-filter
string-type
"
x-source=
"${filter.autocompleteUrl}"
placeholder=
"
<spring:message
code=
"filter.autocomplete-placeholder"
/>
"
type=
"text"
/>
<button
class=
"btn notimportant filter-auto"
norm-key=
"${normalizedKey}"
>
+
</button>
</span>
</div>
...
...
@@ -91,7 +91,11 @@
<div
class=
"ui-front"
>
<div
class=
"form-group input-group"
>
<span
class=
"input-group-btn"
>
<input
class=
"span2 form-control"
id=
"${normalizedKey}_input"
type=
"text"
/>
<select
id=
"like-switcher"
class=
"form-control select-like"
>
<option
value=
"like"
><spring:message
code=
"filter.string.like"
/></option>
<option
value=
"equals"
><spring:message
code=
"filter.string.equals"
/></option>
</select>
<input
class=
"span2 form-control string-type"
id=
"${normalizedKey}_input"
type=
"text"
/>
<button
class=
"btn notimportant filter-auto"
norm-key=
"${normalizedKey}"
>
+
</button>
</span>
</div>
...
...
src/main/webapp/WEB-INF/jsp/accession/explore.jsp
View file @
b96a530a
...
...
@@ -124,7 +124,7 @@
<div
class=
"ui-front"
>
<div
class=
"form-group input-group"
>
<span
class=
"input-group-btn"
>
<input
id=
"${normalizedKey}_input"
class=
"span2 form-control autocomplete-filter"
x-source=
"${filter.autocompleteUrl}"
placeholder=
"
<spring:message
code=
"filter.autocomplete-placeholder"
/>
"
type=
"text"
/>
<input
id=
"${normalizedKey}_input"
class=
"span2 form-control autocomplete-filter
string-type
"
x-source=
"${filter.autocompleteUrl}"
placeholder=
"
<spring:message
code=
"filter.autocomplete-placeholder"
/>
"
type=
"text"
/>
<button
class=
"btn notimportant filter-auto"
norm-key=
"${normalizedKey}"
>
+
</button>
</span>
</div>
...
...
@@ -159,10 +159,14 @@
</div>
</c:when>
<c:otherwise>
<div
class=
"ui-front"
>
<div
class=
"ui-front"
>
<div
class=
"form-group input-group"
>
<span
class=
"input-group-btn"
>
<input
class=
"span2 form-control"
id=
"${normalizedKey}_input"
type=
"text"
/>
<select
id=
"like-switcher"
class=
"form-control select-like"
>
<option
value=
"like"
><spring:message
code=
"filter.string.like"
/></option>
<option
value=
"equals"
><spring:message
code=
"filter.string.equals"
/></option>
</select>
<input
class=
"span2 form-control string-type"
id=
"${normalizedKey}_input"
type=
"text"
/>
<button
class=
"btn notimportant filter-auto"
norm-key=
"${normalizedKey}"
>
+
</button>
</span>
</div>
...
...
@@ -187,6 +191,10 @@
<c:set
var=
"string"
value=
"
${
fn:
replace
(
value
,
'{max='
,
'Less than '
)
}
"
/>
<c:set
var=
"string"
value=
"
${
fn:
replace
(
string
,
'}'
,
''
)
}
"
/>
</c:if>
<c:if
test=
"
${
fn:
contains
(
value
,
'like'
)
}
"
>
<c:set
var=
"string"
value=
"
${
fn:
replace
(
value
,
'{like='
,
'Like '
)
}
"
/>
<c:set
var=
"string"
value=
"
${
fn:
replace
(
string
,
'}'
,
''
)
}
"
/>
</c:if>
<c:if
test=
"
${
string
==
null
}
"
>
<c:set
var=
"string"
value=
"null"
/>
</c:if>
...
...
@@ -304,13 +312,31 @@
}
});
$
(
"
body
"
).
on
(
"
keypress
"
,
"
.string-type
"
,
function
(
e
)
{
if
(
e
.
keyCode
==
13
){
var
btn
=
$
(
this
).
parent
().
find
(
"
button
"
);
console
.
log
(
btn
)
var
selectedValue
=
$
(
this
).
parent
().
find
(
"
#like-switcher option:selected
"
).
val
();
if
(
selectedValue
==
"
like
"
)
{
GenesysFilter
.
filterLike
(
btn
,
jsonData
);
}
else
{
GenesysFilter
.
filterAutocomplete
(
btn
,
jsonData
);
}
}
});
$
(
"
body
"
).
on
(
"
click
"
,
"
.filter-list
"
,
function
()
{
GenesysFilter
.
filterList
(
$
(
this
),
jsonData
);
});
$
(
"
body
"
).
on
(
"
click
"
,
"
.filter-auto
"
,
function
()
{
GenesysFilter
.
filterAutocomplete
(
$
(
this
),
jsonData
);
var
selectedValue
=
$
(
this
).
parent
().
find
(
"
#like-switcher option:selected
"
).
val
();
if
(
selectedValue
==
"
like
"
)
{
GenesysFilter
.
filterLike
(
$
(
this
),
jsonData
);
}
else
{
GenesysFilter
.
filterAutocomplete
(
$
(
this
),
jsonData
);
}
});
$
(
"
body
"
).
on
(
"
click
"
,
"
.filter-range
"
,
function
()
{
...
...
src/main/webapp/html/css/custom.css
View file @
b96a530a
...
...
@@ -1434,6 +1434,11 @@ html[dir="rtl"] #allfilters .filter-block .filter-name {
#allfilters
.form-control
{
background
:
#e7e5de
;
}
#allfilters
.select-like
{
width
:
80px
;
padding-left
:
6px
;
}
...
...
@@ -1937,3 +1942,20 @@ html[dir="rtl"] ul.statistics .stats-number {
float
:
right
;
}
.filter-select
{
background
:
none
repeat
scroll
0%
0%
#B4B3AE
;
border-width
:
1px
1px
1px
medium
;
border-style
:
solid
solid
solid
none
;
border-color
:
#4D4D46
#4D4D46
#4D4D46
-moz-use-text-color
;
-moz-border-top-colors
:
none
;
-moz-border-right-colors
:
none
;
-moz-border-bottom-colors
:
none
;
-moz-border-left-colors
:
none
;
border-image
:
none
;
font-size
:
17px
;
font-weight
:
bold
;
height
:
27px
;
line-height
:
5px
;
padding
:
0px
8px
;
}
src/main/webapp/html/js/crophub.js
View file @
b96a530a
...
...
@@ -112,7 +112,7 @@ GenesysFilter = {
}
return
jsonData
;
},
//add filter with two input text fi
l
eds for enter values of range
//add filter with two input text fie
l
ds for enter values of range
filterRange
:
function
(
element
,
jsonData
)
{
var
key
=
$
(
element
).
attr
(
"
norm-key
"
);
var
inputId1
=
"
#
"
+
key
+
"
_input_1
"
;
...
...
@@ -134,9 +134,9 @@ GenesysFilter = {
jsonValue
=
jsonData
[
key
.
replace
(
"
_
"
,
"
:
"
)];
}
var
notNull
=
inputValue1
!=
''
&&
inputValue2
!=
''
;
//
var notNull = inputValue1 != '' && inputValue2 != '';
if
(
!
isNaN
(
inputValue1
)
&&
!
isNaN
(
inputValue2
)
&&
notNull
)
{
if
(
!
isNaN
(
inputValue1
)
&&
!
isNaN
(
inputValue2
))
{
if
(
inputValue1
==
inputValue2
)
{
jsonValue
.
push
(
parseFloat
(
inputValue1
));
...
...
@@ -226,6 +226,24 @@ GenesysFilter = {
}
else
{
$
(
"
#menu2
"
).
hide
();
}
},
filterLike
:
function
(
element
,
jsonData
)
{
var
key
=
$
(
element
).
attr
(
"
norm-key
"
);
var
inputId
=
"
#
"
+
key
+
"
_input
"
;
var
value
=
$
(
element
).
parent
().
find
(
inputId
).
val
();
var
likeArray
=
{};
likeArray
[
"
like
"
]
=
value
;
var
likeValue
=
"
Like
"
+
value
;
if
(
!
GenesysFilterUtil
.
existInJson
(
likeArray
,
key
,
jsonData
))
{
GenesysFilterUtil
.
appendHtml
(
key
,
likeValue
,
element
);
jsonData
[
key
.
replace
(
"
_
"
,
"
:
"
)]
=
GenesysFilterUtil
.
collectData
(
key
,
likeArray
,
jsonData
);
$
(
inputId
).
val
(
''
);
}
return
jsonData
;
}
};
...
...
@@ -258,7 +276,7 @@ GenesysFilterUtil = {
var
array
=
jsonData
[
key
];
for
(
var
i
=
array
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
array
[
i
]
==
input
)
{
if
(
JSON
.
stringify
(
array
[
i
]
)
==
JSON
.
stringify
(
input
)
)
{
return
true
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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