Frontend: Add story toggle button to clipboard menu
This commit is contained in:
parent
df5aa57e68
commit
dd10265ae8
@ -33,9 +33,20 @@
|
||||
dark
|
||||
small
|
||||
color="cyan accent-4"
|
||||
@click.stop="batchTag()"
|
||||
v-if="selection.length"
|
||||
@click.stop="batchStory()"
|
||||
>
|
||||
<v-icon>label</v-icon>
|
||||
<v-icon>mms</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
fab
|
||||
dark
|
||||
small
|
||||
color="light-blue accent-4"
|
||||
v-if="!selection.length"
|
||||
@click.stop="openDocs()"
|
||||
>
|
||||
<v-icon>info</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
fab
|
||||
@ -72,7 +83,6 @@
|
||||
small
|
||||
color="grey"
|
||||
@click.stop="clearClipboard()"
|
||||
v-if="selection.length"
|
||||
>
|
||||
<v-icon>clear</v-icon>
|
||||
</v-btn>
|
||||
@ -105,7 +115,21 @@
|
||||
|
||||
axios.post("/api/v1/batch/photos/private", {"ids": this.selection}).then(function () {
|
||||
Event.publish("ajax.end");
|
||||
Event.publish("alert.success", "Photos marked as private");
|
||||
Event.publish("alert.success", "Toggled private flag");
|
||||
ctx.clearClipboard();
|
||||
ctx.refresh();
|
||||
}).catch(() => {
|
||||
Event.publish("ajax.end");
|
||||
});
|
||||
},
|
||||
batchStory() {
|
||||
Event.publish("ajax.start");
|
||||
|
||||
const ctx = this;
|
||||
|
||||
axios.post("/api/v1/batch/photos/story", {"ids": this.selection}).then(function () {
|
||||
Event.publish("ajax.end");
|
||||
Event.publish("alert.success", "Toggled story flag");
|
||||
ctx.clearClipboard();
|
||||
ctx.refresh();
|
||||
}).catch(() => {
|
||||
@ -138,6 +162,9 @@
|
||||
this.$alert.warning("Not implemented yet");
|
||||
this.expanded = false;
|
||||
},
|
||||
openDocs() {
|
||||
window.open('https://docs.photoprism.org/en/latest/', '_blank');
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -60,7 +60,8 @@
|
||||
<div>
|
||||
<h3 class="body-2 mb-2" :title="photo.PhotoTitle">
|
||||
{{ photo.PhotoTitle | truncate(80) }}
|
||||
<v-icon v-if="photo.PhotoPrivate" size="18">vpn_key</v-icon>
|
||||
<v-icon v-if="photo.PhotoPrivate" size="16" title="Private">vpn_key</v-icon>
|
||||
<v-icon v-if="photo.PhotoStory" size="16" title="Shared with your friends in the story feed">mms</v-icon>
|
||||
</h3>
|
||||
<div class="caption">
|
||||
<v-icon size="14">date_range</v-icon>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<v-card-title primary-title>
|
||||
<div>
|
||||
<h3 class="title mb-3">No albums matched your search</h3>
|
||||
<div><v-btn @click.prevent.stop="create" small>Create a new album</v-btn> or try again using a different term.</div>
|
||||
<div>Try again using a different term or <v-btn @click.prevent.stop="create" small>create a new album</v-btn></div>
|
||||
</div>
|
||||
</v-card-title>
|
||||
</v-card>
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/photoprism/photoprism/internal/config"
|
||||
"github.com/photoprism/photoprism/internal/models"
|
||||
"github.com/photoprism/photoprism/internal/util"
|
||||
@ -70,10 +71,43 @@ func BatchPhotosPrivate(router *gin.RouterGroup, conf *config.Config) {
|
||||
|
||||
db := conf.Db()
|
||||
|
||||
db.Model(models.Photo{}).Where("id IN (?)", params.Ids).Updates(models.Photo{PhotoPrivate: true})
|
||||
db.Model(models.Photo{}).Where("id IN (?)", params.Ids).UpdateColumn("photo_private", gorm.Expr("IF (`photo_private`, 0, 1)"))
|
||||
|
||||
elapsed := time.Since(start)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"message": fmt.Sprintf("photos marked as private in %s", elapsed)})
|
||||
})
|
||||
}
|
||||
|
||||
// POST /api/v1/batch/photos/story
|
||||
func BatchPhotosStory(router *gin.RouterGroup, conf *config.Config) {
|
||||
router.POST("/batch/photos/story", func(c *gin.Context) {
|
||||
start := time.Now()
|
||||
|
||||
var params BatchParams
|
||||
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": util.UcFirst(err.Error())})
|
||||
return
|
||||
}
|
||||
|
||||
if len(params.Ids) == 0 {
|
||||
log.Error("no photos selected")
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": util.UcFirst("no photos selected")})
|
||||
return
|
||||
}
|
||||
|
||||
log.Infof("marking photos as story: %#v", params.Ids)
|
||||
|
||||
db := conf.Db()
|
||||
|
||||
db.Model(models.Photo{}).Where("id IN (?)", params.Ids).Updates(map[string]interface{}{
|
||||
"photo_story": gorm.Expr("IF (`photo_story`, 0, 1)"),
|
||||
"photo_private": "0",
|
||||
})
|
||||
|
||||
elapsed := time.Since(start)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"message": fmt.Sprintf("photos marked as story in %s", elapsed)})
|
||||
})
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ type PhotoSearchResult struct {
|
||||
PhotoFavorite bool
|
||||
PhotoPrivate bool
|
||||
PhotoSensitive bool
|
||||
PhotoStory bool
|
||||
|
||||
// Camera
|
||||
CameraID uint
|
||||
|
@ -36,6 +36,7 @@ func registerRoutes(router *gin.Engine, conf *config.Config) {
|
||||
|
||||
api.BatchPhotosDelete(v1, conf)
|
||||
api.BatchPhotosPrivate(v1, conf)
|
||||
api.BatchPhotosStory(v1, conf)
|
||||
|
||||
api.GetAlbums(v1, conf)
|
||||
api.LikeAlbum(v1, conf)
|
||||
|
Loading…
x
Reference in New Issue
Block a user