punkweb-bb 0.4.3__py3-none-any.whl → 0.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. punkweb_bb/__pycache__/bbcode.cpython-311.pyc +0 -0
  2. punkweb_bb/__pycache__/context_processors.cpython-311.pyc +0 -0
  3. punkweb_bb/__pycache__/decorators.cpython-311.pyc +0 -0
  4. punkweb_bb/__pycache__/forms.cpython-311.pyc +0 -0
  5. punkweb_bb/__pycache__/middleware.cpython-311.pyc +0 -0
  6. punkweb_bb/__pycache__/models.cpython-311.pyc +0 -0
  7. punkweb_bb/__pycache__/pagination.cpython-311.pyc +0 -0
  8. punkweb_bb/__pycache__/searching.cpython-311.pyc +0 -0
  9. punkweb_bb/__pycache__/settings.cpython-311.pyc +0 -0
  10. punkweb_bb/__pycache__/urls.cpython-311.pyc +0 -0
  11. punkweb_bb/__pycache__/utils.cpython-311.pyc +0 -0
  12. punkweb_bb/__pycache__/views.cpython-311.pyc +0 -0
  13. punkweb_bb/__pycache__/widgets.cpython-311.pyc +0 -0
  14. punkweb_bb/bbcode.py +4 -3
  15. punkweb_bb/decorators.py +17 -0
  16. punkweb_bb/forms.py +47 -10
  17. punkweb_bb/middleware.py +26 -1
  18. punkweb_bb/migrations/0007_boardprofile_bio.py +18 -0
  19. punkweb_bb/migrations/__pycache__/0001_squashed_0006_remove_boardprofile__signature_rendered_and_more.cpython-311.pyc +0 -0
  20. punkweb_bb/migrations/__pycache__/0007_boardprofile_bio.cpython-311.pyc +0 -0
  21. punkweb_bb/models.py +1 -0
  22. punkweb_bb/pagination.py +1 -1
  23. punkweb_bb/searching.py +10 -0
  24. punkweb_bb/settings.py +2 -0
  25. punkweb_bb/static/punkweb_bb/css/bbcode-editor-content.css +108 -0
  26. punkweb_bb/static/punkweb_bb/css/index.css +5 -6
  27. punkweb_bb/static/punkweb_bb/css/members.css +20 -3
  28. punkweb_bb/static/punkweb_bb/css/profile.css +5 -2
  29. punkweb_bb/static/punkweb_bb/css/punkweb.css +25 -687
  30. punkweb_bb/static/punkweb_bb/css/shoutbox.css +1 -9
  31. punkweb_bb/static/punkweb_bb/css/thread.css +4 -28
  32. punkweb_bb/static/punkweb_bb/js/bbcode-editor-tags.js +63 -0
  33. punkweb_bb/static/punkweb_bb/js/bbcode-editor.js +14 -0
  34. punkweb_bb/static/punkweb_bb/js/markdown-editor.js +49 -0
  35. punkweb_bb/static/punkweb_bb/js/punkweb-dialog.js +9 -0
  36. punkweb_bb/static/punkweb_bb/vendor/htmx-2.0.0.min.js +1 -0
  37. punkweb_bb/static/punkweb_bb/vendor/punkweb-ui.min.css +1 -0
  38. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/commandbar.css +2 -2
  39. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/editor.css +1 -1
  40. punkweb_bb/templates/punkweb_bb/base.html +19 -21
  41. punkweb_bb/templates/punkweb_bb/base_delete_dialog.html +13 -0
  42. punkweb_bb/templates/punkweb_bb/base_dialog.html +16 -0
  43. punkweb_bb/templates/punkweb_bb/bbcode.html +11 -9
  44. punkweb_bb/templates/punkweb_bb/category_create.html +4 -21
  45. punkweb_bb/templates/punkweb_bb/category_update.html +3 -20
  46. punkweb_bb/templates/punkweb_bb/components/pagination_controls.html +45 -0
  47. punkweb_bb/templates/punkweb_bb/components/profile_image.html +11 -0
  48. punkweb_bb/templates/punkweb_bb/forms/inline_form.html +6 -0
  49. punkweb_bb/templates/punkweb_bb/forms/stacked_form.html +35 -0
  50. punkweb_bb/templates/punkweb_bb/index.html +65 -70
  51. punkweb_bb/templates/punkweb_bb/login.html +5 -11
  52. punkweb_bb/templates/punkweb_bb/members.html +23 -52
  53. punkweb_bb/templates/punkweb_bb/partials/category_delete.html +1 -1
  54. punkweb_bb/templates/punkweb_bb/partials/post_delete.html +1 -1
  55. punkweb_bb/templates/punkweb_bb/partials/post_update.html +4 -11
  56. punkweb_bb/templates/punkweb_bb/partials/shout_delete.html +1 -1
  57. punkweb_bb/templates/punkweb_bb/partials/subcategory_delete.html +1 -1
  58. punkweb_bb/templates/punkweb_bb/partials/thread_delete.html +1 -1
  59. punkweb_bb/templates/punkweb_bb/partials/thread_move.html +5 -13
  60. punkweb_bb/templates/punkweb_bb/profile.html +11 -8
  61. punkweb_bb/templates/punkweb_bb/search.html +27 -0
  62. punkweb_bb/templates/punkweb_bb/settings.html +7 -33
  63. punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html +2 -2
  64. punkweb_bb/templates/punkweb_bb/shoutbox/shoutbox.html +21 -6
  65. punkweb_bb/templates/punkweb_bb/signup.html +6 -15
  66. punkweb_bb/templates/punkweb_bb/subcategory.html +14 -54
  67. punkweb_bb/templates/punkweb_bb/subcategory_create.html +7 -16
  68. punkweb_bb/templates/punkweb_bb/subcategory_update.html +7 -16
  69. punkweb_bb/templates/punkweb_bb/thread.html +24 -87
  70. punkweb_bb/templates/punkweb_bb/thread_create.html +7 -16
  71. punkweb_bb/templates/punkweb_bb/thread_update.html +7 -16
  72. punkweb_bb/templatetags/__pycache__/can_delete.cpython-311.pyc +0 -0
  73. punkweb_bb/templatetags/__pycache__/punkweb_bb.cpython-311.pyc +0 -0
  74. punkweb_bb/templatetags/__pycache__/settings.cpython-311.pyc +0 -0
  75. punkweb_bb/templatetags/punkweb_bb.py +9 -0
  76. punkweb_bb/urls.py +1 -0
  77. punkweb_bb/views.py +113 -88
  78. punkweb_bb/widgets.py +3 -4
  79. {punkweb_bb-0.4.3.dist-info → punkweb_bb-0.5.1.dist-info}/METADATA +25 -36
  80. {punkweb_bb-0.4.3.dist-info → punkweb_bb-0.5.1.dist-info}/RECORD +83 -59
  81. {punkweb_bb-0.4.3.dist-info → punkweb_bb-0.5.1.dist-info}/LICENSE +0 -0
  82. {punkweb_bb-0.4.3.dist-info → punkweb_bb-0.5.1.dist-info}/WHEEL +0 -0
  83. {punkweb_bb-0.4.3.dist-info → punkweb_bb-0.5.1.dist-info}/top_level.txt +0 -0
