Fix some issues with the label tooltip in compare mode.

This commit is contained in:
Paulo Reis 2018-08-02 15:46:42 +01:00
parent a8ee879746
commit dc235b91d9
3 changed files with 55 additions and 35 deletions

View file

@ -67,3 +67,29 @@ script(type="text/ng-template", id="historyRestoreDiffModalTemplate")
) )
span(ng-show="!state.inflight") #{translate("restore")} span(ng-show="!state.inflight") #{translate("restore")}
span(ng-show="state.inflight") #{translate("restoring")} ... span(ng-show="state.inflight") #{translate("restoring")} ...
script(type="text/ng-template", id="historyLabelTpl")
.history-entry-label(
ng-class="{ 'history-entry-label-own' : $ctrl.isOwnedByCurrentUser }"
)
span.history-entry-label-comment(
tooltip-append-to-body="true"
tooltip-template="'historyLabelTooltipTpl'"
tooltip-placement="left"
)
i.fa.fa-tag
|  {{ $ctrl.labelText }}
button.history-entry-label-delete-btn(
ng-if="$ctrl.isOwnedByCurrentUser"
stop-propagation="click"
ng-click="$ctrl.onLabelDelete()"
) ×
script(type="text/ng-template", id="historyLabelTooltipTpl")
.history-label-tooltip
p.history-label-tooltip-title
i.fa.fa-tag
|  {{ $ctrl.labelText }}
p.history-label-tooltip-owner Created by {{ $ctrl.labelOwnerName }}
time.history-label-tooltip-datetime {{ labelCreationDateTime | formatDate }}

View file

@ -69,17 +69,25 @@ aside.change-list(
div.description(ng-click="select()") div.description(ng-click="select()")
div div
.history-entry-label( history-label(
ng-if="update.labels.length > 0"
ng-repeat="label in update.labels" ng-repeat="label in update.labels"
label-text="label.comment"
label-owner-name="getDisplayNameById(label.user_id)"
label-creation-date-time="label.created_at"
is-owned-by-current-user="label.user_id === $ctrl.currentUser.id"
on-label-delete="deleteLabel(label)"
) )
span.history-entry-label-comment //- .history-entry-label(
i.fa.fa-tag //- ng-if="update.labels.length > 0"
|  {{ label.comment }} //- ng-repeat="label in update.labels"
button.history-entry-label-delete-btn( //- )
stop-propagation="click" //- span.history-entry-label-comment
ng-click="deleteLabel(label)" //- i.fa.fa-tag
) × //- |  {{ label.comment }}
//- button.history-entry-label-delete-btn(
//- stop-propagation="click"
//- ng-click="deleteLabel(label)"
//- ) ×
div.time {{ update.meta.end_ts | formatDate:'h:mm a' }} div.time {{ update.meta.end_ts | formatDate:'h:mm a' }}
div.action.action-edited(ng-if="history.isV2 && update.pathnames.length > 0") div.action.action-edited(ng-if="history.isV2 && update.pathnames.length > 0")
| #{translate("file_action_edited")} | #{translate("file_action_edited")}
@ -198,28 +206,4 @@ script(type="text/ng-template", id="historyEntryTpl")
li.history-entry-metadata-user(ng-if="::$ctrl.entry.meta.users.length == 0") li.history-entry-metadata-user(ng-if="::$ctrl.entry.meta.users.length == 0")
span.name( span.name(
ng-style="$ctrl.getUserCSSStyle();" ng-style="$ctrl.getUserCSSStyle();"
) #{translate("anonymous")} ) #{translate("anonymous")}
script(type="text/ng-template", id="historyLabelTpl")
.history-entry-label(
ng-class="{ 'history-entry-label-own' : $ctrl.isOwnedByCurrentUser }"
)
span.history-entry-label-comment(
tooltip-template="'historyLabelTooltipTpl'"
tooltip-placement="left"
)
i.fa.fa-tag
|  {{ $ctrl.labelText }}
button.history-entry-label-delete-btn(
ng-if="$ctrl.isOwnedByCurrentUser"
stop-propagation="click"
ng-click="$ctrl.onLabelDelete()"
) ×
script(type="text/ng-template", id="historyLabelTooltipTpl")
.history-label-tooltip
p.history-label-tooltip-title
i.fa.fa-tag
|  {{ $ctrl.labelText }}
p.history-label-tooltip-owner Created by {{ $ctrl.labelOwnerName }}
time.history-label-tooltip-datetime {{ labelCreationDateTime | formatDate }}

View file

@ -5,7 +5,17 @@ define [
App.controller "HistoryListController", ["$scope", "$modal", "ide", ($scope, $modal, ide) -> App.controller "HistoryListController", ["$scope", "$modal", "ide", ($scope, $modal, ide) ->
$scope.hoveringOverListSelectors = false $scope.hoveringOverListSelectors = false
projectUsers = $scope.project.members.concat $scope.project.owner
console.log projectUsers
_getUserById = (id) ->
_.find projectUsers, (user) ->
curUserId = user?._id or user?.id
curUserId == id
$scope.getDisplayNameById = (id) ->
displayNameForUser(_getUserById(id))
$scope.deleteLabel = (labelDetails) -> $scope.deleteLabel = (labelDetails) ->
$modal.open( $modal.open(
templateUrl: "historyV2DeleteLabelModalTemplate" templateUrl: "historyV2DeleteLabelModalTemplate"