Search on shared status,display shared status on documents list (client)

This commit is contained in:
jendib 2013-08-15 19:08:01 +02:00
parent c14797bd5a
commit 0aa9b44481
4 changed files with 13 additions and 7 deletions

View File

@ -1,2 +0,0 @@
- Advanced search: shared documents (client)
- Show shared status in documents list (client)

View File

@ -5,7 +5,7 @@
*/ */
var App = angular.module('docs', var App = angular.module('docs',
// Dependencies // Dependencies
['ui.state', 'ui.bootstrap', 'ui.keypress', 'ui.validate', ['ui.state', 'ui.route', 'ui.bootstrap', 'ui.keypress', 'ui.validate',
'ui.sortable', 'restangular', 'ngSanitize', 'ngMobile', 'colorpicker.module'] 'ui.sortable', 'restangular', 'ngSanitize', 'ngMobile', 'colorpicker.module']
) )

View File

@ -22,7 +22,8 @@ App.controller('Document', function($scope, $state, Restangular) {
query: '', query: '',
createDateMin: null, createDateMin: null,
createDateMax: null, createDateMax: null,
tags: [] tags: [],
shared: false
}; };
}; };
$scope.initSearch(); $scope.initSearch();
@ -40,7 +41,8 @@ App.controller('Document', function($scope, $state, Restangular) {
search: $scope.search.query, search: $scope.search.query,
create_date_min: $scope.isAdvancedSearchCollapsed || !$scope.search.createDateMin ? null : $scope.search.createDateMin.getTime(), 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') 'tags': $scope.isAdvancedSearchCollapsed ? null : _.pluck($scope.search.tags, 'id'),
'shared': $scope.isAdvancedSearchCollapsed ? null : $scope.search.shared
}) })
.then(function(data) { .then(function(data) {
$scope.documents = data.documents; $scope.documents = data.documents;
@ -70,7 +72,7 @@ App.controller('Document', function($scope, $state, Restangular) {
}); });
/** /**
* Watch for search change. * Watch for search scope change.
*/ */
$scope.$watch('search', function(prev, next) { $scope.$watch('search', function(prev, next) {
$scope.loadDocuments(); $scope.loadDocuments();

View File

@ -29,6 +29,12 @@
<select-tag tags="search.tags" class="input-block-level" ref="inputTags" /> <select-tag tags="search.tags" class="input-block-level" ref="inputTags" />
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label" for="inputShared">Shared</label>
<div class="controls">
<input type="checkbox" ng-model="search.shared" />
</div>
</div>
<div class="form-actions"> <div class="form-actions">
<button ng-click="initSearch()" class="btn btn-warning" type="submit">Reset search</button> <button ng-click="initSearch()" class="btn btn-warning" type="submit">Reset search</button>
</div> </div>
@ -46,7 +52,7 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-click="viewDocument(document.id)" ng-repeat="document in documents"> <tr ng-click="viewDocument(document.id)" ng-repeat="document in documents">
<td>{{ document.title }}</td> <td>{{ document.title }} <span class="icon-share" ng-if="document.shared" tooltip="Shared"></span></td>
<td>{{ document.create_date | date: 'yyyy-MM-dd' }}</td> <td>{{ document.create_date | date: 'yyyy-MM-dd' }}</td>
<td class="hidden-phone cell-tags"> <td class="hidden-phone cell-tags">
<div class="tags"> <div class="tags">