@@ -24,18 +24,21 @@
24
24
  </ul>
25
25
  </nav>
26
26
 
27
- <div class="pw-card fluid margin">
27
+ <div class="pw-card fluid mb-4">
28
28
  <div class="pw-card-content">
29
29
  <div class="profile__info">
30
30
  <div class="profile__info__avatar">
31
- {% if user.profile.image %}
32
- <img class="pw-avatar xl" src="{{user.profile.image.url}}" />
33
- {% else %}
34
- <img class="pw-avatar xl" src="{% static 'punkweb_bb/img/default-profile-image.png' %}" />
35
- {% endif %}
31
+ {% include 'punkweb_bb/components/profile_image.html' with user=user size="lg" %}
36
32
  </div>
37
33
  <div class="profile__info__details">
38
- <div class="profile__info__username">{{user|styled_username}}</div>
34
+ <div class="profile__info__username">
35
+ {{user|styled_username}}
36
+ {% if user.profile.is_online %}
37
+ <div class="pw-badge xs green">Online</div>
38
+ {% else %}
39
+ <div class="pw-badge xs">Offline</div>
40
+ {% endif %}
41
+ </div>
39
42
  <div class="profile__info__stats">
40
43
  <div class="profile__info__stat">
41
44
  Date Joined:
@@ -59,7 +62,7 @@
59
62
  </div>
60
63
  </div>
61
64
 
62
- <div class="pw-card fluid margin">
65
+ <div class="pw-card fluid">
63
66
  <div class="pw-card-header">
64
67
  Threads
65
68
  </div>
