Commit 70632cf0 authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

adding costum filters

parent 5d0e7f8c
......@@ -664,6 +664,12 @@ function initPageTable(number){
$(".all-coop-detail-desc"+coopId).toggleClass('hide');
});
$(".btn-coopfilter").off().click(function(){
$(".coopFilter").addClass('hidden');
$("."+$(this).data("filter")+"Filter").removeClass('hidden');
directory.sortSearch('.coopFilter:not(.hidden)');
});
$(".openCoopPanelHtml").off().click(function(){
mylog.log("HERE .openCoopPanelHtml");
var coopType = $(this).data("coop-type");
......@@ -2549,11 +2555,25 @@ var directory = {
var thisId = typeof params["_id"] != "undefined" &&
typeof params["_id"]["$id"] != "undefined" ? params["_id"]["$id"] :
typeof params["id"] != "undefined" ? params["id"] : "";
var filterClass = "";
var sortData = "";
if(typeof params.votes != "undefined"){
if(typeof params.votes.up != "undefined"){
filterClass += " upFilter";
sortData += " data-sort='"+params.votes.up.length+"' ";
}
if(typeof params.votes.down != "undefined"){
filterClass += " downFilter";
sortData += " data-sort='"+params.votes.down.length+"'";
}
}
str = "";
if(size == "S")
str += "<div class='col-lg-4 col-md-4 col-sm-6 col-xs-12 blockCoop"+thisId+" coop-wraper margin-bottom-10 ' style='word-wrap: break-word; overflow:hidden;'>";
str += "<div class='col-lg-4 col-md-4 col-sm-6 col-xs-12 blockCoop"+thisId+" "+filterClass+" coopFilter coop-wraper margin-bottom-10 ' "+sortData+" style='word-wrap: break-word; overflow:hidden;'>";
else
str += "<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12 coop-wraper margin-bottom-10 ' style='word-wrap: break-word; overflow:hidden;'>";
str += "<div class='col-xs-12 coop-wraper margin-bottom-10 coopFilter "+filterClass+" ' "+sortData+" style='word-wrap: break-word; overflow:hidden;'>";
linkParams = " data-coop-type='"+ params.type + "' "+
" data-coop-id='"+ thisId + "' "+
......@@ -3097,15 +3117,19 @@ var directory = {
titleSize=(searchObject.initType=="classifieds") ? "col-md-8 col-sm-6" : "col-md-9 col-sm-8";
toolsSize=(searchObject.initType=="classifieds") ? "col-md-4 col-sm-6" : "col-md-3 col-sm-4";
headerFilters = "";
if(!custom.filters.searchFilters){
headerFilters = "<a href='javascript:;' data-filter='coop' class='btn-coopfilter btn btn-xs '>All</a> "+
"<a href='javascript:;' data-filter='up' class='btn-coopfilter btn btn-xs bg-green'>Pour</a> "+
"<a href='javascript:;' data-filter='down' class='btn-coopfilter btn btn-xs bg-red text-white'>Contre</a> ";
}
headerStr +='<div class="col-xs-12 margin-bottom-10">'+
'<h4 class="elipsis '+titleSize+' col-xs-10 no-padding">'+
"<i class='fa fa-angle-down'></i> " + countHeader + " "+resultsStr+" "+
'<small>'+
directory.searchTypeHtml()+
'</small>'+
'</h4>'+
'<small>'+directory.searchTypeHtml()+'</small>'+
headerFilters+
'</h4>'+
'<div class="'+toolsSize+' col-xs-2 pull-right no-padding text-right headerSearchTools" style="padding-top:3px !important;">';
// TODO CLEM :: ADD SURVEY
// if(searchObject.types.length == 1 && searchObject.types[0]=="vote"){
......@@ -3151,8 +3175,17 @@ var directory = {
}
headerStr+= '</div>';
}
return headerStr;
},
sortSearch : function(what) {
var $wrapper = $('#dropdown_search');
$wrapper.find(what).sort(function (a, b) {
return +a.dataset.sort - +b.dataset.sort;
})
.appendTo( $wrapper );
},
checkImage : function($this){
// $.each(res, function(i,v){
// if($("#entity"+i+" .container-img-profil .img-responsive").length){
......@@ -3352,6 +3385,8 @@ var directory = {
directory.colPos = "left";
if(typeof data == "object" && data!=null){
$.each(data, function(i, params) {
if(i!="count"){
......@@ -3608,6 +3643,7 @@ var directory = {
params.type == "actions" ||
params.type == "resolutions" ||
params.type == "rooms"){
if(location.hash.indexOf('#dda') == 0)
str += directory.coopPanelHtml(params,null,"S");
else
......
Supports Markdown
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