extract activity-link to directive and reuse it for all activities

pull/3563/merge
Jens Ulferts 9 years ago committed by Oliver Günther
parent 233ce258f9
commit 760edcd414
  1. 5
      frontend/app/templates/work_packages/activities/_link.html
  2. 9
      frontend/app/templates/work_packages/activities/_revision.html
  3. 10
      frontend/app/templates/work_packages/activities/_user.html
  4. 16
      frontend/app/work_packages/activities/activity-link-directive.js
  5. 3
      frontend/app/work_packages/activities/index.js
  6. 1
      frontend/app/work_packages/activities/user-activity-directive.js

@ -0,0 +1,5 @@
<a id ="{{ activityHtmlId }}"
ng-bind="'#' + activityNo"
ng-focus="onFocus()"
ng-blur="onBlur()"
ui-sref="work-packages.show.activity({ workPackageId: workPackageId, '#': activityHtmlId})"></a>

@ -1,10 +1,9 @@
<div class="work-package-details-activities-activity-contents">
<div class="comments-number">
<span ui-sref="work-packages.list.details.activity.details({ activity_no: activityNo })">
<a name="{{ activityNo }}"
ng-bind="'#' + activityNo"
ng-href="#{{ activityNo }}"></a>
</span>
<activity-link work-package="workPackage"
activity-no="activityNo"
on-focus="focus()",
on-blur="blur()"></activity-link>
</div>
<div ng-if="userAvatar">
<img class="avatar" ng-src="{{ userAvatar }}" alt="Avatar" title="{{userName}}" />

@ -2,12 +2,10 @@
ng-mouseover="focus()"
ng-mouseout="blur()">
<div class="comments-number">
<a name="{{ activityNo }}"
ng-bind="'#' + activityNo"
ng-focus="focus()"
ng-blur="blur()"
id="activity-{{ activityNo }}"
ui-sref="work-packages.show.activity({ workPackageId: workPackageId, '#': 'activity-' + activityNo })"></a>
<activity-link work-package="workPackage"
activity-no="activityNo"
on-focus="focus()",
on-blur="blur()"></activity-link>
<div class="comments-icons"
ng-focus="focus()"
ng-blur="blur()"

@ -0,0 +1,16 @@
module.exports = function() {
return {
restrict: 'E',
templateUrl: '/templates/work_packages/activities/_link.html',
scope: {
workPackage: '=',
activityNo: '=',
onBlur: '&',
onFocus: '&'
},
link: function(scope) {
scope.workPackageId = scope.workPackage.props.id;
scope.activityHtmlId = 'activity-' + scope.activityNo;
}
};
};

@ -54,4 +54,7 @@ angular.module('openproject.workPackages.activities')
'UsersHelper',
require('./revision-activity-directive')
])
.directive('activityLink', [
require('./activity-link-directive')
])
;

@ -73,7 +73,6 @@ module.exports = function($uiViewScroll,
scope.userCanEdit = !!scope.activity.links.update;
scope.userCanQuote = !!scope.workPackage.links.addComment;
scope.accessibilityModeEnabled = ConfigurationService.accessibilityModeEnabled();
scope.workPackageId = scope.workPackage.props.id;
scope.activity.links.user.fetch().then(function(user) {
scope.userId = user.props.id;

Loading…
Cancel
Save