@@ -0,0 +1,27 @@
1
+ {% extends 'punkweb_bb/base.html' %}
2
+ {% load static %}
3
+
4
+ {% block content %}
5
+
6
+ <nav>
7
+ <ul class="pw-breadcrumb">
8
+ <li class="pw-breadcrumb-item">
9
+ <a href="{% url 'punkweb_bb:index' %}">Home</a>
10
+ </li>
11
+ {% comment %} <li class="pw-breadcrumb-item">
12
+ <a href="{{thread.subcategory.category.get_absolute_url}}">{{thread.subcategory.category.name}}</a>
13
+ </li>
14
+ <li class="pw-breadcrumb-item">
15
+ <a href="{{thread.subcategory.get_absolute_url}}">{{thread.subcategory.name}}</a>
16
+ </li>
17
+ <li class="pw-breadcrumb-item active">
18
+ {{thread.title}}
19
+ </li> {% endcomment %}
20
+ </ul>
21
+ </nav>
22
+
23
+ {% for thread in threads %}
24
+ <p>{{ thread.title }}</p>
25
+ {% endfor %}
26
+
27
+ {% endblock %}
@@ -6,7 +6,10 @@
6
6
 
7
7
  {% block extra_head %}
8
8
  {{form.media.css}}
9
- <link rel="stylesheet" href="{% static 'punkweb_bb/css/settings.css' %}" />
9
+ {% endblock %}
10
+
11
+ {% block extra_script %}
12
+ {{form.media.js}}
10
13
  {% endblock %}
11
14
 
12
15
  {% block content %}
@@ -25,35 +28,10 @@
25
28
  <div class="pw-card fluid">
26
29
  <div class="pw-card-header">Settings</div>
27
30
  <div class="pw-card-content">
28
- <form class="settingsForm" action="{% url 'punkweb_bb:settings' %}" enctype="multipart/form-data" method="post">
31
+ <form class="pw-form" action="{% url 'punkweb_bb:settings' %}" enctype="multipart/form-data" method="post">
29
32
  {% csrf_token %}
30
- {% for field in form %}
31
- {% if field.name == "image" %}
32
- <div class="settingsForm__field">
33
- <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
34
- {% if field.value %}
35
- <img class="pw-avatar xl" src="{{ field.value.url }}" alt="{{ field.label }}">
36
- <label>
37
- <input type="checkbox" name="image-clear" id="image-clear_id" />
38
- Remove
39
- </label>
40
- {% endif %}
41
- <input type="file" name="image" accept="image/*" id="id_image" />
42
- </div>
43
- {% else %}
44
- <div class="settingsForm__field">
45
- <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
46
- {{ field }}
47
- </div>
48
- {% endif %}
49
- {% if field.errors %}
50
- {{ field.errors }}
51
- {% endif %}
52
- {% endfor %}
53
- {% if form.non_field_errors %}
54
- {{ form.non_field_errors }}
55
- {% endif %}
56
- <div class="settingsForm__actions">
33
+ {{ form }}
34
+ <div class="pw-form-actions end">
57
35
  <a class="pw-button default" href="{% url 'punkweb_bb:profile' request.user.id %}">Cancel</a>
58
36
  <button class="pw-button raised primary" type="submit">Save</button>
59
37
  </div>
@@ -62,7 +40,3 @@
62
40
  </div>
63
41
 
64
42
  {% endblock %}
65
-
66
- {% block extra_script %}
67
- {{form.media.js}}
68
- {% endblock %}
@@ -10,10 +10,10 @@
10
10
  {% if shout|can_delete:request.user %}
11
11
  <div class="shoutbox__shout__actions">
12
12
  <button
13
- class="pw-icon-button default danger sm"
13
+ class="pw-icon-button default red sm"
14
14
  title="Delete"
15
15
  hx-get="{% url 'punkweb_bb:shout_delete' shout.id %}"
16
- hx-target="#modal-portal"
16
+ hx-target="#dialog-portal"
17
17
  >
18
18
  <span class="material-symbols-outlined">delete</span>
19
19
  </button>
@@ -1,21 +1,36 @@
1
- <div class="pw-card fluid">
1
+ {% load punkweb_bb %}
2
+
3
+ <div class="pw-card fluid mb-4">
2
4
  <div class="pw-card-header">
3
5
  Shoutbox
4
6
  </div>
5
7
 
