@leroysheep / BookAlchemy Mirror · read-only
Fork 0

Mirrored from https://github.com/LeeRoySheep/BookAlchemy.git

Synced Nov 2, 19:30 UTC

master
html 120 lines 5.43 KB
Raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta http-equiv="X-UA-Compatible" content="ie=edge">
7 <title>My Online Library</title>
8 <link rel="stylesheet" href="/static/style.css">
9 </head>
10 <body>
11
12 <header>
13 <h1>📚 My Online Library</h1>
14 <nav>
15 <ul class="nav-links">
16 <li><a href="/add_author">➕ Add Author</a></li>
17 <li><a href="/add_book">📖 Add Book</a></li>
18 <li><a href="/get_ai_recommendation">🤖 AI Recommendation</a></li>
19 </ul>
20 <div class="actions">
21 <form action="/" method="POST">
22 <label for="options">Sort by:</label>
23 <select id="options" name="options">
24 <option value="title">Title</option>
25 <option value="author">Author</option>
26 <option value="year">Year</option>
27 <option value="rating">Rating</option>
28 </select>
29 <label for="descending">Descending:</label>
30 <input type="checkbox" id="descending" name="descending" value="descending">
31 <input type="submit" value="Sort">
32 </form>
33
34 <form class="search" action="/search" method="POST">
35 <input type="text" id="search" name="search" placeholder="🔍 Search books...">
36 <input type="submit" value="Search">
37 </form>
38 </div>
39 </nav>
40 </header>
41
42 <main>
43 <section class="books">
44 {% if error %}
45 <h2 class="error">⚠️ No Books Found!</h2>
46 {% elif success %}
47 <h2 class="success">✅ Book added successfully!</h2>
48 {% elif success == False %}
49 <h2 class="error">❌ Failed to add book!</h2>
50 {% endif %}
51 {% if rated %}
52 <h2 class="success">✅ Book rated successfully!</h2>
53 {% endif %}
54
55 {% if deleted %}
56 <h2 class="success">✅ Book deleted successfully!</h2>
57 {% elif deleted == False %}
58 <h2 class="error">❌ Failed to delete book!</h2>
59 % if auth_deleted %}
60 <h2 class="success">✅ Author deleted successfully!</h2>
61 {% elif auth_deleted == False %}
62 <h2 class="error">❌ Failed to delete author!</h2>
63 {% endif %}
64
65 <div class="book-grid">
66 {% for book in books %}
67 <div class="book-card">
68 <h3>
69 <a href="/book/{{ book.id }}" class="book-link">{{ book.title }} </a>
70 <a href="/author/{{ book.author_id }}" class="author-link">
71 <span>by {{ book.name }}</span></a></h3>
72 {% if auth_confirmation == book.author_id %}
73 <form action="/author/{{ book.author_id }}/delete"
74 method="POST">
75 <p>Are you sure you want to delete all books by
76 this author and the author itself?
77 </p>
78 <button type="submit" name="confirmation" value="yes">Yes</button>
79 <button type="submit" name="confirmation" value="no">No</button>
80 </form>
81 {% else %}
82 <form action="/author/{{ book.author_id }}/delete" method="POST">
83 <button class="delete-btn" title="Delete Author" value="Delete">
84 🗑Delete Author</button>
85 </form>
86 {% endif %}
87 <p>📅 Year: {{ book.publication_year }}</p>
88 {% if book.isbn %}
89 <a href="https://openlibrary.org/isbn/{{ book.isbn }}" target="_blank">
90 <img src="https://covers.openlibrary.org/b/isbn/{{ book.isbn }}-M.jpg"
91 alt="Book Cover">
92 </a>
93 {% endif %}
94 <footer>
95 <form action="/book/rating/{{ book.id }}" method="POST">
96 <label for="rating">Rating:</label>
97 <input type="number" id="rating" name="rating" step="0.1" min="0.0"
98 max="10.0" value="{{ book.rating }}" required>
99 <input type="submit" value="Rate">
100 </form>
101 </footer>
102 {% if book_confirmation == book.id %}
103 <form action="/book/{{ book.id }}/delete" method="POST">
104 <p>Are you sure you want to delete this book?</p>
105 <button type="submit" name="confirmation" value="yes">Yes</button>
106 <button type="submit" name="confirmation" value="no">No</button>
107 </form>
108 {% else %}
109 <form action="/book/{{ book.id }}/delete" method="POST">
110 <button class="delete-btn">🗑 Delete Book</button>
111 </form>
112 {% endif %}
113 </div>
114 {% endfor %}
115 </div>
116 </section>
117 </main>
118
119 </body>
120 </html>