-
-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Chapters for Galleries #3289
Conversation
… modification and use the data for Lightbox
…tton on detailspage after page 40
… modification and use the data for Lightbox
…tton on detailspage after page 40
Using |
I am not sure if I understand correctly. For some explanation on how this works: The Lightbox has a range of pages that is displayed/preloaded, defaulting (hardcoded) to 40 when using the preview in the gallery tab without going into the galleries detail page. This function is also used when clicking on a chapter in the chapters tab on the details page, so the behavior is identical here. I implemented a function to jump to the correct range and to the correct index when choosing a chapter (so for example 86 is resolved to page 2 index 6). The page number given in the chapters tab on creation/editing as well as the one displayed is always referring to the absolute number in the gallery. So you should not give it the number 3 when you are referring to the third page on the second imagewall page, but simply 43. Where you referring to that? In that case, I found this to be quite selfexplaining to the user, when I refer to a book or a gallery, I would count the pages/images from front to back and not in the arbitrary way they are loaded on the current view. Maybe I am wrong on that and better labeling is needed here. |
I think the word "page" is confusing in the chapter edit view. Maybe call it "image number" or "index". |
Thank you for explaining. About the sorting, yes, this confuses the chapterization. However, I am not sure whether this is a useful scenario to consider. For one, this is only the case when you are in the galleries detail page and start sorting them differently and use the chapter menu in the lightbox itself. The sorting is always default and immutable for the gallery view, which is used when clicking a chapter in the details page or entering the lightbox from the general gallery view. It also needs multiple clicks of interaction every time, as you cannot save a filter in the gallery details view, so the user should be aware why this looks the way it looks. |
…rs only in sorted lightbox
Did both those things in the new commit. |
My apologies on the delay in getting back to this PR. To expand on my previous comments, this goes beyond just labelling, it is an interface design issue as well. Leaving aside the UI, in the graphql schema, Having spent some more time thinking about this, my current thinking is that There is still some ambiguity involved in this in that the external client doesn't know the sort order, but it is less of an issue - we can assume a default sorting order for the time being, with a view to add gallery ordering at a later date. This changes the Chapter UI creation - we can no longer just enter in a page, but instead must select an image to mark as the chapter index. I realise that this is a significant change to the PR, and I am open to workshopping this design further, and assisting with the rework. I'm not fully on board the term |
I know this is a more complex Pull, so no worries, thank you for doing this :) I'm afraid there is still a misunderstanding about what the However, it is correct that the sorting is not part of the chapter object right now, something that could maybe be fixed by associating it with the according image, but it would have to be resorted after that anyway to have the correct follow-up images (again, I don't want this to simply mark favorites, but a certain range of images, the same way a marker does for a scene or a chapter splits a comic/book), which would make the association again obsolete (if the frontend first changes the order of the images, the index can again be used with no reference to the image. As this is necessary anyway, there is no advantage in associating the actual image). That means that my understanding for fixing this would be to simply add a value sorting to the chapter, if this would be expanded. The only advantage of associating the image I can imagine is to have a performant or intuitive access to a "chapter thumbnail" of the different chapters, or something like that. Although even that can be done with one request by getting all the gallery information, which include the chapter numbers and the images. In our current frontend, I think something like an image thumbnail for the chapters could be realized without an additional graphql request. About the naming, just quickly my thoughts on the term bookmark: Bookmarks seem to me on internet pages synonymous with a favorite tag, it is meant to mark a singular point of interest. A chapter however is a way to split up a longer body of content into smaller, coherent pieces, so they apply to a certain range. Also, the differenciation with the scene marker is clearer without being too far fetched I believe. |
Alright, I will do that the following days. I thought about a check for the index being out of range, but dropped it because it was already a relatively big project. My reasoning was that the scene marker has no such check as well. It will also not adjust its markers if a scene gets rescanned and appears to be smaller or bigger. The Styling would be better if more coherent, unfortunately I am not much of a frontend developer at all. Some help would be appreciated here (like what classes would be suitable here). Although I'll try, its probably far quicker if I get a little guidance what Element/Styling/Classes to use here. |
And it should turn up under any circumstances, as long as the sorting is default. (ASC). If this is not a case, this is a bug. Maybe you could tell me exactly how that happened? I had no problems there. |
I adjusted the look of the chapter selection in the lightbox to match the options. The naming in front- and backend is also now fixed (except the term chapter, which, although a bit ambiguous, still is more to my liking). And before submitting a new chapter a check is run that gives out an errortoast telling you if the index is to high. There is however no check when adding or removing images to a gallery. I can't think of a way to do it without creating some bad situations, which is why I think this would be the point to leave it to the user to figure out/adjust manually. |
pkg/gallery/delete.go
Outdated
for _, m := range chapters { | ||
if err := DestroyChapter(ctx, m, mqb); err != nil { | ||
return nil, err | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be unnecessary if the relationships cascade correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is... unfortunately necessary. Deletion does not work with an existing chapter if this code is not present. The Error is:
destroying galleries: executing `DELETE FROM `galleries` WHERE (`galleries`.`id` IN (MYGALLERYID))` [[]]: FOREIGN KEY constraint failed
I am not sure how this happens. I can imagine what you mean with cascading, but I don't know how it is done in this body of code. If it should be implemented here, something is wrong probably. I need your assistance to find the location where this is realized.
This is equivalent to how it is done for markers when deleting scenes, see:
pkg/scene/delete.go
Line 131 following.
This request adds chapters to galleries.
These can be understood as the equivalent to markers for scenes, but instead of a timestamp, there is a page number associated. The identification is done via a freely chosen title instead of a primary tag, as this is more in the spirit of chapterization. Also, no Tags can be associated with a chapter, although not entirely useless, I found the possibility to tag a certain range of pages in a gallery to be too specific.
The Implementation is done with a new Tab in Galleries that allows the creation of Chapters
Clicking on a chapter will open the gallery on the associated page.


Also, the lightbox is enhanced to provide access to the gallery. In the top left corner there is a new menu item if this lightbox is coming from a gallery (details page or wall view of the main page).
Folded up it presents the Chapters, which on click will transport the lightbox to the associated page as well.
There is also a new filter for galleries called has chapters, with obvious functionality.
loosely related to #1659 #999 (as this feature is specifically useful for hentai/comics).
Disclaimer: This is not only my first serious commit here but also the first time I worked with react, go or graphql, so please forgive if my coding style is not quite in the vein of those languages. I am of course open to suggestions on that, as well as to the general look of this implementation, which is pretty minimal (something I personally prefer, but is also due to my lack of experience with the Codebase) at this point.