6
- <div class="shoutbox__shouts" id="shoutlist" hx-get="{% url 'punkweb_bb:shout_list' %}" hx-trigger="load, every 15s"
7
- hx-on::after-request="shoutboxScrollToBottom(event)">
8
+ {% punkweb_bb "SHOUTBOX_POLLING_ENABLED" as polling_enabled %}
9
+ {% punkweb_bb "SHOUTBOX_POLLING_INTERVAL" as polling_interval %}
10
+
11
+ <div
12
+ class="shoutbox__shouts"
13
+ id="shoutlist"
14
+ hx-get="{% url 'punkweb_bb:shout_list' %}"
15
+ hx-trigger="load{% if polling_enabled %}, every {{ polling_interval }}s{% endif %}"
16
+ hx-on::after-request="shoutboxScrollToBottom(event)"
17
+ >
8
18
  </div>
9
19
 
10
20
  {% if request.user.is_authenticated %}
11
21
  <form
12
- class="shoutbox__form"
22
+ class="py-2"
13
23
  hx-post="{% url 'punkweb_bb:shout_create' %}"
14
24
  hx-target="#shoutlist"
15
25
  hx-on::after-request="this.reset(); shoutboxScrollToBottom(event)"
16
26
  >
17
- <input class="pw-input fluid shoutbox__input" autocomplete="off" name="content" type="text"
18
- placeholder="Type your message here..." />
27
+ <input
28
+ autocomplete="off"
29
+ class="pw-input fluid"
30
+ name="content"
31
+ placeholder="Type your message here..."
32
+ style="border: none;"
33
+ type="text" />
19
34
  </form>
20
35
  {% endif %}
21
36
  </div>
@@ -5,7 +5,7 @@
5
5
  {% block og_title_prefix %}Sign Up | {% endblock %}
6
6
 
7
7
  {% block extra_head %}
8
- <link rel="stylesheet" href="{% static 'punkweb_bb/css/login.css' %}" />
8
+ <link rel="stylesheet" href="{% static 'punkweb_bb/css/signup.css' %}" />
9
9
  {% endblock %}
10
10
 
11
11
  {% block content %}
@@ -21,24 +21,15 @@
21
21
  </ul>
22
22
  </nav>
23
23
 
24
- <div class="pw-card center">
24
+ <div class="pw-card centerPage">
25
25
  <div class="pw-card-header">Sign Up</div>
26
26
  <div class="pw-card-content">
27
- <form class="loginForm" action="{% url 'punkweb_bb:signup' %}" method="post">
27
+ <form class="pw-form" action="{% url 'punkweb_bb:signup' %}" method="post">
28
28
  {% csrf_token %}
29
- {% for field in form %}
30
- <div class="loginForm__field">
31
- <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
32
- {{ field }}
29
+ {{ form }}
30
+ <div class="pw-form-actions">
31
+ <button class="pw-button fluid raised primary" type="submit">Sign Up</button>
33
32
  </div>
34
- {% if field.errors %}
35
- {{ field.errors }}
36
- {% endif %}
37
- {% endfor %}
38
- {% if form.non_field_errors %}
39
- {{ form.non_field_errors }}
40
- {% endif %}
41
- <button class="pw-button fluid raised primary" type="submit">Sign Up</button>
42
33
  </form>
43
34
  </div>
44
35
  </div>
@@ -40,10 +40,10 @@
40
40
  {% endif %}
41
41
  {% if perms.punkweb_bb.delete_subcategory %}
42
42
  <a
43
- class="pw-icon-button default rounded danger"
43
+ class="pw-icon-button default rounded red"
44
44
  title="Delete subcategory"
45
45
  hx-get="{% url 'punkweb_bb:subcategory_delete' subcategory.slug %}"
46
- hx-target="#modal-portal"
46
+ hx-target="#dialog-portal"
47
47
  >
48
48
  <span class="material-symbols-outlined">delete</span>
49
49
  </a>
@@ -52,6 +52,7 @@
52
52
  {% endif %}
53
53
  </div>
54
54
 
55
+ {% if request.user.is_authenticated %}
55
56
  {% if subcategory|can_post:request.user %}
56
57
  <a class="pw-button ghost primary" href="{% url 'punkweb_bb:thread_create' subcategory.slug %}">Create Thread</a>
57
58
  {% else %}
@@ -64,9 +65,12 @@
64
65
  Create Thread
65
66
  </button>
66
67
  {% endif %}
68
+ {% endif %}
67
69
  </div>
68
70
 
