Label handling in compare mode.

This commit is contained in:
Paulo Reis 2018-08-01 16:03:45 +01:00
parent 5a64313e24
commit d21f6ef624
4 changed files with 37 additions and 7 deletions

View file

@ -66,6 +66,18 @@ aside.change-list(
)
div.description(ng-click="select()")
div
.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")}
@ -133,7 +145,7 @@ script(type="text/ng-template", id="historyEntryTpl")
.history-entry-details(ng-click="$ctrl.onSelect({ selectedEntry: $ctrl.entry })")
.history-entry-label(
ng-if="$ctrl.entry.labels.length > 0"
ng-repeat="label in ::$ctrl.entry.labels"
ng-repeat="label in $ctrl.entry.labels"
)
span.history-entry-label-comment
i.fa.fa-tag
@ -162,6 +174,7 @@ script(type="text/ng-template", id="historyEntryTpl")
ng-if="::project_op.remove"
) #{translate("file_action_deleted")}
span.history-entry-change-doc {{ ::$ctrl.getProjectOpDoc(project_op) }}
.history-entry-metadata
time.history-entry-metadata-time {{ ::$ctrl.entry.meta.end_ts | formatDate:'h:mm a' }}
span

View file

@ -306,11 +306,19 @@ define [
_labelVersion: (comment, version) ->
url = "/project/#{@$scope.project_id}/labels"
@ide.$http.post url, {
comment,
version,
_csrf: window.csrfToken
}
@ide.$http
.post url, {
comment,
version,
_csrf: window.csrfToken
}
.then (response) =>
@_addLabelToLocalUpdate response.data
_addLabelToLocalUpdate: (label) ->
localUpdate = _.find @$scope.history.updates, (update) -> update.toV == label.version
if localUpdate?
localUpdate.labels.push label
_perDocSummaryOfUpdates: (updates) ->
# Track current_pathname -> original_pathname

View file

@ -3,9 +3,17 @@ define [
"ide/history/util/displayNameForUser"
], (App, displayNameForUser) ->
App.controller "HistoryListController", ["$scope", "ide", ($scope, ide) ->
App.controller "HistoryListController", ["$scope", "$modal", "ide", ($scope, $modal, ide) ->
$scope.hoveringOverListSelectors = false
$scope.deleteLabel = (labelDetails) ->
$modal.open(
templateUrl: "historyV2DeleteLabelModalTemplate"
controller: "HistoryV2DeleteLabelModalController"
resolve:
labelDetails: () -> labelDetails
)
$scope.loadMore = () =>
ide.historyManager.fetchNextBatchOfUpdates()

View file

@ -55,6 +55,7 @@
}
.history-entry-label {
display: inline-block;
color: @history-entry-label-color;
font-size: @font-size-small;
margin-bottom: 3px;