add a lookup directive

Signed-off-by: Florian Kraft <f.kraft@finn.de>
pull/3434/head
Florian Kraft 9 years ago committed by Jens Ulferts
parent 3ff36d9247
commit 6025a1b0e5
  1. 1
      frontend/app/services/watchers-service.js
  2. 2
      frontend/app/templates/work_packages/tabs/watchers.html
  3. 6
      frontend/app/templates/work_packages/watchers/lookup.html
  4. 3
      frontend/app/work_packages/directives/index.js
  5. 19
      frontend/app/work_packages/directives/work-package-watchers-lookup-directive.js

@ -55,7 +55,6 @@ module.exports = function($http, $q) {
$q.all([load(workPackage), available(workPackage)]).then(function(allWatchers) {
var watching = allWatchers[0],
available = _.difference(allWatchers[1], allWatchers[0]);
console.log(allWatchers, watching, available);
watchers.resolve({ watching: watching, available: available });
}, function(err) {
watchers.reject(err);

@ -11,6 +11,6 @@
<ul class="work-package--watchers">
<work-package-watcher data-watcher="watcher" data-ng-repeat="watcher in watchers.watching"></work-package-watcher>
</ul>
<work-package-watcher-lookup data-watchers="watchers.available" data-ng-hide="watchers.available.length"></work-package-watcher-lookup>
<work-package-watchers-lookup data-watchers="watchers.available" data-ng-show="watchers.available.length"></work-package-watchers-lookup>
</div>
</div>

@ -0,0 +1,6 @@
<div class="work-package--watchers-lookup">
<form data-ng-submit="addWatcher()">
<input type="text" placeholder="Type to add a watcher" data-ng-model="watcher">
</form>
</div>

@ -102,6 +102,9 @@ angular.module('openproject.workPackages.directives')
'ConfigurationService',
'ConversionService',
require('./work-package-attachments-directive')
])
.directive('workPackageWatchersLookup', [
require('./work-package-watchers-lookup-directive.js')
]);
require('./inplace_editor');

@ -0,0 +1,19 @@
module.exports = function() {
'use strict';
var workPackageWatchersLookupController = function(scope) {
scope.addWatcher = function() {
scope.$emit('watchers.add', scope.watcher);
};
};
return {
replace: true,
restrict: 'E',
templateUrl: '/templates/work_packages/watchers/lookup.html',
link: workPackageWatchersLookupController,
scope: {
watchers: '='
}
};
};
Loading…
Cancel
Save