69
- <div class="pw-card fluid margin">
71
+ <div class="pw-card fluid mb-4">
72
+
73
+ {% if threads|length > 0 %}
70
74
  <div class="pw-table-container">
71
75
  <table class="pw-table">
72
76
  <colgroup>
@@ -121,11 +125,7 @@
121
125
  </a>
122
126
  </div>
123
127
  </div>
124
- {% if thread.latest_post.user.profile.image %}
125
- <img class="pw-avatar xs" src="{{thread.latest_post.user.profile.image.url}}" />
126
- {% else %}
127
- <img class="pw-avatar xs" src="{% static 'punkweb_bb/img/default-profile-image.png' %}" />
128
- {% endif %}
128
+ {% include 'punkweb_bb/components/profile_image.html' with user=thread.latest_post.user %}
129
129
  </div>
130
130
  {% else %}
131
131
  No posts
@@ -136,53 +136,13 @@
136
136
  </tbody>
137
137
  </table>
138
138
  </div>
139
+ {% else %}
140
+ <div class="pw-card-content">
141
+ <p>No threads have been created in this subcategory yet.</p>
142
+ </div>
143
+ {% endif %}
139
144
  </div>
140
145
 
141
-
142
- {% if threads.has_other_pages %}
143
- <nav>
144
- <ul class="pw-pagination">
145
- {% if threads.has_previous %}
146
- <li class="pw-pagination-item">
147
- <a class="pw-pagination-link" href="{{ subcategory.get_absolute_url }}?page={{threads.previous_page_number}}">
148
- Prev
149
- </a>
150
- </li>
151
- {% else %}
152
- <li class="pw-pagination-item disabled">
153
- <a class="pw-pagination-link" href="#">
154
- Prev
155
- </a>
156
- </li>
157
- {% endif %}
158
- {% for i in threads.paginator.page_range %}
159
- {% if threads.number == i %}
160
- <li class="pw-pagination-item active">
161
- <a class="pw-pagination-link" href="#">
162
- {{i}}
163
- </a>
164
- </li>
165
- {% else %}
166
- <li class="pw-pagination-item">
167
- <a class="pw-pagination-link" href="{{ subcategory.get_absolute_url }}?page={{i}}">
168
- {{i}}
169
- </a>
170
- </li>
171
- {% endif %}
172
- {% endfor %}
173
- {% if threads.has_next %}
174
- <li class="pw-pagination-item">
175
- <a class="pw-pagination-link" href="{{ subcategory.get_absolute_url }}?page={{threads.next_page_number}}">
176
- Next
177
- </a>
178
- </li>
179
- {% else %}
180
- <li class="pw-pagination-item disabled">
181
- <a class="pw-pagination-link" href="#">Next</a>
182
- </li>
183
- {% endif %}
184
- </ul>
185
- </nav>
186
- {% endif %}
146
+ {% include 'punkweb_bb/components/pagination_controls.html' with paginator=threads %}
187
147
 
188
148
  {% endblock %}
@@ -5,7 +5,10 @@
5
5
 
6
6
  {% block extra_head %}
7
7
  {{form.media.css}}
8
- <link rel="stylesheet" href="{% static 'punkweb_bb/css/subcategory-form.css' %}" />
8
+ {% endblock %}
9
+
10
+ {% block extra_script %}
11
+ {{form.media.js}}
9
12
  {% endblock %}
10
13
 
11
14
  {% block content %}
@@ -27,18 +30,10 @@
27
30
  <div class="pw-card fluid">
28
31
  <div class="pw-card-header">Create Subcategory</div>
29
32
  <div class="pw-card-content">
30
- <form class="subcategoryForm" action="{% url 'punkweb_bb:subcategory_create' category.slug %}" method="post">
33
+ <form class="pw-form" action="{% url 'punkweb_bb:subcategory_create' category.slug %}" method="post">
31
34
  {% csrf_token %}
32
- {% for field in form %}
33
- <div class="subcategoryForm__field">
34
- <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
35
- {{ field }}
36
- </div>
37
- {% endfor %}
38
- {% if form.non_field_errors %}
39
- {{ form.non_field_errors }}
40
- {% endif %}
41
- <div class="subcategoryForm__actions">
35
+ {{ form }}
36
+ <div class="pw-form-actions end">
42
37
  <a class="pw-button default" href="{% url 'punkweb_bb:index' %}" type="submit">Cancel</a>
43
38
  <button class="pw-button raised primary" type="submit">Create</button>
