|
50 | 50 | books by heading to the |
51 | 51 | <a preload class="link" href="{{ base_url }}/search">search</a> tab {% |
52 | 52 | elif page.__eq__("downloaded") %} No books have been downloaded yet. {% |
53 | | - endif %} |
54 | | - </span> |
55 | | - </div> |
56 | | - {% endif %} |
57 | | - <tbody> |
58 | | - {% for result in results %} |
59 | | - {% set book = result.book %} |
60 | | - <tr class="text-xs lg:text-sm" id="{{ book.asin }}"> |
61 | | - <th> |
62 | | - {{ loop.index }} |
63 | | - </th> |
64 | | - <td> |
65 | | - <div class="size-16 lg:size-24"> |
66 | | - {% if book.cover_image %} |
67 | | - <img class="object-cover w-full h-full" |
68 | | - height="64" |
69 | | - width="64" |
70 | | - src="{{ book.cover_image }}" |
71 | | - alt="{{ book.title }}" /> |
72 | | - {% else %} |
73 | | - <div class="flex items-center justify-center w-full h-full bg-neutral opacity-30"> |
74 | | - <icons.PhotoOff /> |
| 53 | + endif %} |
| 54 | + </span> |
| 55 | + </div> |
| 56 | + {% endif %} |
| 57 | + <tbody> |
| 58 | + {% for result in results %} |
| 59 | + {% set book = result.book %} |
| 60 | + <tr class="text-xs lg:text-sm" id="{{ book.asin }}"> |
| 61 | + <th> |
| 62 | + {{ loop.index }} |
| 63 | + </th> |
| 64 | + <td> |
| 65 | + <div class="size-16 lg:size-24"> |
| 66 | + {% if book.cover_image %} |
| 67 | + <img class="object-cover w-full h-full cursor-pointer" |
| 68 | + height="64" |
| 69 | + width="64" |
| 70 | + src="{{ book.cover_image }}" |
| 71 | + alt="{{ book.title }}" |
| 72 | + title="Click to enlarge" |
| 73 | + onclick="bookCoverModal{{ book.asin }}.showModal()" /> |
| 74 | + <dialog id="bookCoverModal{{ book.asin }}" class="modal book-cover-modal"> |
| 75 | + <div class="modal-box"> |
| 76 | + <img src="{{ book.cover_image }}" alt="{{ book.title }}" /> |
| 77 | + </div> |
| 78 | + <form method="dialog" class="modal-backdrop"> |
| 79 | + <button aria-label="Close">close</button> |
| 80 | + </form> |
| 81 | + </dialog> |
| 82 | + {% else %} |
| 83 | + <div class="flex items-center justify-center w-full h-full bg-neutral opacity-30"> |
| 84 | + <icons.PhotoOff /> |
| 85 | + </div> |
| 86 | + {% endif %} |
75 | 87 | </div> |
76 | | - {% endif %} |
77 | | - </div> |
78 | | - </td> |
79 | | - <td> |
80 | | - <div class="flex flex-col"> |
81 | | - <a preload |
82 | | - href="{{ base_url }}/search?q={{ book.title+' ' +(book.authors|join(",") ) }}" |
83 | | - class="font-bold text-primary line-clamp-4" |
84 | | - title="{{ book.title }}">{{ book.title }}</a> |
85 | | - {% if book.subtitle %} |
86 | | - <span class="font-semibold line-clamp-4" title="{{ book.subtitle }}">{{ book.subtitle }}</span> |
87 | | - {% endif %} |
88 | | - </div> |
89 | | - </td> |
90 | | - <td> |
91 | | - {{ book.authors|join(", ") }} |
92 | | - </td> |
93 | | - <td> |
94 | | - {{ book.narrators|join(", ") }} |
95 | | - </td> |
96 | | - <td class="hidden lg:table-cell"> |
97 | | - {{ book.release_date.strftime("%B %Y") }} |
98 | | - </td> |
99 | | - <td class="lg:hidden"> |
100 | | - {{ book.release_date.strftime("%Y") }} |
101 | | - </td> |
102 | | - <td> |
103 | | - {{ book.runtime_length_hrs }} |
104 | | - </td> |
105 | | - |
106 | | - <td title="{{ result.amount_requested }}"> |
107 | | - {% if user.is_admin() %} |
108 | | - <button class="btn px-1 text-sm" |
109 | | - onclick="requesters{{ loop.index }}.showModal()"> |
110 | | - {{ result.amount_requested }} |
111 | | - <icons.Users /> |
112 | | - </button> |
113 | | - <dialog id="requesters{{ loop.index }}" class="modal"> |
114 | | - <div class="modal-box"> |
115 | | - <h3 class="text-lg font-bold"> |
116 | | - Users that requested: |
117 | | - <span class="italic">{{ book.title }}</span> |
118 | | - </h3> |
119 | | - <ul class="py-4 text-sm max-h-60 overflow-y-auto truncate list-disc list-inside"> |
120 | | - {% for user in result.requests %} |
121 | | - <li> |
122 | | - {{ user.user_username }} |
123 | | - </li> |
124 | | - {% endfor %} |
125 | | - </ul> |
| 88 | + </td> |
| 89 | + <td> |
| 90 | + <div class="flex flex-col"> |
| 91 | + <a preload |
| 92 | + href="{{ base_url }}/search?q={{ book.title+' ' +(book.authors|join(",") ) }}" |
| 93 | + class="font-bold text-primary line-clamp-4" |
| 94 | + title="{{ book.title }}">{{ book.title }}</a> |
| 95 | + {% if book.subtitle %} |
| 96 | + <span class="font-semibold line-clamp-4" title="{{ book.subtitle }}">{{ book.subtitle }}</span> |
| 97 | + {% endif %} |
126 | 98 | </div> |
127 | | - <form method="dialog" class="modal-backdrop"> |
128 | | - <button> |
129 | | - close |
| 99 | + </td> |
| 100 | + <td> |
| 101 | + {{ book.authors|join(", ") }} |
| 102 | + </td> |
| 103 | + <td> |
| 104 | + {{ book.narrators|join(", ") }} |
| 105 | + </td> |
| 106 | + <td class="hidden lg:table-cell"> |
| 107 | + {{ book.release_date.strftime("%B %Y") }} |
| 108 | + </td> |
| 109 | + <td class="lg:hidden"> |
| 110 | + {{ book.release_date.strftime("%Y") }} |
| 111 | + </td> |
| 112 | + <td> |
| 113 | + {{ book.runtime_length_hrs }} |
| 114 | + </td> |
| 115 | + |
| 116 | + <td title="{{ result.amount_requested }}"> |
| 117 | + {% if user.is_admin() %} |
| 118 | + <button class="btn px-1 text-sm" |
| 119 | + onclick="requesters{{ loop.index }}.showModal()"> |
| 120 | + {{ result.amount_requested }} |
| 121 | + <icons.Users /> |
130 | 122 | </button> |
131 | | - </form> |
132 | | - </dialog> |
133 | | - {% else %} |
134 | | - {{ result.amount_requested }} |
135 | | - {% endif %} |
136 | | - </td> |
| 123 | + <dialog id="requesters{{ loop.index }}" class="modal"> |
| 124 | + <div class="modal-box"> |
| 125 | + <h3 class="text-lg font-bold"> |
| 126 | + Users that requested: |
| 127 | + <span class="italic">{{ book.title }}</span> |
| 128 | + </h3> |
| 129 | + <ul class="py-4 text-sm max-h-60 overflow-y-auto truncate list-disc list-inside"> |
| 130 | + {% for user in result.requests %} |
| 131 | + <li> |
| 132 | + {{ user.user_username }} |
| 133 | + </li> |
| 134 | + {% endfor %} |
| 135 | + </ul> |
| 136 | + </div> |
| 137 | + <form method="dialog" class="modal-backdrop"> |
| 138 | + <button> |
| 139 | + close |
| 140 | + </button> |
| 141 | + </form> |
| 142 | + </dialog> |
| 143 | + {% else %} |
| 144 | + {{ result.amount_requested }} |
| 145 | + {% endif %} |
| 146 | + </td> |
137 | 147 |
|
138 | | - <td class="grid grid-cols-2 min-w-32 gap-1 w-fit ml-auto"> |
139 | | - <a preload |
140 | | - title="Torrent Sources" |
141 | | - href="{{ base_url }}/wishlist/sources/{{ book.asin }}" |
142 | | - {% if not user.is_admin() %}disabled{% endif %} |
143 | | - class="btn btn-square"> |
144 | | - <icons.List /> |
145 | | - </a> |
146 | | - <button {% if book.downloaded %}title="Downloaded"class="btn btn-square btn-ghost bg-success text-neutral/20" {% else %} title="Automatic Download" class="btn btn-square" {% endif %} |
147 | | - {% if not user.can_download() or book.downloaded %}disabled{% endif %} |
148 | | - hx-post="{{ base_url }}/wishlist/hx-auto-download/{{ book.asin }}" |
149 | | - hx-swap="outerHTML" |
150 | | - hx-target="#book-table-body" |
151 | | - hx-disabled-elt="this"> |
152 | | - <icons.Download /> |
153 | | - </button> |
154 | | - <button title="Remove" |
155 | | - class="btn btn-square" |
156 | | - hx-delete="{{ base_url }}/wishlist/hx-delete/{{ book.asin }}{%- if page.__eq__('downloaded') -%}?downloaded=true{%- endif -%}" |
157 | | - hx-swap="outerHTML" |
158 | | - hx-target="#book-table-body" |
159 | | - hx-disabled-elt="this"> |
160 | | - <icons.Ban /> |
161 | | - </button> |
162 | | - {% if book.downloaded %} |
163 | | - <button class="btn btn-square btn-ghost bg-success text-neutral/20" |
164 | | - disabled |
165 | | - title="Set as downloaded"> |
166 | | - <icons.Checkmark /> |
167 | | - </button> |
168 | | - {% else %} |
169 | | - <button class="btn btn-square" |
170 | | - title="Set as downloaded" |
171 | | - hx-patch="{{ base_url }}/wishlist/downloaded/hx-add/{{ book.asin }}" |
172 | | - {% if not user.is_admin() %}disabled{% endif %} |
173 | | - hx-swap="outerHTML" |
174 | | - hx-target="#book-table-body" |
175 | | - hx-disabled-elt="this"> |
176 | | - <icons.Checkmark /> |
177 | | - </button> |
178 | | - {% endif %} |
179 | | - </td> |
180 | | - </tr> |
181 | | - {% endfor %} |
182 | | - </tbody> |
183 | | - </table> |
| 148 | + <td class="grid grid-cols-2 min-w-32 gap-1 w-fit ml-auto"> |
| 149 | + <a preload |
| 150 | + title="Torrent Sources" |
| 151 | + href="{{ base_url }}/wishlist/sources/{{ book.asin }}" |
| 152 | + {% if not user.is_admin() %}disabled{% endif %} |
| 153 | + class="btn btn-square"> |
| 154 | + <icons.List /> |
| 155 | + </a> |
| 156 | + <button {% if book.downloaded %}title="Downloaded"class="btn btn-square btn-ghost bg-success text-neutral/20" {% else %} title="Automatic Download" class="btn btn-square" {% endif %} |
| 157 | + {% if not user.can_download() or book.downloaded %}disabled{% endif %} |
| 158 | + hx-post="{{ base_url }}/wishlist/hx-auto-download/{{ book.asin }}" |
| 159 | + hx-swap="outerHTML" |
| 160 | + hx-target="#book-table-body" |
| 161 | + hx-disabled-elt="this"> |
| 162 | + <icons.Download /> |
| 163 | + </button> |
| 164 | + <button title="Remove" |
| 165 | + class="btn btn-square" |
| 166 | + hx-delete="{{ base_url }}/wishlist/hx-delete/{{ book.asin }}{%- if page.__eq__('downloaded') -%}?downloaded=true{%- endif -%}" |
| 167 | + hx-swap="outerHTML" |
| 168 | + hx-target="#book-table-body" |
| 169 | + hx-disabled-elt="this"> |
| 170 | + <icons.Ban /> |
| 171 | + </button> |
| 172 | + {% if book.downloaded %} |
| 173 | + <button class="btn btn-square btn-ghost bg-success text-neutral/20" |
| 174 | + disabled |
| 175 | + title="Set as downloaded"> |
| 176 | + <icons.Checkmark /> |
| 177 | + </button> |
| 178 | + {% else %} |
| 179 | + <button class="btn btn-square" |
| 180 | + title="Set as downloaded" |
| 181 | + hx-patch="{{ base_url }}/wishlist/downloaded/hx-add/{{ book.asin }}" |
| 182 | + {% if not user.is_admin() %}disabled{% endif %} |
| 183 | + hx-swap="outerHTML" |
| 184 | + hx-target="#book-table-body" |
| 185 | + hx-disabled-elt="this"> |
| 186 | + <icons.Checkmark /> |
| 187 | + </button> |
| 188 | + {% endif %} |
| 189 | + </td> |
| 190 | + </tr> |
| 191 | + {% endfor %} |
| 192 | + </tbody> |
| 193 | + </table> |
0 commit comments