onlyOwn search enabled

parent c0558c4d
......@@ -315,9 +315,6 @@ dashboardControllers.controller('AddPictoCtrl', function (
//
$scope.search = function() {
if ($scope.onlyOwn)
return;
$scope.page=1; // Reset pagination
var length = $scope.srch_term_picto == undefined ? 0 : $scope.srch_term_picto.length;
if(length <2){ //Check the word length
......@@ -327,11 +324,16 @@ dashboardControllers.controller('AddPictoCtrl', function (
var source = 1;
$scope.closeAlert();
$scope.loadingCatPictos = true;
//category to look in
var category = $scope.breadcrumbs[$scope.breadcrumbs.length-1].id;
if(category == 999){
category = $scope.breadcrumbs[$scope.breadcrumbs.length-2].id
var category;
if (!$scope.onlyOwn){
category = $scope.breadcrumbs[$scope.breadcrumbs.length-1].id;
if(category == 999){
category = $scope.breadcrumbs[$scope.breadcrumbs.length-2].id
}
}
if($scope.source == "ownpictos"){
source = 2;
category = 0;
......@@ -339,13 +341,16 @@ dashboardControllers.controller('AddPictoCtrl', function (
request = config.backend + '/sup/' + supervisor.id +
'/pic_fromSearch/'+$scope.srch_term_picto+'/category/'+category+
'/source/'+source;
// Add Search to breadcrumbs
if($scope.breadcrumbs[$scope.breadcrumbs.length-1].id != 999){
$scope.breadcrumbs.push({
id: 999,
exp: "filter",
glyphicon: 'glyphicon glyphicon-chevron-right'
});
if (!$scope.onlyOwn){
if($scope.breadcrumbs[$scope.breadcrumbs.length-1].id != 999){
$scope.breadcrumbs.push({
id: 999,
exp: "filter",
glyphicon: 'glyphicon glyphicon-chevron-right'
});
}
}
$scope.symbolstxCats = [];
......
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 sign in to comment