Basic label support (showing labels in the entries list; creating labels via a modal).

This commit is contained in:
Paulo Reis
2018-08-02 16:28:13 +01:00
parent 22b664da1a
commit 3a80c34078
9 changed files with 149 additions and 14 deletions
@@ -129,6 +129,12 @@ script(type="text/ng-template", id="historyEntryTpl")
time.history-entry-day(ng-if="::$ctrl.entry.meta.first_in_day") {{ ::$ctrl.entry.meta.end_ts | relativeDate }}
.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"
)
i.fa.fa-tag
|  {{ label.comment }}
ol.history-entry-changes
li.history-entry-change(
ng-repeat="pathname in ::$ctrl.entry.pathnames"
@@ -1,4 +1,5 @@
.history-toolbar(
ng-controller="HistoryV2ToolbarController"
ng-if="ui.view == 'history' && history.isV2 && history.viewMode === HistoryViewModes.POINT_IN_TIME"
)
span(ng-show="history.loadingFileTree")
@@ -6,8 +7,46 @@
|    #{translate("loading")}...
span(ng-show="!history.loadingFileTree") #{translate("browsing_project_as_of")} 
time.history-toolbar-time {{ history.selection.updates[0].meta.end_ts | formatDate:'Do MMM YYYY, h:mm a' }}
.history-toolbar-btn(
ng-click="toggleHistoryViewMode();"
button.history-toolbar-btn(
ng-click="showAddLabelDialog();"
ng-disabled="history.loadingFileTree"
)
i.fa
| #{translate("compare_to_another_version")}
i.fa.fa-tag
|  Label this version
button.history-toolbar-btn(
ng-click="toggleHistoryViewMode();"
ng-disabled="history.loadingFileTree"
)
i.fa.fa-exchange
|  #{translate("compare_to_another_version")}
script(type="text/ng-template", id="historyV2AddLabelModalTemplate")
form(
name="addLabelModalForm"
ng-submit="addLabelModalFormSubmit();"
novalidate
)
.modal-header
h3 Label this version
.modal-body
.alert.alert-danger(ng-show="state.error.message") {{ state.error.message}}
.alert.alert-danger(ng-show="state.error && !state.error.message") #{translate("generic_something_went_wrong")}
.form-group
input.form-control(
type="text"
placeholder="New label name"
ng-model="inputs.labelName"
focus-on="open"
required
)
.modal-footer
button.btn.btn-default(
type="button"
ng-disabled="state.inflight"
ng-click="$dismiss()"
) #{translate("cancel")}
input.btn.btn-primary(
ng-disabled="addLabelModalForm.$invalid || state.inflight"
ng-value="state.inflight ? 'Adding label' : 'Add label'"
type="submit"
)