Add autocompletion to activity comment

pull/2216/head
Hagen Schink 10 years ago
parent fba1ac953d
commit b413ff4136
  1. 15
      app/assets/javascripts/angular/ui_components/activity-comment-directive.js
  2. 9
      app/assets/javascripts/angular/ui_components/index.js
  3. 3
      public/templates/components/activity_comment.html
  4. 3
      public/templates/work_packages/tabs/overview.html

@ -27,14 +27,19 @@
//++
// TODO move to UI components
module.exports = function(I18n, ActivityService, ConfigurationService) {
module.exports = function($timeout,
I18n,
ActivityService,
ConfigurationService,
AutoCompleteHelper) {
return {
restrict: 'E',
replace: true,
require: '^?exclusiveEdit',
scope: {
workPackage: '=',
activities: '='
activities: '=',
autocompletePath: '@'
},
templateUrl: '/templates/components/activity_comment.html',
link: function(scope, element, attrs, exclusiveEditController) {
@ -57,6 +62,12 @@ module.exports = function(I18n, ActivityService, ConfigurationService) {
return response;
});
};
$timeout(function() {
AutoCompleteHelper.enableTextareaAutoCompletion(
angular.element.find('textarea.add-comment-text')
);
});
}
};
};

@ -31,8 +31,13 @@ angular.module('openproject.uiComponents')
'./accessible-by-keyboard-directive')])
.directive('accessibleCheckbox', [require('./accessible-checkbox-directive')])
.directive('accessibleElement', [require('./accessible-element-directive')])
.directive('activityComment', ['I18n', 'ActivityService',
'ConfigurationService', require('./activity-comment-directive')
.directive('activityComment', [
'$timeout',
'I18n',
'ActivityService',
'ConfigurationService',
'AutoCompleteHelper',
require('./activity-comment-directive')
])
.directive('authoring', ['I18n', 'PathHelper', 'TimezoneService', require(
'./authoring-directive')])

@ -9,7 +9,8 @@
ng-model="activity.comment"
required
placeholder="{{ title }}"
ng-disabled="processingComment">
ng-disabled="processingComment"
data-wp_autocomplete_url="{{ autocompletePath }}">
</textarea>
<button class="button"
ng-click="createComment()"

@ -77,7 +77,8 @@
</li>
</ul>
<activity-comment work-package="workPackage"
activities="activities">
activities="activities"
autocomplete-path="{{ autocompletePath }}">
</activity-comment>
</exclusive-edit>
</div>

Loading…
Cancel
Save