From 91beb766fa34f90a5346e27c7db925793bc031ed Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 29 Jan 2020 16:49:42 +0100 Subject: [PATCH] Edit photo: Improve add and remove labels Signed-off-by: Michael Mayer --- frontend/src/css/app.css | 6 +++++- frontend/src/dialog/photo-edit/labels.vue | 6 ++---- internal/query/photo.go | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/css/app.css b/frontend/src/css/app.css index bf18cbe3b..a918d98e3 100644 --- a/frontend/src/css/app.css +++ b/frontend/src/css/app.css @@ -172,12 +172,16 @@ div.v-dialog table.v-table tfoot td { } table.v-table tbody td, +table.v-table tbody td input, +table.v-table tbody td label.v-label, table.v-table tfoot td, -table.v-table tfoot td input +table.v-table tfoot td input, +table.v-table tfoot td label.v-label { font-weight: 400; font-size: 13px; } + table.v-table tbody td div.v-input__slot, table.v-table tfoot td div.v-input__slot { padding: 0 !important; diff --git a/frontend/src/dialog/photo-edit/labels.vue b/frontend/src/dialog/photo-edit/labels.vue index 7c6c86890..9109ba9ac 100644 --- a/frontend/src/dialog/photo-edit/labels.vue +++ b/frontend/src/dialog/photo-edit/labels.vue @@ -14,7 +14,6 @@ {{ props.item.Label.LabelName }} {{ props.item.LabelSource }} {{ 100 - props.item.LabelUncertainty }}% - {{ props.item.Label.LabelPriority }} @@ -27,6 +26,7 @@ v-model="newLabel" :rules="[nameRule]" color="secondary-dark" + :label="labels.addLabel" single-line flat solo hide-details autofocus @@ -34,7 +34,6 @@ manual 100% - @@ -63,11 +62,10 @@ {text: this.$gettext('Label'), value: '', sortable: false, align: 'left'}, {text: this.$gettext('Source'), value: 'LabelSource', sortable: false, align: 'left'}, {text: this.$gettext('Confidence'), value: 'LabelUncertainty', sortable: false, align: 'center'}, - {text: this.$gettext('Priority'), value: 'LabelPriority', sortable: false, align: 'center'}, {text: this.$gettext('Action'), value: '', sortable: false, align: 'center'}, ], labels: { - labelName: this.$gettext("Label Name"), + addLabel: "", }, nameRule: v => v.length <= 25 || this.$gettext("Name too long"), }; diff --git a/internal/query/photo.go b/internal/query/photo.go index 7647e4f46..e44b2e2df 100644 --- a/internal/query/photo.go +++ b/internal/query/photo.go @@ -6,6 +6,7 @@ import ( "time" "github.com/gosimple/slug" + "github.com/jinzhu/gorm" "github.com/photoprism/photoprism/internal/entity" "github.com/photoprism/photoprism/internal/form" "github.com/photoprism/photoprism/pkg/capture" @@ -353,7 +354,9 @@ func (s *Repo) FindPhotoByUUID(photoUUID string) (photo entity.Photo, err error) // PreloadPhotoByUUID returns a Photo based on the UUID with all dependencies preloaded. func (s *Repo) PreloadPhotoByUUID(photoUUID string) (photo entity.Photo, err error) { if err := s.db.Where("photo_uuid = ?", photoUUID). - Preload("Labels"). + Preload("Labels", func(db *gorm.DB) *gorm.DB { + return db.Order("photos_labels.label_uncertainty ASC, photos_labels.label_id") + }). Preload("Labels.Label"). Preload("Camera"). Preload("Lens").