Merge pull request #6 from furinvader/ulferts/feature/accessible_wp_attributes

Move directive definition away from legacy file structure
pull/4078/head
ulferts 9 years ago
commit 7e07d02428
  1. 6
      frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html
  2. 4
      frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html
  3. 12
      frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts
  4. 10
      frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.ts
  5. 2
      frontend/app/templates/inplace-edit/display/fields/boolean.html
  6. 2
      frontend/app/templates/inplace-edit/display/fields/date-range.html
  7. 2
      frontend/app/templates/inplace-edit/display/fields/embedded.html
  8. 4
      frontend/app/templates/inplace-edit/display/fields/text.html
  9. 2
      frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html
  10. 3
      frontend/app/work_packages/directives/index.js

@ -1,17 +1,17 @@
<div class="spent-time-wrapper"> <div class="spent-time-wrapper">
<span ng-if="field.isEmpty()" <span ng-if="field.isEmpty()"
work-package-accessible-attribute="field"> wp-accessible-attribute="field">
{{ field.placeholder }} {{ field.placeholder }}
</span> </span>
<span ng-if="!field.isEmpty()"> <span ng-if="!field.isEmpty()">
<span ng-if="customEditorController.isLinkViewable()"> <span ng-if="customEditorController.isLinkViewable()">
<a href="{{ customEditorController.getPath() }}" <a ng-href="{{ customEditorController.getPath() }}"
aria-label="{{ field.getKeyValue() }}"> aria-label="{{ field.getKeyValue() }}">
{{ field.text }} {{ field.text }}
</a> </a>
</span> </span>
<span ng-if="!customEditorController.isLinkViewable()" <span ng-if="!customEditorController.isLinkViewable()"
work-package-accessible-attribute="field"> wp-accessible-attribute="field">
{{ field.text }} {{ field.text }}
</span> </span>
</span> </span>

@ -1,6 +1,6 @@
<div class="version-wrapper"> <div class="version-wrapper">
<span ng-if="!field.text" <span ng-if="!field.text"
work-package-accessible-attribute="field"> wp-accessible-attribute="field">
{{field.placeholder}} {{field.placeholder}}
</span> </span>
<span ng-if="field.text && customEditorController.isVersionLinkViewable()"> <span ng-if="field.text && customEditorController.isVersionLinkViewable()">
@ -10,7 +10,7 @@
</a> </a>
</span> </span>
<span ng-if="field.text && !customEditorController.isVersionLinkViewable()" <span ng-if="field.text && !customEditorController.isVersionLinkViewable()"
work-package-accessible-attribute="field"> wp-accessible-attribute="field">
{{field.text.props.name}} {{field.text.props.name}}
</span> </span>
</div> </div>

@ -26,13 +26,11 @@
// See doc/COPYRIGHT.rdoc for more details. // See doc/COPYRIGHT.rdoc for more details.
//++ //++
/*jshint expr: true*/ describe('wpAccessibleAttributeDirective', function() {
var html = '<div wp-accessible-attribute="field"></div>';
describe('workPackageAccessibleAttributeDirective', function() {
var html = '<div work-package-accessible-attribute="field"></div>';
var scope, element, $compile; var scope, element, $compile;
beforeEach(module('openproject.workPackages.directives')); beforeEach(angular.mock.module('openproject.workPackages.directives'));
beforeEach(inject(function(_$compile_, beforeEach(inject(function(_$compile_,
$rootScope){ $rootScope){
@ -53,7 +51,7 @@ describe('workPackageAccessibleAttributeDirective', function() {
}; };
element = $compile(html)(scope); element = $compile(html)(scope);
scope.$digest(); scope.$apply();
}); });
it('has a tabindex of 0', function() { it('has a tabindex of 0', function() {
@ -77,7 +75,7 @@ describe('workPackageAccessibleAttributeDirective', function() {
}; };
element = $compile(html)(scope); element = $compile(html)(scope);
scope.$digest(); scope.$apply();
}); });
it('has no tabindex', function() { it('has no tabindex', function() {

@ -26,11 +26,11 @@
// See doc/COPYRIGHT.rdoc for more details. // See doc/COPYRIGHT.rdoc for more details.
//++ //++
module.exports = function() { function wpAccessibleAttribute() {
return { return {
restrict: 'A', restrict: 'A',
scope: { scope: {
field: '=workPackageAccessibleAttribute' field: '=wpAccessibleAttribute'
}, },
link: function(scope, element) { link: function(scope, element) {
@ -46,4 +46,8 @@ module.exports = function() {
}); });
} }
}; };
}; }
angular
.module('openproject.workPackages.directives')
.directive('wpAccessibleAttribute', wpAccessibleAttribute);

@ -1,2 +1,2 @@
<span ng-bind="field.text" <span ng-bind="field.text"
work-package-accessible-attribute="field"></span> wp-accessible-attribute="field"></span>

@ -1,4 +1,4 @@
<span work-package-accessible-attribute="field"> <span wp-accessible-attribute="field">
<op-date date-value="field.text.startDate" no-date-text="field.text.noStartDate"></op-date> <op-date date-value="field.text.startDate" no-date-text="field.text.noStartDate"></op-date>
&nbsp;&nbsp;-&nbsp;&nbsp; &nbsp;&nbsp;-&nbsp;&nbsp;
<op-date date-value="field.text.dueDate" no-date-text="field.text.noEndDate"></op-date> <op-date date-value="field.text.dueDate" no-date-text="field.text.noEndDate"></op-date>

@ -1,2 +1,2 @@
<span work-package-accessible-attribute="field" <span wp-accessible-attribute="field"
ng-bind="field.text.props.name || field.text.props.value || field.placeholder"></span> ng-bind="field.text.props.name || field.text.props.value || field.placeholder"></span>

@ -1,6 +1,6 @@
<span ng-if="field.isEmpty()" <span ng-if="field.isEmpty()"
ng-bind="field.placeholder" ng-bind="field.placeholder"
work-package-accessible-attribute="field"></span> wp-accessible-attribute="field"></span>
<span ng-if="!field.isEmpty()" <span ng-if="!field.isEmpty()"
ng-bind="field.text" ng-bind="field.text"
work-package-accessible-attribute="field"></span> wp-accessible-attribute="field"></span>

@ -1,2 +1,2 @@
<span ng-bind-html="field.text.html || field.placeholder" <span ng-bind-html="field.text.html || field.placeholder"
work-package-accessible-attribute="field"></span> wp-accessible-attribute="field"></span>

@ -87,7 +87,4 @@ angular.module('openproject.workPackages.directives')
'I18n', 'I18n',
'FocusHelper', 'FocusHelper',
require('./work-package-watchers-lookup-directive.js') require('./work-package-watchers-lookup-directive.js')
])
.directive('workPackageAccessibleAttribute', [
require('./work-package-accessible-attribute-directive.js')
]); ]);

Loading…
Cancel
Save