Skip to content
Commits on Source (26)
......@@ -2,7 +2,6 @@ module.exports = {
extends: [
"eslint:recommended",
"plugin:vue/strongly-recommended",
// "plugin:prettier/recommended",
"plugin:@intlify/vue-i18n/recommended",
],
rules: {
......
......@@ -6,6 +6,19 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.
`3.1`_ – 2023-07-17
-------------------
Added
~~~~~
* Support public live documents
Fixed
~~~~~
* API urls were in the wrong namespace.
`3.0`_ - 2023-05-12
-------------------
......@@ -111,3 +124,4 @@ Added
.. _3.0b1: https://edugit.org/AlekSIS/official/AlekSIS-App-Resint/-/tags/3.0b1
.. _3.0b2: https://edugit.org/AlekSIS/official/AlekSIS-App-Resint/-/tags/3.0b2
.. _3.0: https://edugit.org/AlekSIS/official/AlekSIS-App-Resint/-/tags/3.0
.. _3.1: https://edugit.org/AlekSIS/official/AlekSIS-App-Resint/-/tags/3.1
......@@ -44,14 +44,6 @@ export default {
byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true,
},
},
{
path: ":slug.pdf",
component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"),
name: "resint.posterShowCurrent",
props: {
byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true,
},
},
{
path: "groups/",
component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"),
......@@ -128,21 +120,5 @@ export default {
byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true,
},
},
{
path: "live_documents/:slug.pdf",
component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"),
name: "resint.showLiveDocument",
props: {
byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true,
},
},
{
path: "api/live_documents/:slug.pdf",
component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"),
name: "resint.apiShowLiveDocument",
props: {
byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true,
},
},
],
};
......@@ -8,17 +8,14 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-04-23 12:52+0000\n"
"PO-Revision-Date: 2022-06-12 05:32+0000\n"
"PO-Revision-Date: 2023-05-26 04:38+0000\n"
"Last-Translator: Serhii Horichenko <m@sgg.im>\n"
"Language-Team: Russian <https://translate.edugit.org/projects/aleksis/"
"aleksis-app-resint/ru/>\n"
"Language-Team: Russian <https://translate.edugit.org/projects/aleksis/aleksis-app-resint/ru/>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n"
"%100>=11 && n%100<=14)? 2 : 3);\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
"X-Generator: Weblate 4.12.1\n"
#: aleksis/apps/resint/apps.py:27
......@@ -56,7 +53,7 @@ msgstr "При использовании 'пример' имя файла бу
#: aleksis/apps/resint/models.py:28 aleksis/apps/resint/models.py:163
#: aleksis/apps/resint/templates/resint/group/list.html:19
msgid "Name"
msgstr "Имя"
msgstr "Полное имя"
#: aleksis/apps/resint/models.py:30
msgid "Publishing weekday"
......
# Generated by Django 3.2.18 on 2023-05-17 20:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resint', '0007_current_file_not_null'),
]
operations = [
migrations.AddField(
model_name='livedocument',
name='public',
field=models.BooleanField(default=False, verbose_name='Show for not logged-in users'),
),
]
......@@ -196,6 +196,7 @@ class LiveDocument(ExtensiblePolymorphicModel):
help_text=_("This will be used for the name of the current PDF file."),
)
name = models.CharField(max_length=255, verbose_name=_("Name"))
public = models.BooleanField(default=False, verbose_name=_("Show for not logged-in users"))
current_file = models.FileField(
upload_to="live_documents/",
......@@ -207,6 +208,17 @@ class LiveDocument(ExtensiblePolymorphicModel):
default=False, verbose_name=_("Was the last update triggered manually?"), editable=False
)
class Meta:
verbose_name = _("Live document")
verbose_name_plural = _("Live documents")
def __str__(self) -> str:
return self.name
def save(self, *args, **kwargs):
with reversion.create_revision():
super().save(*args, **kwargs)
@property
def last_version(self) -> Optional[Revision]:
"""Get django-reversion version of last file update."""
......@@ -239,10 +251,6 @@ class LiveDocument(ExtensiblePolymorphicModel):
"""Return OAuth2 scope name to access PDF file via API."""
return f"{self.SCOPE_PREFIX}_{self.slug}"
def save(self, *args, **kwargs):
with reversion.create_revision():
super().save(*args, **kwargs)
def get_context_data(self) -> dict[str, Any]:
"""Get context to pass to the PDF template."""
return {}
......@@ -263,10 +271,3 @@ class LiveDocument(ExtensiblePolymorphicModel):
self.last_update_triggered_manually = triggered_manually
self.current_file.save(self.filename, file_object.file.file)
self.save()
def __str__(self) -> str:
return self.name
class Meta:
verbose_name = _("Live document")
verbose_name_plural = _("Live documents")
......@@ -3,7 +3,7 @@ from django.http import HttpRequest
from rules import add_perm, predicate
from aleksis.apps.resint.models import Poster, PosterGroup
from aleksis.apps.resint.models import LiveDocument, Poster, PosterGroup
from aleksis.core.util.predicates import (
check_object_permission,
has_any_object,
......@@ -31,7 +31,7 @@ def permission_validator(request: HttpRequest, perm: str, obj) -> bool:
@predicate
def is_public_poster_group(user: User, obj: PosterGroup):
def is_public(user: User, obj: [LiveDocument, PosterGroup]):
return obj.public
......@@ -96,7 +96,7 @@ delete_poster_predicate = view_posters_predicate & (
add_perm("resint.delete_poster_rule", delete_poster_predicate)
# View poster PDF file
view_poster_pdf_predicate = is_public_poster_group | (
view_poster_pdf_predicate = is_public | (
has_person
& (has_global_perm("resint.view_postergroup") | has_global_perm("resint.view_poster"))
)
......@@ -118,8 +118,9 @@ view_live_documents_predicate = has_person & has_global_perm("resint.view_livedo
add_perm("resint.view_livedocuments_rule", view_live_documents_predicate)
# View live document
view_live_document_predicate = has_person & (
has_global_perm("resint.view_livedocument") | has_object_perm("resint.view_livedocument")
view_live_document_predicate = is_public | (
has_person
& (has_global_perm("resint.view_livedocument") | has_object_perm("resint.view_livedocument"))
)
add_perm("resint.view_livedocument_rule", view_live_document_predicate)
......
......@@ -23,7 +23,6 @@ urlpatterns = [
path("upload/", PosterUploadView.as_view(), name="poster_upload"),
path("<int:pk>/edit/", PosterEditView.as_view(), name="poster_edit"),
path("<int:pk>/delete/", PosterDeleteView.as_view(), name="poster_delete"),
path("<str:slug>.pdf", PosterCurrentView.as_view(), name="poster_show_current"),
path("groups/", PosterGroupListView.as_view(), name="poster_group_list"),
path("groups/create/", PosterGroupCreateView.as_view(), name="create_poster_group"),
path("groups/<int:pk>/edit/", PosterGroupEditView.as_view(), name="edit_poster_group"),
......@@ -44,6 +43,10 @@ urlpatterns = [
LiveDocumentDeleteView.as_view(),
name="delete_live_document",
),
]
api_urlpatterns = [
path("<str:slug>.pdf", PosterCurrentView.as_view(), name="poster_show_current"),
path(
"live_documents/<str:slug>.pdf",
LiveDocumentShowView.as_view(),
......
......@@ -29,9 +29,9 @@ copyright = "2018-2022 The AlekSIS team"
author = "The AlekSIS Team"
# The short X.Y version
version = "3.0"
version = "3.1"
# The full version, including alpha/beta/rc tags
release = "3.0"
release = "3.1"
# -- General configuration ---------------------------------------------------
......
[tool.poetry]
name = "AlekSIS-App-Resint"
version = "3.0"
version = "3.1"
packages = [
{ include = "aleksis" }
]
......@@ -20,12 +20,9 @@ authors = [
"Frank Poetzsch-Heffter <p-h@katharineum.de>",
"Jonathan Weth <dev@jonathanweth.de>"
]
maintainers = [
"Jonathan Weth <dev@jonathanweth.de>",
"Dominik George <dominik.george@teckids.org>"
]
maintainers = ["Jonathan Weth <dev@jonathanweth.de>", "Dominik George <dominik.george@teckids.org>"]
license = "EUPL-1.2-or-later"
homepage = "https://aleksis.org/"
homepage = "https://aleksis.org"
repository = "https://edugit.org/AlekSIS/official/AlekSIS-App-Resint"
classifiers = [
"Development Status :: 5 - Production/Stable",
......@@ -34,25 +31,67 @@ classifiers = [
"Topic :: Education"
]
[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
[[tool.poetry.source]]
name = "gitlab"
url = "https://edugit.org/api/v4/projects/461/packages/pypi/simple"
secondary = true
priority = "supplemental"
[tool.poetry.dependencies]
python = "^3.9"
AlekSIS-Core = "^3.0"
[tool.poetry.dev-dependencies]
aleksis-builddeps = "*"
[tool.poetry.plugins."aleksis.app"]
resint = "aleksis.apps.resint.apps:ResintConfig"
[tool.poetry.group.dev.dependencies]
django-stubs = "^4.2"
safety = "^2.3.5"
flake8 = "^6.0.0"
flake8-django = "^1.0.0"
flake8-fixme = "^1.1.1"
flake8-mypy = "^17.8.0"
flake8-bandit = "^4.1.1"
flake8-builtins = "^2.0.0"
flake8-docstrings = "^1.5.0"
flake8-rst-docstrings = "^0.3.0"
black = ">=21.0"
flake8-black = "^0.3.0"
isort = "^5.0.0"
flake8-isort = "^6.0.0"
curlylint = "^0.13.0"
[tool.poetry.group.test.dependencies]
pytest = "^7.2"
pytest-django = "^4.1"
pytest-django-testing-postgresql = "^0.2"
pytest-cov = "^4.0.0"
pytest-sugar = "^0.9.2"
selenium = "<4.10.0"
freezegun = "^1.1.0"
[tool.poetry.group.docs]
optional = true
[tool.poetry.group.docs.dependencies]
sphinx = "^7.0"
sphinxcontrib-django = "^2.3.0"
sphinxcontrib-svg2pdfconverter = "^1.1.1"
sphinx-autodoc-typehints = "^1.7"
sphinx_material = "^0.0.35"
[tool.black]
line-length = 100
exclude = "/migrations/"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"