From c7b752718344b006d4b4daeb4d113fb526a9b61f Mon Sep 17 00:00:00 2001
From: jendib
Date: Tue, 15 Sep 2015 23:03:42 +0200
Subject: [PATCH] Closes #23: Tag tree search
---
.../src/app/docs/controller/Document.js | 17 ++++
.../webapp/src/partial/docs/document.html | 97 +++++++++++--------
docs-web/src/main/webapp/src/style/main.less | 13 +++
3 files changed, 89 insertions(+), 38 deletions(-)
diff --git a/docs-web/src/main/webapp/src/app/docs/controller/Document.js b/docs-web/src/main/webapp/src/app/docs/controller/Document.js
index 6af0d944..551c1dcc 100644
--- a/docs-web/src/main/webapp/src/app/docs/controller/Document.js
+++ b/docs-web/src/main/webapp/src/app/docs/controller/Document.js
@@ -13,6 +13,7 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
$scope.currentPage = 1;
$scope.limit = _.isUndefined(localStorage.documentsPageSize) ? 10 : localStorage.documentsPageSize;
$scope.search = '';
+ $scope.setSearch = function(search) { $scope.search = search };
// A timeout promise is used to slow down search requests to the server
// We keep track of it for cancellation purpose
@@ -101,4 +102,20 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
$scope.viewDocument = function(id) {
$state.transitionTo('document.view', { id: id });
};
+
+ // Load tags
+ var tags = [];
+ Restangular.one('tag/list').getList().then(function(data) {
+ tags = data.tags;
+ });
+
+ /**
+ * Find children tags.
+ * @param parent
+ */
+ $scope.getChildrenTags = function(parent) {
+ return _.filter(tags, function(tag) {
+ return tag.parent == parent;
+ });
+ };
});
\ No newline at end of file
diff --git a/docs-web/src/main/webapp/src/partial/docs/document.html b/docs-web/src/main/webapp/src/partial/docs/document.html
index e4b91b11..ab403e40 100644
--- a/docs-web/src/main/webapp/src/partial/docs/document.html
+++ b/docs-web/src/main/webapp/src/partial/docs/document.html
@@ -5,49 +5,60 @@
Add a document
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/docs-web/src/main/webapp/src/style/main.less b/docs-web/src/main/webapp/src/style/main.less
index 1ba0630a..ec55a44b 100644
--- a/docs-web/src/main/webapp/src/style/main.less
+++ b/docs-web/src/main/webapp/src/style/main.less
@@ -183,4 +183,17 @@ input[readonly].share-link {
.tab-pane {
margin-top: 20px;
+}
+
+// Tag tree
+.tag-tree-dropdown {
+ padding-left: 0;
+
+ .tag-tree {
+ li {
+ margin-left: 20px;
+ margin-top: 8px;
+ margin-bottom: 8px;
+ }
+ }
}
\ No newline at end of file