vioott commited on
Commit
b797ec7
·
1 Parent(s): 1387ef8

feat(genres): add and alphabetically sort extended list of book genres in start and profile forms

Browse files
Files changed (2) hide show
  1. templates/profile.html +13 -5
  2. templates/start.html +15 -7
templates/profile.html CHANGED
@@ -12,12 +12,20 @@
12
  <input type="text" id="name" name="name" value="{{ history.get('name', '') }}"><br><br>
13
 
14
  <p>Quais gêneros de livros você gosta?</p>
15
- {% for genre in ['ficção', 'não ficção', 'ciência', 'fantasia'] %}
16
- <input type="checkbox" id="{{ genre }}" name="preferences" value="{{ genre }}"
17
- {% if genre in history.get('preferences', []) %}checked{% endif %}>
18
- <label for="{{ genre }}">{{ genre.title() }}</label><br>
19
- {% endfor %}
20
 
 
 
 
 
 
 
 
 
21
  <br><button type="submit">Salvar preferências</button>
22
  </form>
23
  </body>
 
12
  <input type="text" id="name" name="name" value="{{ history.get('name', '') }}"><br><br>
13
 
14
  <p>Quais gêneros de livros você gosta?</p>
15
+ {% set genres = [
16
+ 'aventura', 'autoajuda', 'biografia', 'ciência', 'drama', 'educação',
17
+ 'espiritualidade', 'fantasia', 'ficção', 'filosofia', 'história', 'humor',
18
+ 'mistério', 'negócios', 'não-ficção', 'poesia', 'romance', 'tecnologia', 'terror'
19
+ ] %}
20
 
21
+ <div class="genre-grid">
22
+ {% for genre in genres %}
23
+ <input type="checkbox" id="{{ genre }}" name="preferences" value="{{ genre }}"
24
+ {% if genre in history.get('preferences', []) %}checked{% endif %}>
25
+ <label for="{{ genre }}">{{ genre.title() }}</label><br>
26
+ {% endfor %}
27
+ </div>
28
+
29
  <br><button type="submit">Salvar preferências</button>
30
  </form>
31
  </body>
templates/start.html CHANGED
@@ -41,13 +41,21 @@
41
  <input type="text" id="name" name="name" required><br><br>
42
 
43
  <p>Quais gêneros de livros você gosta?</p>
44
-
45
- {% for genre in ['ficção', 'não-ficção', 'ciência', 'fantasia'] %}
46
- <label class="genre-label" for="{{ genre }}">
47
- <input type="checkbox" id="{{ genre }}" name="preferences" value="{{ genre }}">
48
- {{ genre.title() }}
49
- </label>
50
- {% endfor %}
 
 
 
 
 
 
 
 
51
 
52
  <br>
53
  <button type="submit">Começar</button>
 
41
  <input type="text" id="name" name="name" required><br><br>
42
 
43
  <p>Quais gêneros de livros você gosta?</p>
44
+
45
+ {% set genres = [
46
+ 'aventura', 'autoajuda', 'biografia', 'ciência', 'drama', 'educação',
47
+ 'espiritualidade', 'fantasia', 'ficção', 'filosofia', 'história', 'humor',
48
+ 'mistério', 'negócios', 'não-ficção', 'poesia', 'romance', 'tecnologia', 'terror'
49
+ ] %}
50
+
51
+ <div class="genre-grid">
52
+ {% for genre in genres %}
53
+ <label class="genre-label" for="{{ genre }}">
54
+ <input type="checkbox" id="{{ genre }}" name="preferences" value="{{ genre }}">
55
+ {{ genre.title() }}
56
+ </label>
57
+ {% endfor %}
58
+ </div>
59
 
60
  <br>
61
  <button type="submit">Começar</button>