Merge pull request #3771 from furinvader/features/refactoring/move-wp-comment

Move WP comment directive to new components location
pull/3773/head
Alex Dik 9 years ago
commit 1272eb67a5
  1. 54
      frontend/app/components/work-packages/directives/work-package-comment/work-package-comment.directive.html
  2. 37
      frontend/app/components/work-packages/directives/work-package-comment/work-package-comment.directive.js
  3. 10
      frontend/app/components/work-packages/directives/work-package-comment/work-package-comment.directive.test.js
  4. 9
      frontend/app/templates/work_packages/comment.html
  5. 46
      frontend/app/templates/work_packages/comment_field.html
  6. 14
      frontend/app/work_packages/directives/index.js

@ -0,0 +1,54 @@
<div id="work-package-activites-container">
<div id="work-package-comment-container">
<ng-transclude ng-if="!fieldController.showAbove"></ng-transclude>
<div class="work-package-field work-packages--activity--add-comment" ng-show="fieldController.canAddComment">
<inplace-editor-main-pane>
<div class="inplace-edit--read" ng-if="!fieldController.isEditing">
<accessible-by-keyboard
class="inplace-editing--trigger-container"
span-class="inplace-editing--container"
link-class="inplace-editing--trigger-link"
execute="fieldController.startEditing()">
<span class="inplace-edit--read-value"
ng-class="{'-default': fieldController.isEmpty()}">
<span ng-bind="fieldController.placeholder"></span>
</span>
<span class="inplace-edit--icon-wrapper">
<icon-wrapper icon-name="edit" icon-title="{{ fieldController.editTitle }}">
</icon-wrapper>
</span>
</accessible-by-keyboard>
</div>
<div class="inplace-edit--write edit-strategy-comment" ng-show="fieldController.isEditing">
<form class="inplace-edit--form"
ng-if="fieldController.isEditing"
name="fieldController.editForm"
ng-submit="fieldController.submit()"
novalidate>
<div class="inplace-edit--write-value"
tabindex="-1">
<inplace-editor-wiki-textarea> </inplace-editor-wiki-textarea>
</div>
<div class="inplace-edit--dashboard">
<div class="inplace-edit--controls" ng-hide="fieldController.state.isBusy || !fieldController.isActive()">
<accessible-by-keyboard execute="fieldController.submit()"
ng-disabled="fieldController.isEmpty()"
class="inplace-edit--control inplace-edit--control--save">
<icon-wrapper icon-name="yes" icon-title="{{ fieldController.saveTitle }}">
</icon-wrapper>
</accessible-by-keyboard>
<accessible-by-keyboard execute="fieldController.discardEditing()" class="inplace-edit--control inplace-edit--control--cancel">
<icon-wrapper icon-name="close" icon-title="{{ fieldController.cancelTitle }}">
</icon-wrapper>
</accessible-by-keyboard>
</div>
</div>
</form>
</div>
</inplace-editor-main-pane>
</div>
<ng-transclude ng-if="fieldController.showAbove"></ng-transclude>
</div>
</div>

