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("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
.history-entry-label(
ng-if="update.labels.length > 0"
history-label(
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
i.fa.fa-tag
|  {{ label.comment }}
button.history-entry-label-delete-btn(
stop-propagation="click"
ng-click="deleteLabel(label)"
) ×
//- .history-entry-label(
//- ng-if="update.labels.length > 0"
//- ng-repeat="label in update.labels"
//- )
//- span.history-entry-label-comment
//- 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.action.action-edited(ng-if="history.isV2 && update.pathnames.length > 0")
| #{translate("file_action_edited")}
@ -199,27 +207,3 @@ script(type="text/ng-template", id="historyEntryTpl")
span.name(
ng-style="$ctrl.getUserCSSStyle();"
) #{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

@ -6,6 +6,16 @@ define [
App.controller "HistoryListController", ["$scope", "$modal", "ide", ($scope, $modal, ide) ->
$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) ->
$modal.open(
templateUrl: "historyV2DeleteLabelModalTemplate"