punkweb-bb 0.2.2__py3-none-any.whl → 0.3.0__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.
- punkweb_bb/__pycache__/admin.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/admin_forms.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/forms.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/models.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/settings.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/sitemap.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/tests.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/urls.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/utils.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/views.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/widgets.cpython-311.pyc +0 -0
- punkweb_bb/admin.py +0 -4
- punkweb_bb/admin_forms.py +6 -5
- punkweb_bb/forms.py +13 -5
- punkweb_bb/migrations/0005_alter_thread_options.py +24 -0
- punkweb_bb/migrations/0006_remove_boardprofile__signature_rendered_and_more.py +60 -0
- punkweb_bb/migrations/__pycache__/0005_alter_thread_options.cpython-311.pyc +0 -0
- punkweb_bb/migrations/__pycache__/0006_remove_boardprofile__signature_rendered_and_more.cpython-311.pyc +0 -0
- punkweb_bb/models.py +12 -9
- punkweb_bb/settings.py +1 -0
- punkweb_bb/static/punkweb_bb/css/thread.css +45 -28
- punkweb_bb/static/punkweb_bb/editor/markdown-editor.js +23 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.eslintrc.json +15 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.gitignore +108 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.prettierrc.json +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/LICENSE +21 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/README.md +240 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/babel.config.json +14 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/blank.html +18 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/demo.html +126 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.css +231 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.js +3086 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.min.css +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.min.js +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.tiny.js +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/_config.yml +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/_layouts/default.html +50 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/index.md +174 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/globals.d.ts +172 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/gulpfile.mjs +226 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/block.test.js +696 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/commandbar.test.js +84 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/inline.test.js +486 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/interaction.test.js +31 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/setup.test.js +164 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/config.js +2 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/server.js +9 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/setup.js +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/test-helpers.js +98 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest-puppeteer.config.js +8 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest.config.js +13 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/package-lock.json +16295 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/package.json +72 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/TinyMDE.js +1926 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/TinyMDECommandBar.js +256 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/commandbar.css +72 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/editor.css +157 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/index.css +3 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/grammar.js +300 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/html/blank.html +18 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/html/demo.html +126 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/index.js +4 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/blockquote.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/bold.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/clear_formatting.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/code.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/h1.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/h2.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/hr.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/image.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/italic.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/link.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/ol.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/strikethrough.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/svg.js +17 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/ul.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/tiny.js +3 -0
- punkweb_bb/templates/punkweb_bb/base_delete_modal.html +13 -0
- punkweb_bb/templates/punkweb_bb/index.html +2 -2
- punkweb_bb/templates/punkweb_bb/members.html +3 -1
- punkweb_bb/templates/punkweb_bb/partials/category_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/post_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/shout_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/subcategory_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/thread_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/thread_move.html +24 -0
- punkweb_bb/templates/punkweb_bb/profile.html +8 -4
- punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html +3 -3
- punkweb_bb/templates/punkweb_bb/subcategory.html +1 -1
- punkweb_bb/templates/punkweb_bb/thread.html +89 -71
- punkweb_bb/templates/punkweb_bb/widgets/markdown-editor.html +3 -0
- punkweb_bb/templatetags/__pycache__/markdown.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/render.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/shoutbox_bbcode.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/shoutbox_render.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/styled_group_name.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/render.py +48 -0
- punkweb_bb/templatetags/shoutbox_render.py +22 -0
- punkweb_bb/templatetags/styled_group_name.py +2 -2
- punkweb_bb/tests.py +3 -3
- punkweb_bb/urls.py +1 -0
- punkweb_bb/utils.py +23 -7
- punkweb_bb/views.py +36 -7
- punkweb_bb/widgets.py +20 -0
- {punkweb_bb-0.2.2.dist-info → punkweb_bb-0.3.0.dist-info}/METADATA +56 -41
- {punkweb_bb-0.2.2.dist-info → punkweb_bb-0.3.0.dist-info}/RECORD +109 -41
- punkweb_bb/templatetags/shoutbox_bbcode.py +0 -14
- {punkweb_bb-0.2.2.dist-info → punkweb_bb-0.3.0.dist-info}/LICENSE +0 -0
- {punkweb_bb-0.2.2.dist-info → punkweb_bb-0.3.0.dist-info}/WHEEL +0 -0
- {punkweb_bb-0.2.2.dist-info → punkweb_bb-0.3.0.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
punkweb_bb/admin.py
CHANGED
|
@@ -34,10 +34,6 @@ class BoardProfileModelAdmin(admin.ModelAdmin):
|
|
|
34
34
|
"user__username",
|
|
35
35
|
"user__email",
|
|
36
36
|
)
|
|
37
|
-
readonly_fields = ("signature_rendered",)
|
|
38
|
-
|
|
39
|
-
def signature_rendered(self, obj):
|
|
40
|
-
return mark_safe(obj.signature.rendered)
|
|
41
37
|
|
|
42
38
|
|
|
43
39
|
@admin.register(Category)
|
punkweb_bb/admin_forms.py
CHANGED
|
@@ -8,6 +8,7 @@ from punkweb_bb.models import (
|
|
|
8
8
|
Subcategory,
|
|
9
9
|
Thread,
|
|
10
10
|
)
|
|
11
|
+
from punkweb_bb.utils import get_editor_widget
|
|
11
12
|
from punkweb_bb.widgets import BBCodeEditorWidget
|
|
12
13
|
|
|
13
14
|
|
|
@@ -16,7 +17,7 @@ class BoardProfileAdminModelForm(forms.ModelForm):
|
|
|
16
17
|
model = BoardProfile
|
|
17
18
|
fields = "__all__"
|
|
18
19
|
widgets = {
|
|
19
|
-
"signature":
|
|
20
|
+
"signature": get_editor_widget(),
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
|
|
@@ -25,7 +26,7 @@ class CategoryAdminModelForm(forms.ModelForm):
|
|
|
25
26
|
model = Category
|
|
26
27
|
fields = "__all__"
|
|
27
28
|
widgets = {
|
|
28
|
-
"description":
|
|
29
|
+
"description": get_editor_widget(),
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
|
|
@@ -34,7 +35,7 @@ class SubcategoryAdminModelForm(forms.ModelForm):
|
|
|
34
35
|
model = Subcategory
|
|
35
36
|
fields = "__all__"
|
|
36
37
|
widgets = {
|
|
37
|
-
"description":
|
|
38
|
+
"description": get_editor_widget(),
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
|
|
@@ -43,7 +44,7 @@ class ThreadAdminModelForm(forms.ModelForm):
|
|
|
43
44
|
model = Thread
|
|
44
45
|
fields = "__all__"
|
|
45
46
|
widgets = {
|
|
46
|
-
"content":
|
|
47
|
+
"content": get_editor_widget(),
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
|
|
@@ -52,7 +53,7 @@ class PostAdminModelForm(forms.ModelForm):
|
|
|
52
53
|
model = Post
|
|
53
54
|
fields = "__all__"
|
|
54
55
|
widgets = {
|
|
55
|
-
"content":
|
|
56
|
+
"content": get_editor_widget(),
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
|
punkweb_bb/forms.py
CHANGED
|
@@ -2,7 +2,7 @@ from django import forms
|
|
|
2
2
|
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
|
|
3
3
|
|
|
4
4
|
from punkweb_bb.models import BoardProfile, Category, Post, Shout, Subcategory, Thread
|
|
5
|
-
from punkweb_bb.
|
|
5
|
+
from punkweb_bb.utils import get_editor_widget
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class LoginForm(AuthenticationForm):
|
|
@@ -39,7 +39,7 @@ class BoardProfileModelForm(forms.ModelForm):
|
|
|
39
39
|
"signature",
|
|
40
40
|
)
|
|
41
41
|
widgets = {
|
|
42
|
-
"signature":
|
|
42
|
+
"signature": get_editor_widget(),
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
|
|
@@ -66,7 +66,7 @@ class PostModelForm(forms.ModelForm):
|
|
|
66
66
|
"content": "",
|
|
67
67
|
}
|
|
68
68
|
widgets = {
|
|
69
|
-
"content":
|
|
69
|
+
"content": get_editor_widget(),
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
|
|
@@ -87,7 +87,7 @@ class SubcategoryModelForm(forms.ModelForm):
|
|
|
87
87
|
)
|
|
88
88
|
widgets = {
|
|
89
89
|
"name": forms.TextInput(attrs={"autofocus": True, "class": "pw-input"}),
|
|
90
|
-
"description":
|
|
90
|
+
"description": get_editor_widget(),
|
|
91
91
|
"order": forms.TextInput(
|
|
92
92
|
attrs={"class": "pw-input", "min": "0", "type": "number"}
|
|
93
93
|
),
|
|
@@ -103,5 +103,13 @@ class ThreadModelForm(forms.ModelForm):
|
|
|
103
103
|
)
|
|
104
104
|
widgets = {
|
|
105
105
|
"title": forms.TextInput(attrs={"autofocus": True, "class": "pw-input"}),
|
|
106
|
-
"content":
|
|
106
|
+
"content": get_editor_widget(),
|
|
107
107
|
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class ThreadMoveForm(forms.Form):
|
|
111
|
+
subcategory = forms.ModelChoiceField(
|
|
112
|
+
queryset=Subcategory.objects.all(),
|
|
113
|
+
empty_label="Select a subcategory",
|
|
114
|
+
widget=forms.Select(attrs={"class": "pw-input"}),
|
|
115
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-05-30 02:25
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("punkweb_bb", "0004_groupstyle"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterModelOptions(
|
|
14
|
+
name="thread",
|
|
15
|
+
options={
|
|
16
|
+
"ordering": ("subcategory", "-is_pinned", "-last_post_created_at"),
|
|
17
|
+
"permissions": (
|
|
18
|
+
("move_thread", "Can move thread"),
|
|
19
|
+
("pin_thread", "Can pin thread"),
|
|
20
|
+
("close_thread", "Can close thread"),
|
|
21
|
+
),
|
|
22
|
+
},
|
|
23
|
+
),
|
|
24
|
+
]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-05-30 21:37
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("punkweb_bb", "0005_alter_thread_options"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.RemoveField(
|
|
14
|
+
model_name="boardprofile",
|
|
15
|
+
name="_signature_rendered",
|
|
16
|
+
),
|
|
17
|
+
migrations.RemoveField(
|
|
18
|
+
model_name="groupstyle",
|
|
19
|
+
name="_username_style_rendered",
|
|
20
|
+
),
|
|
21
|
+
migrations.RemoveField(
|
|
22
|
+
model_name="post",
|
|
23
|
+
name="_content_rendered",
|
|
24
|
+
),
|
|
25
|
+
migrations.RemoveField(
|
|
26
|
+
model_name="subcategory",
|
|
27
|
+
name="_description_rendered",
|
|
28
|
+
),
|
|
29
|
+
migrations.RemoveField(
|
|
30
|
+
model_name="thread",
|
|
31
|
+
name="_content_rendered",
|
|
32
|
+
),
|
|
33
|
+
migrations.AlterField(
|
|
34
|
+
model_name="boardprofile",
|
|
35
|
+
name="signature",
|
|
36
|
+
field=models.TextField(blank=True, default="", max_length=1024),
|
|
37
|
+
preserve_default=False,
|
|
38
|
+
),
|
|
39
|
+
migrations.AlterField(
|
|
40
|
+
model_name="groupstyle",
|
|
41
|
+
name="username_style",
|
|
42
|
+
field=models.TextField(),
|
|
43
|
+
),
|
|
44
|
+
migrations.AlterField(
|
|
45
|
+
model_name="post",
|
|
46
|
+
name="content",
|
|
47
|
+
field=models.TextField(),
|
|
48
|
+
),
|
|
49
|
+
migrations.AlterField(
|
|
50
|
+
model_name="subcategory",
|
|
51
|
+
name="description",
|
|
52
|
+
field=models.TextField(blank=True, default=""),
|
|
53
|
+
preserve_default=False,
|
|
54
|
+
),
|
|
55
|
+
migrations.AlterField(
|
|
56
|
+
model_name="thread",
|
|
57
|
+
name="content",
|
|
58
|
+
field=models.TextField(),
|
|
59
|
+
),
|
|
60
|
+
]
|
|
Binary file
|
punkweb_bb/models.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import datetime
|
|
2
1
|
import math
|
|
3
2
|
import os
|
|
4
3
|
|
|
@@ -9,10 +8,9 @@ from django.db import models
|
|
|
9
8
|
from django.forms import ValidationError
|
|
10
9
|
from django.urls import reverse
|
|
11
10
|
from django.utils import timezone
|
|
12
|
-
from precise_bbcode.fields import BBCodeTextField
|
|
13
11
|
|
|
14
12
|
from punkweb_bb.mixins import TimestampMixin, UUIDPrimaryKeyMixin
|
|
15
|
-
from punkweb_bb.utils import get_styled_username
|
|
13
|
+
from punkweb_bb.utils import get_highest_priority_group, get_styled_username
|
|
16
14
|
|
|
17
15
|
User = get_user_model()
|
|
18
16
|
|
|
@@ -25,11 +23,15 @@ def profile_image_upload_to(instance, filename):
|
|
|
25
23
|
class BoardProfile(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
26
24
|
user = models.OneToOneField(User, related_name="profile", on_delete=models.CASCADE)
|
|
27
25
|
image = models.ImageField(upload_to=profile_image_upload_to, blank=True, null=True)
|
|
28
|
-
signature =
|
|
26
|
+
signature = models.TextField(max_length=1024, blank=True)
|
|
29
27
|
|
|
30
28
|
class Meta:
|
|
31
29
|
ordering = ("user__username",)
|
|
32
30
|
|
|
31
|
+
@property
|
|
32
|
+
def priority_group(self):
|
|
33
|
+
return get_highest_priority_group(self.user)
|
|
34
|
+
|
|
33
35
|
@property
|
|
34
36
|
def styled_username(self):
|
|
35
37
|
return get_styled_username(self.user)
|
|
@@ -38,7 +40,7 @@ class BoardProfile(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
|
38
40
|
def is_online(self):
|
|
39
41
|
last_seen = cache.get(f"profile_online_{self.id}")
|
|
40
42
|
if last_seen:
|
|
41
|
-
return timezone.now() < last_seen +
|
|
43
|
+
return timezone.now() < last_seen + timezone.timedelta(minutes=5)
|
|
42
44
|
return False
|
|
43
45
|
|
|
44
46
|
@property
|
|
@@ -73,7 +75,7 @@ class Subcategory(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
|
73
75
|
)
|
|
74
76
|
name = models.CharField(max_length=255)
|
|
75
77
|
slug = models.SlugField(max_length=1024, unique=True)
|
|
76
|
-
description =
|
|
78
|
+
description = models.TextField(blank=True)
|
|
77
79
|
order = models.PositiveIntegerField(default=0)
|
|
78
80
|
staff_post_only = models.BooleanField(default=False)
|
|
79
81
|
|
|
@@ -113,7 +115,7 @@ class Thread(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
|
113
115
|
)
|
|
114
116
|
user = models.ForeignKey(User, related_name="threads", on_delete=models.CASCADE)
|
|
115
117
|
title = models.CharField(max_length=255)
|
|
116
|
-
content =
|
|
118
|
+
content = models.TextField()
|
|
117
119
|
is_pinned = models.BooleanField(default=False)
|
|
118
120
|
is_closed = models.BooleanField(default=False)
|
|
119
121
|
last_post_created_at = models.DateTimeField(auto_now_add=True)
|
|
@@ -126,6 +128,7 @@ class Thread(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
|
126
128
|
"-last_post_created_at",
|
|
127
129
|
)
|
|
128
130
|
permissions = (
|
|
131
|
+
("move_thread", "Can move thread"),
|
|
129
132
|
("pin_thread", "Can pin thread"),
|
|
130
133
|
("close_thread", "Can close thread"),
|
|
131
134
|
)
|
|
@@ -157,7 +160,7 @@ class Thread(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
|
157
160
|
class Post(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
158
161
|
thread = models.ForeignKey(Thread, related_name="posts", on_delete=models.CASCADE)
|
|
159
162
|
user = models.ForeignKey(User, related_name="posts", on_delete=models.CASCADE)
|
|
160
|
-
content =
|
|
163
|
+
content = models.TextField()
|
|
161
164
|
|
|
162
165
|
class Meta:
|
|
163
166
|
ordering = ("created_at",)
|
|
@@ -219,7 +222,7 @@ class GroupStyle(UUIDPrimaryKeyMixin, TimestampMixin):
|
|
|
219
222
|
default=0,
|
|
220
223
|
help_text="Highest priority is displayed",
|
|
221
224
|
)
|
|
222
|
-
username_style =
|
|
225
|
+
username_style = models.TextField()
|
|
223
226
|
|
|
224
227
|
class Meta:
|
|
225
228
|
ordering = ("-priority",)
|
punkweb_bb/settings.py
CHANGED
|
@@ -4,6 +4,7 @@ PUNKWEB_BB = getattr(settings, "PUNKWEB_BB", {})
|
|
|
4
4
|
|
|
5
5
|
SITE_NAME = PUNKWEB_BB.get("SITE_NAME", "PUNKWEB")
|
|
6
6
|
SITE_TITLE = PUNKWEB_BB.get("SITE_TITLE", "PunkwebBB")
|
|
7
|
+
RENDERER = PUNKWEB_BB.get("RENDERER", "bbcode")
|
|
7
8
|
FAVICON = PUNKWEB_BB.get("FAVICON", "punkweb_bb/favicon.ico")
|
|
8
9
|
OG_IMAGE = PUNKWEB_BB.get("OG_IMAGE", None)
|
|
9
10
|
SHOUTBOX_ENABLED = PUNKWEB_BB.get("SHOUTBOX_ENABLED", True)
|
|
@@ -28,13 +28,25 @@
|
|
|
28
28
|
padding: 1rem;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.thread__user__info {
|
|
32
32
|
align-items: center;
|
|
33
33
|
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
34
35
|
gap: 0.25rem;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
.
|
|
38
|
+
.thread__user__username {
|
|
39
|
+
align-items: center;
|
|
40
|
+
display: flex;
|
|
41
|
+
gap: 0.25rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.thread__user__group {
|
|
45
|
+
font-size: 0.75rem;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.thread__user__details {
|
|
38
50
|
background-color: var(--oc-gray-0);
|
|
39
51
|
border: 1px solid var(--border);
|
|
40
52
|
border-radius: 0.25rem;
|
|
@@ -45,35 +57,16 @@
|
|
|
45
57
|
width: 100%;
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
.
|
|
60
|
+
.thread__user__details__row {
|
|
49
61
|
align-items: center;
|
|
50
62
|
display: flex;
|
|
51
63
|
justify-content: space-between;
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
.
|
|
66
|
+
.thread__user__details__label {
|
|
55
67
|
color: var(--body-fg);
|
|
56
68
|
}
|
|
57
69
|
|
|
58
|
-
.thread__user__groups {
|
|
59
|
-
display: flex;
|
|
60
|
-
flex-direction: column;
|
|
61
|
-
gap: 0.5rem;
|
|
62
|
-
width: 100%;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.thread__user__group {
|
|
66
|
-
background-color: var(--oc-gray-0);
|
|
67
|
-
border: 1px solid var(--border);
|
|
68
|
-
border-radius: 0.25rem;
|
|
69
|
-
color: var(--text-on-primary);
|
|
70
|
-
display: flex;
|
|
71
|
-
font-size: 0.875rem;
|
|
72
|
-
justify-content: center;
|
|
73
|
-
padding: 0.5rem;
|
|
74
|
-
width: 100%;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
70
|
.thread__main {
|
|
78
71
|
display: flex;
|
|
79
72
|
flex-direction: column;
|
|
@@ -85,11 +78,6 @@
|
|
|
85
78
|
padding: 1rem;
|
|
86
79
|
}
|
|
87
80
|
|
|
88
|
-
.thread__signature {
|
|
89
|
-
border-top: 1px solid var(--border);
|
|
90
|
-
padding: 1rem;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
81
|
.thread__actions {
|
|
94
82
|
align-items: center;
|
|
95
83
|
display: flex;
|
|
@@ -98,12 +86,41 @@
|
|
|
98
86
|
padding: 1rem;
|
|
99
87
|
}
|
|
100
88
|
|
|
89
|
+
.thread__signature {
|
|
90
|
+
border-top: 1px solid var(--border);
|
|
91
|
+
padding: 1rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
101
94
|
.thread__reply__content {
|
|
102
95
|
display: flex;
|
|
103
96
|
flex-direction: column;
|
|
104
97
|
gap: 1rem;
|
|
105
98
|
}
|
|
106
99
|
|
|
100
|
+
.threadMoveForm {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
gap: 1rem;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.threadMoveForm__field {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
gap: 0.5rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.threadMoveForm .errorlist {
|
|
113
|
+
color: var(--oc-red-9);
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.threadMoveForm__actions {
|
|
118
|
+
align-items: center;
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: flex-end;
|
|
121
|
+
gap: 1rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
107
124
|
@media screen and (max-width: 1024px) {
|
|
108
125
|
.thread {
|
|
109
126
|
flex-direction: column;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function initMarkdownEditor(element) {
|
|
2
|
+
var editor = new TinyMDE.Editor({
|
|
3
|
+
textarea: element,
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
var toolbarElement = document.createElement("div");
|
|
7
|
+
toolbarElement.id = "markdown-editor-toolbar";
|
|
8
|
+
element.parentNode.insertBefore(toolbarElement, element);
|
|
9
|
+
|
|
10
|
+
new TinyMDE.CommandBar({
|
|
11
|
+
element: toolbarElement,
|
|
12
|
+
editor: editor,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
$(function () {
|
|
17
|
+
$(document).ready(function () {
|
|
18
|
+
var editorElements = document.querySelectorAll(".markdown-editor");
|
|
19
|
+
editorElements.forEach((element) => {
|
|
20
|
+
initMarkdownEditor(element);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2020": true
|
|
5
|
+
},
|
|
6
|
+
"extends": ["eslint:recommended"],
|
|
7
|
+
"parserOptions": {
|
|
8
|
+
"ecmaVersion": 2019,
|
|
9
|
+
"sourceType": "module"
|
|
10
|
+
},
|
|
11
|
+
"ignorePatterns": ["gulpfile.js", "jest*.config.js", "jest/**/*.js", "node_modules/"],
|
|
12
|
+
"rules": {
|
|
13
|
+
"no-fallthrough": "off"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
|
|
9
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
10
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
11
|
+
|
|
12
|
+
# Runtime data
|
|
13
|
+
pids
|
|
14
|
+
*.pid
|
|
15
|
+
*.seed
|
|
16
|
+
*.pid.lock
|
|
17
|
+
|
|
18
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
19
|
+
lib-cov
|
|
20
|
+
|
|
21
|
+
# Coverage directory used by tools like istanbul
|
|
22
|
+
coverage
|
|
23
|
+
*.lcov
|
|
24
|
+
|
|
25
|
+
# nyc test coverage
|
|
26
|
+
.nyc_output
|
|
27
|
+
|
|
28
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
29
|
+
.grunt
|
|
30
|
+
|
|
31
|
+
# Bower dependency directory (https://bower.io/)
|
|
32
|
+
bower_components
|
|
33
|
+
|
|
34
|
+
# node-waf configuration
|
|
35
|
+
.lock-wscript
|
|
36
|
+
|
|
37
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
38
|
+
build/Release
|
|
39
|
+
|
|
40
|
+
# Dependency directories
|
|
41
|
+
node_modules/
|
|
42
|
+
jspm_packages/
|
|
43
|
+
|
|
44
|
+
# TypeScript v1 declaration files
|
|
45
|
+
typings/
|
|
46
|
+
|
|
47
|
+
# TypeScript cache
|
|
48
|
+
*.tsbuildinfo
|
|
49
|
+
|
|
50
|
+
# Optional npm cache directory
|
|
51
|
+
.npm
|
|
52
|
+
|
|
53
|
+
# Optional eslint cache
|
|
54
|
+
.eslintcache
|
|
55
|
+
|
|
56
|
+
# Microbundle cache
|
|
57
|
+
.rpt2_cache/
|
|
58
|
+
.rts2_cache_cjs/
|
|
59
|
+
.rts2_cache_es/
|
|
60
|
+
.rts2_cache_umd/
|
|
61
|
+
|
|
62
|
+
# Optional REPL history
|
|
63
|
+
.node_repl_history
|
|
64
|
+
|
|
65
|
+
# Output of 'npm pack'
|
|
66
|
+
*.tgz
|
|
67
|
+
|
|
68
|
+
# Yarn Integrity file
|
|
69
|
+
.yarn-integrity
|
|
70
|
+
|
|
71
|
+
# dotenv environment variables file
|
|
72
|
+
.env
|
|
73
|
+
.env.test
|
|
74
|
+
|
|
75
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
76
|
+
.cache
|
|
77
|
+
|
|
78
|
+
# Next.js build output
|
|
79
|
+
.next
|
|
80
|
+
|
|
81
|
+
# Nuxt.js build / generate output
|
|
82
|
+
.nuxt
|
|
83
|
+
dist
|
|
84
|
+
|
|
85
|
+
# Gatsby files
|
|
86
|
+
.cache/
|
|
87
|
+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
|
88
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
89
|
+
# public
|
|
90
|
+
|
|
91
|
+
# vuepress build output
|
|
92
|
+
.vuepress/dist
|
|
93
|
+
|
|
94
|
+
# Serverless directories
|
|
95
|
+
.serverless/
|
|
96
|
+
|
|
97
|
+
# FuseBox cache
|
|
98
|
+
.fusebox/
|
|
99
|
+
|
|
100
|
+
# DynamoDB Local files
|
|
101
|
+
.dynamodb/
|
|
102
|
+
|
|
103
|
+
# TernJS port file
|
|
104
|
+
.tern-port
|
|
105
|
+
|
|
106
|
+
.DS_Store
|
|
107
|
+
|
|
108
|
+
lib
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Jens-Fabian Goetzmann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|