Commit 697f1232 authored by igoshin's avatar igoshin Committed by Matija Obreza
Browse files

#12579

parent 14d25162
......@@ -278,7 +278,7 @@ public class ExplorerController extends BaseController {
@RequestParam(value = "pick", required = false) String jsonPick) {
String[] selectedFilters =new String[0];
jsonFilter=jsonFilter.replaceAll("_",":");
Crop crop=null;
if (StringUtils.isNotBlank(jsonPick)) {
// Cleanup JSON pick
......
......@@ -335,7 +335,7 @@ filter.inSvalbard=Safety duplicated in Svalbard
filter.mlsStat=MLS status of the accession
filter.available=Available for distribution
filter.download-dwca=Download DwCA
filter.add=Add filter
filter.add=View & modify filters
filter.additional=Additional filters
filter.apply=Apply
filter.close=Close
......
......@@ -71,7 +71,7 @@
<c:forEach items="${allFilters}" var="filter">
<c:set var="normalizedKey" value="${filter.key.replace(':', '_')}"/>
<c:set var="normalizedKey" value="${fn:replace(filter.key,':', '_')}"/>
<c:set var="filterKey" value="${filter.key}"/>
<div class="clearfix filter-block" style="display:${pick[filterKey] eq filterKey ? '' : 'none'}"
......@@ -167,6 +167,9 @@
</select>
</span>
</div>
<div style="margin-top: 3px">
<button class="btn btn-primary apply"><spring:message code="filter.apply"/></button>
</div>
</c:when>
<c:otherwise>
<div class="form-group input-group">
......@@ -186,8 +189,7 @@
<a href="#" style="float: right" class="edit-fil glyphicon glyphicon-pencil"></a>
</div>
<div class="col-lg-4 filter-values" id="${normalizedKey}_value">
<%--<a href="#" style="float: right" class="close-fil glyphicon glyphicon-remove"></a>--%>
<%--<a href="#" style="float: right" class="edit-fil glyphicon glyphicon-pencil"></a>--%>
<c:forEach items="${filters[filter.key]}" var="value">
<c:set var="string" value="${value}"/>
......@@ -285,10 +287,17 @@
<content tag="javascript">
<script type="text/javascript">
var jsonData = ${jsonFilter};
var jsonData = ${fn:replace(jsonFilter,'_',':')};
var filterPick = [];
var page=${pagedData.number};
if(page==0){
$(".dropdown-toggle").hide();
$(".filter-block").show();
}
function setCharAt(str,index,chr) {
if(index > str.length-1) return str;
return str.substr(0,index) + chr + str.substr(index+1);
......@@ -308,6 +317,7 @@
}
function existInJson(input, key) {
key=key.replace("_",":");
var exist = input != '';
var array = jsonData[key];
......@@ -351,6 +361,7 @@
}
function collectData(key,value) {
key=key.replace("_",":");
var jsonValue = [];
var exist = jsonData[key] != null;
......@@ -363,7 +374,7 @@
}
function removeValue(value, key) {
key= key.replace("_",":")
var array = jsonData[key];
for (var val in array) {
......@@ -392,7 +403,7 @@
if (existInJson(value, key)) {
appendHtml(key, value);
jsonData[key] = collectData(key,value);
jsonData[key.replace("_",":")] = collectData(key,value);
$(inputId).val('');
}
}
......@@ -412,9 +423,9 @@
var jsonValue = [];
var exist = jsonData[key] != null;
var exist = jsonData[key.replace("_",":")] != null;
if (exist) {
jsonValue = jsonData[key];
jsonValue = jsonData[key.replace("_",":")];
}
var notNull=inputValue1!=''&&inputValue2!='';
......@@ -445,7 +456,8 @@
}
appendHtml(key, value);
jsonData[key] = jsonValue;
jsonData[key.replace("_",":")] = jsonValue;
$(inputId1).val('');
$(inputId2).val('');
}
......@@ -459,8 +471,8 @@
var checked = $(inputId).is(":checked");
if (checked && existInJson(value, key)) {
jsonData[key.replace("_",":")] = collectData(key,value);
appendHtml(key, value);
jsonData[key] = collectData(key,value);
} else {
var xkey = key + value;
......@@ -479,7 +491,6 @@
if(value!=''){
appendHtml(key, value);
jsonData[key] = collectData(key, value);
submitJson();
}
}
......@@ -491,7 +502,7 @@
if (checked && existInJson(value, key)) {
appendHtml(key, value);
jsonData[key] = collectData(key,value);
jsonData[key.replace("_",":")] = collectData(key,value);
} else {
var xkey = key + value;
......@@ -501,14 +512,15 @@
});
$(".apply").click(function () {
submitJson()
submitJson();
});
$(".close-fil").on("click", function () {
var parent = $(this).parent().parent();
var key = parent.attr("key");
console.log(key);
delete jsonData[key];
delete jsonData[key.replace("_",":")];
submitJson();
parent.hide();
});
......@@ -534,6 +546,11 @@
}
removeValue(value, key);
if($(this).parent().parent().find(".filter-new").is(":hidden")){
submitJson();
}
$(this).remove();
$('input[i-key=' + key + value + ']').prop('checked', false);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment