Make "start read" icon full when the book is being read in list view
This commit is contained in:
@@ -14,6 +14,7 @@ const props = defineProps({
|
|||||||
description: String,
|
description: String,
|
||||||
rating: Number,
|
rating: Number,
|
||||||
read: Boolean,
|
read: Boolean,
|
||||||
|
startread: Boolean,
|
||||||
wantread: Boolean,
|
wantread: Boolean,
|
||||||
coverPath: String,
|
coverPath: String,
|
||||||
})
|
})
|
||||||
@@ -76,7 +77,8 @@ async function importInventaireEdition(inventaireid) {
|
|||||||
</button>
|
</button>
|
||||||
<button @click="" class="button is-large verticalbutton">
|
<button @click="" class="button is-large verticalbutton">
|
||||||
<span class="icon" :title="$t('booklistelement.startread')">
|
<span class="icon" :title="$t('booklistelement.startread')">
|
||||||
<b-icon-book />
|
<b-icon-book-fill v-if="props.startread" />
|
||||||
|
<b-icon-book v-else />
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<button @click="onUserBookRead" class="button is-large verticalbutton">
|
<button @click="onUserBookRead" class="button is-large verticalbutton">
|
||||||
|
|||||||
@@ -53,6 +53,23 @@ func TestSearchBook_OneBookRead(t *testing.T) {
|
|||||||
result.Books)
|
result.Books)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSearchBook_OneBookStartRead(t *testing.T) {
|
||||||
|
result := testSearchBook(t, "Recherches", "", "")
|
||||||
|
assert.Equal(t, int64(1), result.Count)
|
||||||
|
assert.Equal(t,
|
||||||
|
[]dto.BookSearchGetBook{{
|
||||||
|
Title: "Recherches philosophiques",
|
||||||
|
Author: "Ludwig Wittgenstein",
|
||||||
|
ID: 30,
|
||||||
|
Rating: 0,
|
||||||
|
Read: false,
|
||||||
|
StartRead: true,
|
||||||
|
WantRead: false,
|
||||||
|
CoverPath: "/static/bookcover/Recherches-philosophiques.jpg",
|
||||||
|
}},
|
||||||
|
result.Books)
|
||||||
|
}
|
||||||
|
|
||||||
func TestSearchBook_ISBN(t *testing.T) {
|
func TestSearchBook_ISBN(t *testing.T) {
|
||||||
result := testSearchBook(t, "9782070337903", "", "")
|
result := testSearchBook(t, "9782070337903", "", "")
|
||||||
assert.Equal(t, int64(1), result.Count)
|
assert.Equal(t, int64(1), result.Count)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ type BookSearchGetBook struct {
|
|||||||
IsInventaireEdition bool `json:"isinventaireedition"`
|
IsInventaireEdition bool `json:"isinventaireedition"`
|
||||||
Rating int `json:"rating"`
|
Rating int `json:"rating"`
|
||||||
Read bool `json:"read"`
|
Read bool `json:"read"`
|
||||||
|
StartRead bool `json:"startread"`
|
||||||
WantRead bool `json:"wantread"`
|
WantRead bool `json:"wantread"`
|
||||||
CoverPath string `json:"coverPath"`
|
CoverPath string `json:"coverPath"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ func fetchBookSearchQuery(db *gorm.DB, userId uint, searchterm string) *gorm.DB
|
|||||||
|
|
||||||
func fetchBookQueryBuilder(db *gorm.DB, userId uint) *gorm.DB {
|
func fetchBookQueryBuilder(db *gorm.DB, userId uint) *gorm.DB {
|
||||||
query := db.Model(&model.Book{})
|
query := db.Model(&model.Book{})
|
||||||
query = query.Select("books.id, books.title, authors.name as author, books.small_description as description, books.inventaire_id, user_books.rating, user_books.read, user_books.want_read, " + selectStaticFilesPath())
|
query = query.Select("books.id, books.title, authors.name as author, books.small_description as description, books.inventaire_id, user_books.rating, user_books.read, (user_books.start_read_date IS NOT NULL AND (user_books.read IS NULL OR user_books.read IS FALSE)) as start_read, user_books.want_read, " + selectStaticFilesPath())
|
||||||
query = joinAuthors(query)
|
query = joinAuthors(query)
|
||||||
query = query.Joins("left join user_books on (user_books.book_id = books.id and user_books.user_id = ?)", userId)
|
query = query.Joins("left join user_books on (user_books.book_id = books.id and user_books.user_id = ?)", userId)
|
||||||
query = joinStaticFiles(query)
|
query = joinStaticFiles(query)
|
||||||
|
|||||||
Reference in New Issue
Block a user