44
39
  </div>
@@ -46,8 +41,4 @@
46
41
  </div>
47
42
  </div>
48
43
 
49
- {% endblock %}
50
-
51
- {% block extra_script %}
52
- {{form.media.js}}
53
44
  {% endblock %}
@@ -5,7 +5,10 @@
5
5
 
6
6
  {% block extra_head %}
7
7
  {{form.media.css}}
8
- <link rel="stylesheet" href="{% static 'punkweb_bb/css/subcategory-form.css' %}" />
8
+ {% endblock %}
9
+
10
+ {% block extra_script %}
11
+ {{form.media.js}}
9
12
  {% endblock %}
10
13
 
11
14
  {% block content %}
@@ -30,18 +33,10 @@
30
33
  <div class="pw-card fluid">
31
34
  <div class="pw-card-header">Edit Subcategory</div>
32
35
  <div class="pw-card-content">
33
- <form class="subcategoryForm" action="{% url 'punkweb_bb:subcategory_update' subcategory.slug %}" method="post">
36
+ <form class="pw-form" action="{% url 'punkweb_bb:subcategory_update' subcategory.slug %}" method="post">
34
37
  {% csrf_token %}
35
- {% for field in form %}
36
- <div class="subcategoryForm__field">
37
- <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
38
- {{ field }}
39
- </div>
40
- {% endfor %}
41
- {% if form.non_field_errors %}
42
- {{ form.non_field_errors }}
43
- {% endif %}
44
- <div class="subcategoryForm__actions">
38
+ {{ form }}
39
+ <div class="pw-form-actions end">
45
40
  <a class="pw-button default" href="{{subcategory.get_absolute_url}}">Cancel</a>
46
41
  <button class="pw-button raised primary" type="submit">Save</button>
47
42
  </div>
@@ -49,8 +44,4 @@
49
44
  </div>
50
45
  </div>
51
46
 
52
- {% endblock %}
53
-
54
- {% block extra_script %}
55
- {{form.media.js}}
56
47
  {% endblock %}
@@ -7,9 +7,7 @@
7
7
  {% block extra_head %}
8
8
  <meta name="description" content="{{thread.content|render|striptags|truncatechars:120}}" />
9
9
  <meta property="og:description" content="{{thread.content|render|striptags|truncatechars:120}}" />
10
- <link rel="stylesheet" href="{% static 'punkweb_bb/css/post-form.css' %}" />
11
10
  <link rel="stylesheet" href="{% static 'punkweb_bb/css/thread.css' %}" />
12
- <link rel="stylesheet" href="{% static 'punkweb_bb/css/thread-form.css' %}" />
13
11
  {{post_form.media.css}}
14
12
  {% endblock %}
15
13
 
@@ -39,7 +37,7 @@
39
37
  {% if posts.number == 1 %}
40
38
  <h1>{{thread.title}}</h1>
41
39
 
42
- <div class="pw-card fluid margin">
40
+ <div class="pw-card fluid mb-4">
43
41
  <div class="pw-card-header">
44
42
  <div class="thread__date">
45
43
  <time datetime="{{thread.created_at|date:'c'}}">{{thread.created_at | date:'M j, Y'}}</time>
@@ -49,19 +47,15 @@
49
47
  <div class="thread__user">
50
48
  <div class="thread__user__info">
51
49
  <div class="thread__user__image">
52
- {% if thread.user.profile.image %}
53
- <img class="pw-avatar" src="{{thread.user.profile.image.url}}" alt="{{thread.user.username}}" />
54
- {% else %}
55
- <img class="pw-avatar" src="{% static 'punkweb_bb/img/default-profile-image.png' %}" alt="{{thread.user.username}}" />
56
- {% endif %}
50
+ {% include 'punkweb_bb/components/profile_image.html' with user=thread.user size="md" %}
57
51
  </div>
58
52
  <div class="thread__user__username">
59
- {% if thread.user.profile.is_online %}
60
- <div class="onlineIndicator"></div>
61
- {% endif %}
62
53
  <a href="{% url 'punkweb_bb:profile' thread.user.id %}">
63
54
  {{thread.user|styled_username}}
64
55
  </a>
56
+ {% if thread.user.profile.is_online %}
57
+ <div class="onlineIndicator"></div>
58
+ {% endif %}
65
59
  </div>
66
60
  <div class="thread__user__group">
67
61
  {% if thread.user.profile.priority_group %}