@ -1,4 +1,4 @@
//-- copyright
// -- copyright
// OpenProject is a project management system.
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
//
@ -24,19 +24,14 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// See doc/COPYRIGHT.rdoc for more details.
//++
module.exports = function(
$timeout,
$location,
$q,
WorkPackageFieldService,
EditableFieldsState,
FocusHelper,
I18n,
ActivityService,
ConfigurationService,
AutoCompleteHelper,
// ++
angular
.module('openproject.workPackages.directives')
.directive('workPackageComment', workPackageComment);
function workPackageComment($timeout, $location, $q, EditableFieldsState,
FocusHelper, I18n, ActivityService, ConfigurationService, AutoCompleteHelper,
NotificationsService) {
function commentFieldDirectiveController($scope, $element) {
@ -184,16 +179,18 @@ module.exports = function(
restrict: 'E',
replace: true,
transclude: true,
controllerAs: 'fieldController',
bindToController: true,
templateUrl: '/templates/work_packages/comment.html',
templateUrl: '/components/work-packages/directives/work-package-comment/' +
'work-package-comment.directive.html',
scope: {
workPackage: '=',
activities: '=',
activities: '='
},
controllerAs: 'fieldController',
bindToController: true,
controller: commentFieldDirectiveController,
link: function(scope, element) {
link: function(scope, element) {
$timeout(function() {
AutoCompleteHelper.enableTextareaAutoCompletion(
element.find('textarea')
@ -201,4 +198,4 @@ module.exports = function(
});
}
};
};
}

@ -1,4 +1,4 @@
//-- copyright
// -- copyright
// OpenProject is a project management system.
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
//
@ -24,7 +24,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// See doc/COPYRIGHT.rdoc for more details.
//++
// ++
/*jshint expr: true*/
@ -34,7 +34,7 @@ describe('workPackageCommentDirectiveTest', function() {
var html = "<work-package-comment work-package='workPackage' activities='activities'></work-package-comment>";
stateParams = {};
beforeEach(module('ui.router',
beforeEach(angular.mock.module('ui.router',
'openproject.api',
'openproject.models',
'openproject.layout',
@ -45,7 +45,7 @@ describe('workPackageCommentDirectiveTest', function() {
'openproject.workPackages.directives',
'openproject.workPackages.models'));
beforeEach(module('openproject.templates', function($provide) {
beforeEach(angular.mock.module('openproject.templates', function($provide) {
var configurationService = {
commentsSortedInDescendingOrder: function() { return []; }
};
@ -54,7 +54,7 @@ describe('workPackageCommentDirectiveTest', function() {
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(module('openproject.services', function($provide) {
beforeEach(angular.mock.module('openproject.services', function($provide) {
$provide.constant('WorkPackageFieldService', workPackageFieldService);
$provide.constant('WorkPackageService', {});
}));

@ -1,9 +0,0 @@
<div id="work-package-activites-container">
<div id="work-package-comment-container"
ng-include="'/templates/work_packages/comment_field.html'"
ng-if="fieldController.showAbove"></div>
<ng-transclude></ng-transclude>
<div id="work-package-comment-container"
ng-include="'/templates/work_packages/comment_field.html'"
ng-if="!fieldController.showAbove"></div>
</div>

@ -1,46 +0,0 @@
<div class="work-package-field work-packages--activity--add-comment" ng-show="fieldController.canAddComment">
<inplace-editor-main-pane>
<div class="inplace-edit--read" ng-if="!fieldController.isEditing">
<accessible-by-keyboard
class="inplace-editing--trigger-container"
span-class="inplace-editing--container"
link-class="inplace-editing--trigger-link"
execute="fieldController.startEditing()">
<span class="inplace-edit--read-value"
ng-class="{'-default': fieldController.isEmpty()}">
<span ng-bind="fieldController.placeholder"></span>
</span>
<span class="inplace-edit--icon-wrapper">
<icon-wrapper icon-name="edit" icon-title="{{ fieldController.editTitle }}">
</icon-wrapper>
</span>
</accessible-by-keyboard>
</div>
<div class="inplace-edit--write edit-strategy-comment" ng-show="fieldController.isEditing">
<form class="inplace-edit--form"
ng-if="fieldController.isEditing"
name="fieldController.editForm"
ng-submit="fieldController.submit()"
novalidate>
<div class="inplace-edit--write-value"
tabindex="-1">
<inplace-editor-wiki-textarea> </inplace-editor-wiki-textarea>
</div>
<div class="inplace-edit--dashboard">
<div class="inplace-edit--controls" ng-hide="fieldController.state.isBusy || !fieldController.isActive()">
<accessible-by-keyboard execute="fieldController.submit()"
ng-disabled="fieldController.isEmpty()"
class="inplace-edit--control inplace-edit--control--save">
<icon-wrapper icon-name="yes" icon-title="{{ fieldController.saveTitle }}">
</icon-wrapper>
</accessible-by-keyboard>
<accessible-by-keyboard execute="fieldController.discardEditing()" class="inplace-edit--control inplace-edit--control--cancel">
<icon-wrapper icon-name="close" icon-title="{{ fieldController.cancelTitle }}">
</icon-wrapper>
</accessible-by-keyboard>
</div>
</div>
</form>
</div>
</inplace-editor-main-pane>
</div>

@ -58,20 +58,6 @@ angular.module('openproject.workPackages.directives')
'UserService',
require('./work-package-column-directive')
])
.directive('workPackageComment', [
'$timeout',
'$location',
'$q',
'WorkPackageFieldService',
'EditableFieldsState',
'FocusHelper',
'I18n',
'ActivityService',
'ConfigurationService',
'AutoCompleteHelper',
'NotificationsService',
require('./work-package-comment-directive')
])
.constant('PERMITTED_MORE_MENU_ACTIONS', ['log_time', 'duplicate', 'move',
'delete'
])

Loading…
Cancel
Save