Skip to content

Commit

Permalink
Documentation search box works
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed May 28, 2015
1 parent a4b8828 commit 761e307
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 351 deletions.
9 changes: 6 additions & 3 deletions app/js/app.js
Expand Up @@ -19,12 +19,14 @@ angular.module('jboss-forge', ['ui.router','routeStyles'])
.state('addon_detail',{
url: '/addons/mobile/{addonId}',
templateUrl: 'views/addon_phone_template.html',
css: 'css/forge_addons.css'
css: 'css/forge_addons.css',
controller: 'addonCtrl'
})
.state('documentation', {
url: '/documentation',
templateUrl: 'views/documentation.html',
css: 'css/forge_documentation.css'
css: 'css/forge_documentation.css',
controller: 'docCtrl'
})
.state('community', {
url: '/community',
Expand All @@ -47,6 +49,7 @@ angular.module('jboss-forge', ['ui.router','routeStyles'])
.state('documentation_detail',{
url: '/documentation/{docId}',
templateUrl: 'views/documentation_page.html',
css: 'css/forge_doc_pages.css'
css: 'css/forge_doc_pages.css',
controller: 'docCtrl'
})
});
76 changes: 38 additions & 38 deletions app/js/controllers/docCtrl.js
Expand Up @@ -12,44 +12,44 @@ angular.module('jboss-forge').controller('docCtrl', function($scope, $stateParam
} else {
backendAPI.fetchDocs(function(data) {
$scope.docs = data;
var tags = [];
data.forEach(function (item) {
item.tags.split(',').forEach(
function(tag) {
tags.push(tag.trim());
}
);
});
$scope.docsCategories =
tags.filter(function (item, pos, self) {
return self.indexOf(item) == pos;
}
);
$scope.selectedCategories = [];
$scope.addCategory = function(item, selectedCategories) {
var i = $.inArray(item, selectedCategories);
if (i > -1) {
selectedCategories.splice(i, 1);
} else {
selectedCategories.push(item);
}
}
$scope.clearCategories = function() {
$scope.selectedCategories = [];
}
$scope.categoryFilter = function(item) {
if ($scope.selectedCategories.length > 0) {
var allTags = item.tags.split(',');
for (i=0;i<$scope.selectedCategories.length;i++)
{
if (item.tags.contains($scope.selectedCategories[i])) {
return item;
}
}
return;
}
return item;
}
// var tags = [];
// data.forEach(function (item) {
// item.tags.split(',').forEach(
// function(tag) {
// tags.push(tag.trim());
// }
// );
// });
// $scope.docsCategories =
// tags.filter(function (item, pos, self) {
// return self.indexOf(item) == pos;
// }
// );
// $scope.selectedCategories = [];
// $scope.addCategory = function(item, selectedCategories) {
// var i = $.inArray(item, selectedCategories);
// if (i > -1) {
// selectedCategories.splice(i, 1);
// } else {
// selectedCategories.push(item);
// }
// }
// $scope.clearCategories = function() {
// $scope.selectedCategories = [];
// }
// $scope.categoryFilter = function(item) {
// if ($scope.selectedCategories.length > 0) {
// var allTags = item.tags.split(',');
// for (i=0;i<$scope.selectedCategories.length;i++)
// {
// if (item.tags.contains($scope.selectedCategories[i])) {
// return item;
// }
// }
// return;
// }
// return item;
// }

});
}
Expand Down

0 comments on commit 761e307

Please sign in to comment.