@@ -95,7 +89,7 @@
95
89
  class="pw-icon-button default rounded"
96
90
  title="Move"
97
91
  hx-get="{% url 'punkweb_bb:thread_move' thread.id %}"
98
- hx-target="#modal-portal"
92
+ hx-target="#dialog-portal"
99
93
  >
100
94
  <span class="material-symbols-outlined">move_item</span>
101
95
  </a>
@@ -139,10 +133,10 @@
139
133
  {% endif %}
140
134
  {% if thread|can_delete:request.user %}
141
135
  <a
142
- class="pw-icon-button default rounded danger"
136
+ class="pw-icon-button default rounded red"
143
137
  title="Delete"
144
138
  hx-get="{% url 'punkweb_bb:thread_delete' thread.id %}"
145
- hx-target="#modal-portal"
139
+ hx-target="#dialog-portal"
146
140
  >
147
141
  <span class="material-symbols-outlined">delete</span>
148
142
  </a>
@@ -160,7 +154,7 @@
160
154
  {% endif %}
161
155
 
162
156
  {% for post in posts %}
163
- <div id="post-{{post.id}}" class="pw-card fluid margin">
157
+ <div id="post-{{post.id}}" class="pw-card fluid mb-4">
164
158
  <div class="pw-card-header thread__header">
165
159
  <div class="thread__date">
166
160
  <time datetime="{{post.created_at|date:'c'}}">{{post.created_at | date:'M j, Y'}}</time>
@@ -171,23 +165,15 @@
171
165
  <div class="thread__user">
172
166
  <div class="thread__user__info">
173
167
  <div class="thread__user__image">
174
- {% if post.user.profile.image %}
175
- <div class="thread__user__image">
176
- <img class="pw-avatar" src="{{post.user.profile.image.url}}" alt="{{post.user.username}}" />
177
- </div>
178
- {% else %}
179
- <div class="thread__user__image">
180
- <img class="pw-avatar" src="{% static 'punkweb_bb/img/default-profile-image.png' %}" alt="{{post.user.username}}" />
181
- </div>
182
- {% endif %}
168
+ {% include 'punkweb_bb/components/profile_image.html' with user=post.user size="md" %}
183
169
  </div>
184
170
  <div class="thread__user__username">
185
- {% if post.user.profile.is_online %}
186
- <div class="onlineIndicator"></div>
187
- {% endif %}
188
171
  <a href="{% url 'punkweb_bb:profile' post.user.id %}">
189
172
  {{post.user|styled_username}}
190
173
  </a>
174
+ {% if post.user.profile.is_online %}
175
+ <div class="onlineIndicator"></div>
176
+ {% endif %}
191
177
  </div>
192
178
  <div class="thread__user__group">
193
179
  {% if post.user.profile.priority_group %}
@@ -221,17 +207,17 @@
221
207
  class="pw-icon-button default rounded"
222
208
  title="Edit"
223
209
  hx-get="{% url 'punkweb_bb:post_update' post.id %}"
224
- hx-target="#modal-portal"
210
+ hx-target="#dialog-portal"
225
211
  >
226
212
  <span class="material-symbols-outlined">edit</span>
227
213
  </a>
228
214
  {% endif %}
229
215
  {% if post|can_delete:request.user %}
230
216
  <a
231
- class="pw-icon-button default rounded danger"
217
+ class="pw-icon-button default rounded red"
232
218
  title="Delete"
233
219
  hx-get="{% url 'punkweb_bb:post_delete' post.id %}"
234
- hx-target="#modal-portal"
220
+ hx-target="#dialog-portal"
235
221
  >
236
222
  <span class="material-symbols-outlined">delete</span>
237
223
  </a>
@@ -248,68 +234,18 @@
248
234
  </div>
249
235
  {% endfor %}
250
236
 
