1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-13 01:36:18 +00:00

Search on tags (client/server)

This commit is contained in:
jendib
2013-07-31 22:36:13 +02:00
parent fc5a1f2e71
commit 03e164ea38
5 changed files with 18 additions and 13 deletions

View File

@@ -22,6 +22,7 @@ App.controller('Document', function($scope, $state, Restangular) {
query: '',
createDateMin: null,
createDateMax: null,
tags: []
};
};
$scope.initSearch();
@@ -38,7 +39,8 @@ App.controller('Document', function($scope, $state, Restangular) {
asc: $scope.asc,
search: $scope.search.query,
create_date_min: $scope.isAdvancedSearchCollapsed || !$scope.search.createDateMin ? null : $scope.search.createDateMin.getTime(),
create_date_max: $scope.isAdvancedSearchCollapsed || !$scope.search.createDateMax ? null : $scope.search.createDateMax.getTime()
create_date_max: $scope.isAdvancedSearchCollapsed || !$scope.search.createDateMax ? null : $scope.search.createDateMax.getTime(),
'tags[]': $scope.isAdvancedSearchCollapsed ? null : _.pluck($scope.search.tags, 'id')
})
.then(function(data) {
$scope.documents = data.documents;

View File

@@ -2,8 +2,5 @@
<ul class="inline">
<li ng-repeat="tag in tags"><span class="label label-info">{{ tag.name }} <span class="icon-remove icon-white" ng-click="deleteTag(tag)"></span></span></li>
</ul>
<p class="input-append">
<input type="text" id="{{ ref }}" placeholder="Type a tag" ng-model="input" typeahead="tag.name for tag in allTags | filter: $viewValue" typeahead-on-select="addTag()" />
<button type="submit" class="btn" ng-click="addTag()">Add</button>
</p>
<input type="text" id="{{ ref }}" placeholder="Type a tag" ng-model="input" typeahead="tag.name for tag in allTags | filter: $viewValue" typeahead-on-select="addTag()" />
</div>

View File

@@ -20,6 +20,12 @@
<input class="span4" ng-readonly="true" ng-change="loadDocuments()" type="text" id="inputCreateDateMax" datepicker-popup="yyyy-MM-dd" ng-model="search.createDateMax" starting-day="1" show-weeks="false" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputTags">Tags</label>
<div class="controls">
<select-tag tags="search.tags" class="input-block-level" ref="inputTags" />
</div>
</div>
<div class="form-actions">
<button ng-click="initSearch()" class="btn btn-warning" type="submit">Reset search</button>
</div>