251
- {% if posts.has_other_pages %}
252
- <nav>
253
- <ul class="pw-pagination">
254
- {% if posts.has_previous %}
255
- <li class="pw-pagination-item">
256
- <a class="pw-pagination-link" href="{{ post.thread.get_absolute_url }}?page={{posts.previous_page_number}}">
257
- Prev
258
- </a>
259
- </li>
260
- {% else %}
261
- <li class="pw-pagination-item disabled">
262
- <a class="pw-pagination-link" href="#">
263
- Prev
264
- </a>
265
- </li>
266
- {% endif %}
267
- {% for i in posts.paginator.page_range %}
268
- {% if posts.number == i %}
269
- <li class="pw-pagination-item active">
270
- <a class="pw-pagination-link" href="#">
271
- {{i}}
272
- </a>
273
- </li>
274
- {% else %}
275
- <li class="pw-pagination-item">
276
- <a class="pw-pagination-link" href="{{ post.thread.get_absolute_url }}?page={{i}}">
277
- {{i}}
278
- </a>
279
- </li>
280
- {% endif %}
281
- {% endfor %}
282
- {% if posts.has_next %}
283
- <li class="pw-pagination-item">
284
- <a class="pw-pagination-link" href="{{ post.thread.get_absolute_url }}?page={{posts.next_page_number}}">
285
- Next
286
- </a>
287
- </li>
288
- {% else %}
289
- <li class="pw-pagination-item disabled">
290
- <a class="pw-pagination-link" href="#">Next</a>
291
- </li>
292
- {% endif %}
293
- </ul>
294
- </nav>
295
- {% endif %}
237
+ {% include 'punkweb_bb/components/pagination_controls.html' with paginator=posts %}
296
238
 
239
+ {% if request.user.is_authenticated %}
297
240
  {% if thread|can_post:request.user %}
298
- <div class="pw-card fluid margin">
241
+ <div class="pw-card fluid mt-4">
299
242
  <div class="pw-card-header">Reply to thread</div>
300
243
  <div class="pw-card-content">
301
244
  <div class="thread__reply__content">
302
- <form class="postForm" action="{% url 'punkweb_bb:post_create' thread.id %}" method="post">
245
+ <form class="pw-form" action="{% url 'punkweb_bb:post_create' thread.id %}" method="post">
303
246
  {% csrf_token %}
304
- {% for field in post_form %}
305
- <div class="postForm__field">
306
- {{ field }}
307
- </div>
308
- {% endfor %}
309
- {% if post_form.non_field_errors %}
310
- {{ post_form.non_field_errors }}
311
- {% endif %}
312
- <div class="postForm__actions">
247
+ {{ post_form }}
248
+ <div class="pw-form-actions end">
313
249
  <button class="pw-button raised primary" type="submit">Post reply</button>
314
250
  </div>
315
251
  </form>
@@ -317,12 +253,13 @@
317
253
  </div>
318
254
  </div>
319
255
  {% else %}
320
- <div class="pw-card fluid margin">
256
+ <div class="pw-card fluid mt-4">
321
257
  <div class="pw-card-header">Thread closed</div>
322
258
  <div class="pw-card-content">
323
259
  <div>This thread is closed and you cannot reply to it.</div>
324
260
  </div>
325
261
  </div>
326
262
  {% endif %}
263
+ {% endif %}
327
264
 
328
265
  {% endblock %}
@@ -6,7 +6,10 @@
6
6
 
7
7
  {% block extra_head %}
8
8
  {{form.media.css}}
9
- <link rel="stylesheet" href="{% static 'punkweb_bb/css/thread-form.css' %}" />
9
+ {% endblock %}
10
+
11
+ {% block extra_script %}
12
+ {{form.media.js}}
10
13
  {% endblock %}
11
14
 
12
15
  {% block content %}
@@ -31,18 +34,10 @@
31
34
  <div class="pw-card fluid">
32
35
  <div class="pw-card-header">Create Thread</div>
33
36
  <div class="pw-card-content">
34
- <form class="threadForm" action="{% url 'punkweb_bb:thread_create' subcategory.slug %}" method="post">
37
+ <form class="pw-form" action="{% url 'punkweb_bb:thread_create' subcategory.slug %}" method="post">
35
38
  {% csrf_token %}
36
- {% for field in form %}
37
- <div class="threadForm__field">
38
- <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
39
- {{ field }}
40
- </div>
41
- {% endfor %}
42
- {% if form.non_field_errors %}
43
- {{ form.non_field_errors }}
44
- {% endif %}
45
- <div class="threadForm__actions">
39
+ {{ form }}
40
+ <div class="pw-form-actions end">
46
41
  <a class="pw-button default" href="{{subcategory.get_absolute_url}}" type="submit">Cancel</a>
47
42
  <button class="pw-button raised primary" type="submit">Create Thread</button>
48
43
  </div>
@@ -50,8 +45,4 @@
50
45
  </div>
51
46
  </div>
52
47
 
53
- {% endblock %}
54
-
55
- {% block extra_script %}
56
- {{form.media.js}}
57
48
  {% endblock %}