lino 25.8.1__py3-none-any.whl → 25.8.3__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.
- lino/__init__.py +1 -1
- lino/config/unused/403.html +1 -1
- lino/config/unused/404.html +1 -1
- lino/config/unused/500.html +1 -1
- lino/core/actions.py +1 -1
- lino/core/actors.py +2 -2
- lino/core/elems.py +1 -1
- lino/core/kernel.py +5 -1
- lino/core/renderer.py +2 -2
- lino/core/requests.py +4 -5
- lino/core/site.py +5 -3
- lino/core/store.py +3 -1
- lino/core/urls.py +1 -1
- lino/help_texts.py +9 -5
- lino/modlib/__init__.py +1 -1
- lino/modlib/bootstrap5/README.txt +2 -0
- lino/modlib/{bootstrap3 → bootstrap5}/__init__.py +6 -6
- lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/base.html +5 -4
- lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/detail.html +1 -1
- lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/index.html +1 -1
- lino/modlib/{bootstrap3/config/bootstrap3 → bootstrap5/config/bootstrap5}/table.html +1 -1
- lino/modlib/{bootstrap3 → bootstrap5}/models.py +2 -2
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.css +4085 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.css +4084 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-grid.rtl.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.css +597 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.css +594 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-reboot.rtl.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.css +5406 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.css +5397 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap-utilities.rtl.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.css +12043 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.css +12016 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.min.css +6 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/css/bootstrap.rtl.min.css.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.js +6315 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.js.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.min.js +7 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.bundle.min.js.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.js +4450 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.js.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.min.js +7 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.esm.min.js.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.js +4497 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.js.map +1 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.min.js +7 -0
- lino/modlib/bootstrap5/static/bootstrap-5.3.7/js/bootstrap.min.js.map +1 -0
- lino/modlib/{bootstrap3 → bootstrap5}/views.py +10 -10
- lino/modlib/comments/__init__.py +0 -8
- lino/modlib/comments/mixins.py +2 -9
- lino/modlib/comments/models.py +5 -20
- lino/modlib/extjs/__init__.py +1 -1
- lino/modlib/jinja/renderer.py +1 -1
- lino/modlib/memo/__init__.py +1 -2
- lino/modlib/odata/views.py +7 -7
- lino/modlib/publisher/__init__.py +9 -2
- lino/modlib/publisher/choicelists.py +12 -43
- lino/modlib/publisher/config/publisher/page.pub.html +10 -13
- lino/modlib/publisher/fixtures/synodalworld.py +3 -1
- lino/modlib/publisher/mixins.py +28 -75
- lino/modlib/publisher/models.py +49 -143
- lino/modlib/publisher/renderer.py +6 -2
- lino/modlib/publisher/ui.py +23 -75
- lino/modlib/publisher/views.py +30 -15
- lino/modlib/users/__init__.py +8 -0
- lino/modlib/users/fixtures/abc.py +20 -0
- lino/modlib/users/mixins.py +56 -2
- lino/modlib/weasyprint/__init__.py +25 -14
- lino/modlib/weasyprint/config/weasyprint/base.weasy.html +43 -27
- {lino-25.8.1.dist-info → lino-25.8.3.dist-info}/METADATA +1 -1
- {lino-25.8.1.dist-info → lino-25.8.3.dist-info}/RECORD +104 -64
- lino/modlib/bootstrap3/README.txt +0 -2
- lino/modlib/bootstrap3/static/bootstrap-3.3.4/css/bootstrap.css +0 -6584
- lino/modlib/bootstrap3/static/bootstrap-3.3.4/css/bootstrap.css.map +0 -1
- lino/modlib/bootstrap3/static/bootstrap-3.3.4/css/bootstrap.min.css +0 -5
- lino/modlib/bootstrap3/static/bootstrap-3.3.4/js/bootstrap.js +0 -2317
- lino/modlib/bootstrap3/static/bootstrap-3.3.4/js/bootstrap.min.js +0 -7
- /lino/modlib/{bootstrap3 → bootstrap5}/renderer.py +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/css/bootstrap-theme.css +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/css/bootstrap-theme.css.map +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/css/bootstrap-theme.min.css +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.eot +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.svg +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.ttf +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.woff +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/fonts/glyphicons-halflings-regular.woff2 +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/js/bootstrap_lino.js +0 -0
- /lino/modlib/{bootstrap3/static/bootstrap-3.3.4 → bootstrap5/static/bootstrap-5.3.7}/js/npm.js +0 -0
- {lino-25.8.1.dist-info → lino-25.8.3.dist-info}/WHEEL +0 -0
- {lino-25.8.1.dist-info → lino-25.8.3.dist-info}/licenses/AUTHORS.rst +0 -0
- {lino-25.8.1.dist-info → lino-25.8.3.dist-info}/licenses/COPYING +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: UTF-8 -*-
|
2
2
|
# Copyright 2009-2020 Rumma & Ko Ltd
|
3
3
|
# License: GNU Affero General Public License v3 (see file COPYING for details)
|
4
|
-
"""Views for `lino.modlib.
|
4
|
+
"""Views for `lino.modlib.bootstrap5`.
|
5
5
|
|
6
6
|
"""
|
7
7
|
from past.utils import old_div
|
@@ -42,12 +42,12 @@ def http_response(ar, tplname, context):
|
|
42
42
|
menu = MENUS.get(k, None)
|
43
43
|
if menu is None:
|
44
44
|
menu = settings.SITE.get_site_menu(u.user_type)
|
45
|
-
|
45
|
+
bs5 = settings.SITE.plugins.bootstrap5
|
46
46
|
if False: # 20150803 home button now in base.html
|
47
|
-
assert
|
48
|
-
url =
|
47
|
+
assert bs5.renderer is not None
|
48
|
+
url = bs5.build_plain_url()
|
49
49
|
menu.add_url_button(url, label=_("Home"))
|
50
|
-
e =
|
50
|
+
e = bs5.renderer.show_menu(ar, menu)
|
51
51
|
menu = tostring(e)
|
52
52
|
MENUS[k] = menu
|
53
53
|
context.update(menu=menu)
|
@@ -184,7 +184,7 @@ class List(View):
|
|
184
184
|
|
185
185
|
def get(self, request, app_label=None, actor=None):
|
186
186
|
ar = action_request(app_label, actor, request, request.GET, True)
|
187
|
-
ar.renderer = settings.SITE.plugins.
|
187
|
+
ar.renderer = settings.SITE.plugins.bootstrap5.renderer
|
188
188
|
|
189
189
|
context = dict(
|
190
190
|
title=ar.get_title(),
|
@@ -207,7 +207,7 @@ class Element(View):
|
|
207
207
|
def get(self, request, app_label=None, actor=None, pk=None):
|
208
208
|
# print(request, app_label, actor, pk)
|
209
209
|
ar = action_request(app_label, actor, request, request.GET, False)
|
210
|
-
ar.renderer = settings.SITE.plugins.
|
210
|
+
ar.renderer = settings.SITE.plugins.bootstrap5.renderer
|
211
211
|
|
212
212
|
navigator = None
|
213
213
|
if pk and pk != "-99999" and pk != "-99998":
|
@@ -317,7 +317,7 @@ class Index(View):
|
|
317
317
|
def get(self, request, *args, **kw):
|
318
318
|
# raise Exception("20171122 {} {}".format(
|
319
319
|
# get_language(), settings.MIDDLEWARE_CLASSES))
|
320
|
-
ui = settings.SITE.plugins.
|
320
|
+
ui = settings.SITE.plugins.bootstrap5
|
321
321
|
# print("20170607", request.user)
|
322
322
|
# assert ui.renderer is not None
|
323
323
|
ar = BaseRequest(
|
@@ -329,7 +329,7 @@ class Index(View):
|
|
329
329
|
|
330
330
|
|
331
331
|
def index_response(ar):
|
332
|
-
ui = settings.SITE.plugins.
|
332
|
+
ui = settings.SITE.plugins.bootstrap5
|
333
333
|
main = settings.SITE.get_main_html(ar, front_end=ui)
|
334
334
|
main = ui.renderer.html_text(main)
|
335
335
|
context = dict(
|
@@ -341,4 +341,4 @@ def index_response(ar):
|
|
341
341
|
# else:
|
342
342
|
# user = request.subst_user or request.user
|
343
343
|
# context.update(ar=ar)
|
344
|
-
return http_response(ar, "
|
344
|
+
return http_response(ar, "bootstrap5/index.html", context)
|
lino/modlib/comments/__init__.py
CHANGED
@@ -22,14 +22,6 @@ class Plugin(ad.Plugin):
|
|
22
22
|
"""Which range of emotion icons to provide. Either "business" or "social".
|
23
23
|
"""
|
24
24
|
|
25
|
-
private_default = True
|
26
|
-
"""Whether comments are private by default.
|
27
|
-
|
28
|
-
The default value for the :attr:`lino.modlib.comments.Comment.private`
|
29
|
-
field.
|
30
|
-
|
31
|
-
"""
|
32
|
-
|
33
25
|
def setup_main_menu(self, site, user_type, m, ar=None):
|
34
26
|
mg = site.plugins.office
|
35
27
|
m = m.add_menu(mg.app_label, mg.verbose_name)
|
lino/modlib/comments/mixins.py
CHANGED
@@ -102,9 +102,6 @@ class Commentable(MemoReferrable):
|
|
102
102
|
def get_rfc_description(self, ar):
|
103
103
|
return ""
|
104
104
|
|
105
|
-
# def get_comment_group(self):
|
106
|
-
# return None
|
107
|
-
|
108
105
|
if dd.is_installed("comments"):
|
109
106
|
|
110
107
|
def save_new_instance(self, ar):
|
@@ -123,12 +120,8 @@ class Commentable(MemoReferrable):
|
|
123
120
|
return _("Created new {model} {obj}.").format(
|
124
121
|
model=self.__class__._meta.verbose_name, obj=self)
|
125
122
|
|
126
|
-
# @classmethod
|
127
|
-
# def add_comments_filter(cls, qs, ar):
|
128
|
-
# return qs
|
129
|
-
|
130
123
|
def get_comment_group(self):
|
131
|
-
|
124
|
+
return None # dd.plugins.groups.get_default_group()
|
132
125
|
|
133
126
|
def on_create_comment(self, comment, ar):
|
134
|
-
|
127
|
+
pass
|
lino/modlib/comments/models.py
CHANGED
@@ -19,12 +19,12 @@ from lino.core.requests import BaseRequest
|
|
19
19
|
from lino.mixins import CreatedModified, BabelNamed
|
20
20
|
from lino.mixins.periods import DateRangeObservable
|
21
21
|
from lino.modlib.users.mixins import UserAuthored
|
22
|
+
from lino.modlib.users.mixins import PrivacyRelevant
|
22
23
|
from lino.modlib.notify.mixins import ChangeNotifier
|
23
24
|
from lino.modlib.search.mixins import ElasticSearchable
|
24
25
|
from lino.modlib.gfks.mixins import Controllable
|
25
26
|
from lino.modlib.memo.mixins import Previewable, MemoReferrable
|
26
27
|
from lino.modlib.publisher.mixins import Publishable
|
27
|
-
from lino_xl.lib.groups.mixins import Groupwise
|
28
28
|
from .choicelists import CommentEvents, Emotions
|
29
29
|
from .mixins import Commentable, MyEmotionField
|
30
30
|
from .roles import CommentsReader, CommentsStaff
|
@@ -50,7 +50,7 @@ class Comment(
|
|
50
50
|
Publishable,
|
51
51
|
DateRangeObservable,
|
52
52
|
MemoReferrable,
|
53
|
-
|
53
|
+
PrivacyRelevant
|
54
54
|
):
|
55
55
|
class Meta:
|
56
56
|
app_label = "comments"
|
@@ -120,9 +120,6 @@ class Comment(
|
|
120
120
|
)
|
121
121
|
# more_text = dd.RichTextField(_("More text"), blank=True)
|
122
122
|
|
123
|
-
private = models.BooleanField(
|
124
|
-
_("Confidential"), default=dd.plugins.comments.private_default)
|
125
|
-
|
126
123
|
comment_type = dd.ForeignKey("comments.CommentType", blank=True, null=True)
|
127
124
|
# reply_vote = models.BooleanField(_("Upvote"), null=True, blank=True)
|
128
125
|
# reply_vote = models.SmallIntegerField(_("Vote"), default=0,
|
@@ -288,8 +285,10 @@ class Comment(
|
|
288
285
|
self.owner.on_create_comment(self, ar)
|
289
286
|
|
290
287
|
def get_default_group(self):
|
291
|
-
|
288
|
+
# implements PrivacyRelevant
|
289
|
+
if self.owner:
|
292
290
|
return self.owner.get_comment_group()
|
291
|
+
return super().get_default_group()
|
293
292
|
|
294
293
|
def after_ui_save(self, ar, cw):
|
295
294
|
super().after_ui_save(ar, cw)
|
@@ -356,15 +355,6 @@ class Comment(
|
|
356
355
|
user = ar.get_user()
|
357
356
|
if not user.user_type.has_required_roles([CommentsReader]):
|
358
357
|
return qs.none()
|
359
|
-
if user.is_anonymous:
|
360
|
-
qs = qs.filter(private=False)
|
361
|
-
elif not user.user_type.has_required_roles([CommentsStaff]):
|
362
|
-
qs = qs.filter(Q(private=False) | Q(user=user))
|
363
|
-
|
364
|
-
# sar = BaseRequest(user=ar.get_user())
|
365
|
-
# for m in rt.models_by_base(Commentable):
|
366
|
-
# qs = m.add_comments_filter(qs, sar)
|
367
|
-
|
368
358
|
qs = qs.annotate(num_replies=models.Count("replies_to_this"))
|
369
359
|
qs = qs.annotate(num_reactions=models.Count("reactions_to_this"))
|
370
360
|
# qs = qs.annotate(my_emotion='reaction__emotion')
|
@@ -374,11 +364,6 @@ class Comment(
|
|
374
364
|
qs = pv.observed_event.add_filter(qs, pv)
|
375
365
|
return qs
|
376
366
|
|
377
|
-
# @classmethod
|
378
|
-
# def get_request_queryset(cls, ar, **filter):
|
379
|
-
# qs = super().get_request_queryset(ar, **filter)
|
380
|
-
# return qs
|
381
|
-
|
382
367
|
# @dd.htmlbox()
|
383
368
|
# def card_summary(self, ar):
|
384
369
|
# if not ar:
|
lino/modlib/extjs/__init__.py
CHANGED
@@ -28,7 +28,7 @@ from django.utils.translation import gettext_lazy as _
|
|
28
28
|
class Plugin(Plugin):
|
29
29
|
"""Extends :class:`lino.core.plugin.Plugin`."""
|
30
30
|
|
31
|
-
needs_plugins = ["lino.modlib.
|
31
|
+
needs_plugins = ["lino.modlib.bootstrap5"]
|
32
32
|
|
33
33
|
enter_submits_form = False
|
34
34
|
"""Whether the :kbd:`ENTER` key (or :kbd:`CTRL+ENTER` when in a
|
lino/modlib/jinja/renderer.py
CHANGED
lino/modlib/memo/__init__.py
CHANGED
@@ -46,7 +46,7 @@ class Plugin(ad.Plugin):
|
|
46
46
|
front_end = None
|
47
47
|
# front_end = 'extjs'
|
48
48
|
# front_end = 'lino_react.react'
|
49
|
-
# front_end = '
|
49
|
+
# front_end = 'bootstrap5'
|
50
50
|
"""The front end to use when writing previews.
|
51
51
|
|
52
52
|
If this is `None`, Lino will use the default :term:`front end`
|
@@ -147,7 +147,6 @@ class Plugin(ad.Plugin):
|
|
147
147
|
# break
|
148
148
|
|
149
149
|
def get_patterns(self):
|
150
|
-
# from django.conf.urls import url
|
151
150
|
from django.urls import re_path as url
|
152
151
|
from . import views
|
153
152
|
|
lino/modlib/odata/views.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: UTF-8 -*-
|
2
2
|
# Copyright 2009-2017 Rumma & Ko Ltd
|
3
3
|
# License: GNU Affero General Public License v3 (see file COPYING for details)
|
4
|
-
"""Views for `lino.modlib.
|
4
|
+
"""Views for `lino.modlib.bootstrap5`.
|
5
5
|
|
6
6
|
"""
|
7
7
|
from __future__ import division
|
@@ -26,14 +26,14 @@ from lino.core.requests import BaseRequest
|
|
26
26
|
from lino.core.tables import AbstractTable
|
27
27
|
from lino.core.views import action_request
|
28
28
|
from lino.core.utils import navinfo
|
29
|
-
from lino.modlib.
|
29
|
+
from lino.modlib.bootstrap5.views import http_response
|
30
30
|
from lino.utils.html import E
|
31
31
|
|
32
32
|
|
33
33
|
class List(View):
|
34
34
|
def get(self, request, app_label=None, actor=None):
|
35
35
|
ar = action_request(app_label, actor, request, request.GET, True)
|
36
|
-
ar.renderer = settings.SITE.plugins.
|
36
|
+
ar.renderer = settings.SITE.plugins.bootstrap5.renderer
|
37
37
|
|
38
38
|
context = dict(
|
39
39
|
title=ar.get_title(),
|
@@ -53,7 +53,7 @@ class Element(View):
|
|
53
53
|
def get(self, request, app_label=None, actor=None, pk=None):
|
54
54
|
# print(request, app_label, actor, pk)
|
55
55
|
ar = action_request(app_label, actor, request, request.GET, False)
|
56
|
-
ar.renderer = settings.SITE.plugins.
|
56
|
+
ar.renderer = settings.SITE.plugins.bootstrap5.renderer
|
57
57
|
|
58
58
|
navigator = None
|
59
59
|
if pk and pk != "-99999" and pk != "-99998":
|
@@ -160,7 +160,7 @@ class Index(View):
|
|
160
160
|
def get(self, request, *args, **kw):
|
161
161
|
# raise Exception("20171122 {} {}".format(
|
162
162
|
# get_language(), settings.MIDDLEWARE_CLASSES))
|
163
|
-
ui = settings.SITE.plugins.
|
163
|
+
ui = settings.SITE.plugins.bootstrap5
|
164
164
|
# print("20170607", request.user)
|
165
165
|
# assert ui.renderer is not None
|
166
166
|
ar = BaseRequest(
|
@@ -172,7 +172,7 @@ class Index(View):
|
|
172
172
|
|
173
173
|
|
174
174
|
def index_response(ar):
|
175
|
-
ui = settings.SITE.plugins.
|
175
|
+
ui = settings.SITE.plugins.bootstrap5
|
176
176
|
|
177
177
|
main = settings.SITE.get_main_html(ar, front_end=ui)
|
178
178
|
main = ui.renderer.html_text(main)
|
@@ -185,7 +185,7 @@ def index_response(ar):
|
|
185
185
|
# else:
|
186
186
|
# user = request.subst_user or request.user
|
187
187
|
# context.update(ar=ar)
|
188
|
-
return http_response(ar, "
|
188
|
+
return http_response(ar, "bootstrap5/index.html", context)
|
189
189
|
|
190
190
|
|
191
191
|
class Metadata(View):
|
@@ -10,7 +10,7 @@ class Plugin(Plugin):
|
|
10
10
|
"lino.modlib.system", # 'lino.modlib.memo',
|
11
11
|
"lino.modlib.linod",
|
12
12
|
"lino.modlib.jinja",
|
13
|
-
"lino.modlib.
|
13
|
+
"lino.modlib.bootstrap5",
|
14
14
|
]
|
15
15
|
locations: list[tuple[str, str]] = []
|
16
16
|
|
@@ -47,10 +47,12 @@ class Plugin(Plugin):
|
|
47
47
|
for location, table_class in self.locations:
|
48
48
|
yield url(
|
49
49
|
f"^{location}/(?P<pk>.+)$",
|
50
|
+
# f"^{location}/<int:pk>$",
|
50
51
|
views.Element.as_view(table_class=table_class))
|
51
52
|
|
52
53
|
# Only if this is the primary front end:
|
53
|
-
if self.site.kernel.
|
54
|
+
if self.site.kernel.primary_front_end is self:
|
55
|
+
# yield url("^(?P<ref>.*)$", views.Index.as_view())
|
54
56
|
yield url("^$", views.Index.as_view())
|
55
57
|
# yield url('^login$',views.Login.as_view())
|
56
58
|
|
@@ -63,3 +65,8 @@ class Plugin(Plugin):
|
|
63
65
|
mg = self.get_menu_group()
|
64
66
|
m = m.add_menu(mg.app_label, mg.verbose_name)
|
65
67
|
m.add_action("publisher.SpecialPages")
|
68
|
+
|
69
|
+
def setup_explorer_menu(self, site, user_type, m, ar=None):
|
70
|
+
mg = self.get_menu_group()
|
71
|
+
m = m.add_menu(mg.app_label, mg.verbose_name)
|
72
|
+
m.add_action("publisher.RootPages")
|
@@ -57,42 +57,6 @@ class PublisherBuildMethod(JinjaBuildMethod):
|
|
57
57
|
|
58
58
|
BuildMethods.add_item_instance(PublisherBuildMethod())
|
59
59
|
|
60
|
-
# class PublisherView(dd.Choice):
|
61
|
-
# table_class = None # TODO: rename this to data_view
|
62
|
-
#
|
63
|
-
# def __init__(self, location, table_class, text=None):
|
64
|
-
# self.table_class = table_class
|
65
|
-
# self.publisher_location = location
|
66
|
-
# # model = dd.resolve_model(table_class.model)
|
67
|
-
# # self.model = model
|
68
|
-
# # value = dd.full_model_name(model)
|
69
|
-
# value = str(table_class)
|
70
|
-
# if text is None:
|
71
|
-
# text = format_lazy("{} ({})", location, table_class)
|
72
|
-
# # text = model._meta.verbose_name + ' (%s)' % dd.full_model_name(model)
|
73
|
-
# # text = model._meta.verbose_name + ' (%s.%s)' % (
|
74
|
-
# # text = format_lazy("{} ({})", model._meta.verbose_name, value)
|
75
|
-
# # model.__module__, model.__name__)
|
76
|
-
# name = None
|
77
|
-
# super().__init__(value, text, name)
|
78
|
-
#
|
79
|
-
# def get_publisher_pages(self):
|
80
|
-
# return self.table_class.model.objects.all()
|
81
|
-
|
82
|
-
# class PublisherViews(dd.ChoiceList):
|
83
|
-
# item_class = PublisherView
|
84
|
-
# verbose_name = _("Publisher view")
|
85
|
-
# verbose_name_plural = _("Publisher views")
|
86
|
-
# column_names = "location value name text data_view *"
|
87
|
-
#
|
88
|
-
# @dd.virtualfield(models.CharField(_("Location")))
|
89
|
-
# def location(cls, choice, ar):
|
90
|
-
# return choice.publisher_location
|
91
|
-
#
|
92
|
-
# @dd.virtualfield(models.CharField(_("Data table")))
|
93
|
-
# def data_view(cls, choice, ar):
|
94
|
-
# return choice.table_class
|
95
|
-
|
96
60
|
|
97
61
|
class PublishingState(RegistrableState):
|
98
62
|
# is_published = False
|
@@ -142,14 +106,19 @@ add("40", _("Removed"), "removed", is_public=False)
|
|
142
106
|
class PageFiller(Choice):
|
143
107
|
data_view = None
|
144
108
|
|
145
|
-
def __init__(self, data_view,
|
146
|
-
|
147
|
-
|
109
|
+
def __init__(self, data_view=None, **request_params):
|
110
|
+
if data_view is not None:
|
111
|
+
self.data_view = data_view
|
112
|
+
self.request_params = request_params
|
113
|
+
super().__init__(str(self.data_view))
|
114
|
+
|
115
|
+
def create_request(self, ar, obj, **kwargs):
|
116
|
+
kwargs.update(self.request_params, parent=ar)
|
117
|
+
return self.data_view.create_request(**kwargs)
|
148
118
|
|
149
119
|
def get_dynamic_story(self, ar, obj, **kwargs):
|
150
120
|
txt = ""
|
151
|
-
|
152
|
-
sar = dv.create_request(parent=ar, limit=dv.preview_limit)
|
121
|
+
sar = self.create_request(ar, obj, limit=self.data_view.preview_limit)
|
153
122
|
# print("20231028", dv, list(sar))
|
154
123
|
# print("20230409", ar.renderer)
|
155
124
|
# rv += "20230325 [show {}]".format(dv)
|
@@ -158,9 +127,9 @@ class PageFiller(Choice):
|
|
158
127
|
return txt
|
159
128
|
|
160
129
|
def get_dynamic_paragraph(self, ar, obj, **kwargs):
|
161
|
-
dv = self.data_view
|
130
|
+
# dv = self.data_view
|
162
131
|
# sar = dv.create_request(parent=ar, limit=dv.preview_limit)
|
163
|
-
sar =
|
132
|
+
sar = self.create_request(ar, obj)
|
164
133
|
return " / ".join([sar.obj2htmls(row) for row in sar])
|
165
134
|
|
166
135
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
{% extends "
|
1
|
+
{% extends "bootstrap5/base.html" %}
|
2
2
|
|
3
3
|
{% block header %}
|
4
4
|
<div class="container-fluid lino-bs-header">
|
@@ -39,22 +39,19 @@
|
|
39
39
|
{% endblock %}
|
40
40
|
|
41
41
|
{% block navbar %}
|
42
|
-
<nav class="navbar navbar-
|
42
|
+
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
43
43
|
<div class="container-fluid">
|
44
44
|
{% set index_node, home_children = obj.home_and_children(ar) %}
|
45
|
-
<
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<span class="icon-bar"></span>
|
50
|
-
<span class="icon-bar"></span>
|
51
|
-
</button>
|
52
|
-
<a class="navbar-brand" href="{{ar.get_home_url()}}">{{ index_node.title }}</a>
|
53
|
-
</div>
|
45
|
+
<a class="navbar-brand" href="{{ar.obj2url(index_node)}}">{{ index_node.title }}</a>
|
46
|
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#bs-navbar-collapsible-content" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
47
|
+
<span class="navbar-toggler-icon"></span>
|
48
|
+
</button>
|
54
49
|
<div class="collapse navbar-collapse" id="bs-navbar-collapsible-content">
|
55
|
-
<ul class="nav
|
50
|
+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
56
51
|
{% for child in home_children %}
|
57
|
-
<li>
|
52
|
+
<li class="nav-item">
|
53
|
+
<a class="nav-link" href="{{ar.obj2url(child)}}">{{str(child)}}</a>
|
54
|
+
</li>
|
58
55
|
{% endfor %}
|
59
56
|
</ul>
|
60
57
|
</div>
|
@@ -1,4 +1,6 @@
|
|
1
1
|
from lino.api import rt, _
|
2
|
+
raise Exception("20250809 content moved to lino_book/projects/noi2/fixtures/demo.py")
|
3
|
+
|
2
4
|
|
3
5
|
home_children = [
|
4
6
|
(_("Mission"), None, []),
|
@@ -15,6 +17,7 @@ home_children = [
|
|
15
17
|
|
16
18
|
def objects():
|
17
19
|
image = rt.models.uploads.Upload.objects.first()
|
20
|
+
|
18
21
|
def iterate(iterable):
|
19
22
|
try:
|
20
23
|
for obj in iterable:
|
@@ -25,4 +28,3 @@ def objects():
|
|
25
28
|
yield obj
|
26
29
|
for obj in rt.models.publisher.make_demo_pages(home_children):
|
27
30
|
yield iterate(obj)
|
28
|
-
|
lino/modlib/publisher/mixins.py
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
# -*- coding: UTF-8 -*-
|
2
|
-
# Copyright 2020-
|
2
|
+
# Copyright 2020-2025 Rumma & Ko Ltd
|
3
3
|
# License: GNU Affero General Public License v3 (see file COPYING for details)
|
4
4
|
|
5
5
|
# from inspect import isclass
|
6
|
-
from lino.utils.html import tostring
|
7
|
-
from lino.api import dd, rt, _
|
8
|
-
|
9
6
|
from django import http
|
10
|
-
from django.db import models
|
11
|
-
from django.conf import settings
|
12
|
-
from django.utils.translation import get_language
|
13
|
-
from lino.core.renderer import add_user_language
|
14
|
-
from lino.core.utils import full_model_name
|
15
|
-
from lino.utils import buildurl
|
7
|
+
# from django.db import models
|
8
|
+
# from django.conf import settings
|
9
|
+
# from django.utils.translation import get_language
|
10
|
+
# from lino.core.renderer import add_user_language
|
11
|
+
# from lino.core.utils import full_model_name
|
12
|
+
# from lino.utils import buildurl
|
16
13
|
from lino.utils.html import mark_safe
|
17
14
|
from lino.modlib.printing.mixins import Printable
|
18
|
-
from lino.modlib.
|
19
|
-
from .
|
15
|
+
from lino.modlib.users.mixins import PrivacyRelevant
|
16
|
+
from lino.api import dd, rt, _
|
17
|
+
from .choicelists import PublishingStates, PageFillers, SpecialPages
|
20
18
|
# from .choicelists import PublisherViews, PublishingStates
|
21
19
|
|
22
20
|
|
@@ -48,6 +46,10 @@ class Publishable(Printable):
|
|
48
46
|
publisher_template = "publisher/page.pub.html"
|
49
47
|
_lino_publisher_location = None
|
50
48
|
|
49
|
+
root_page = dd.ForeignKey(
|
50
|
+
"publisher.Page", null=True, blank=True,
|
51
|
+
verbose_name=_("Root page"), related_name='+')
|
52
|
+
|
51
53
|
@dd.htmlbox()
|
52
54
|
def full_page(self, ar):
|
53
55
|
if ar is None:
|
@@ -65,76 +67,16 @@ class Publishable(Printable):
|
|
65
67
|
|
66
68
|
preview_publication = PreviewPublication()
|
67
69
|
|
68
|
-
# @classmethod
|
69
|
-
# def on_analyze(cls, site):
|
70
|
-
# # Inject the previous_page field to all models that have a publisher
|
71
|
-
# # view.
|
72
|
-
# # print("20231103", cls, [pv.table_class.model for pv in PublisherViews.get_list_items()])
|
73
|
-
# # for pv in PublisherViews.get_list_items():
|
74
|
-
# for loc, table_class in site.plugins.publisher.locations:
|
75
|
-
# if full_model_name(cls) == table_class.model:
|
76
|
-
# # print("20231103", cls)
|
77
|
-
# dd.inject_field(
|
78
|
-
# cls, 'previous_page',
|
79
|
-
# dd.ForeignKey("self", null=True, blank=True,
|
80
|
-
# verbose_name=_("Previous page")))
|
81
|
-
# return
|
82
|
-
|
83
|
-
# @dd.action(select_rows=False)
|
84
|
-
# def preview_publication(self, ar):
|
85
|
-
# sr_selected = not isclass(self)
|
86
|
-
# if sr_selected:
|
87
|
-
# ar.success(open_url=self.publisher_url())
|
88
|
-
# else:
|
89
|
-
# ar.success(open_url=self.publisher_url(self, not sr_selected))
|
90
|
-
|
91
|
-
# def publisher_url(self, ar, **kw):
|
92
|
-
# for i in PublisherViews.get_list_items():
|
93
|
-
# if isinstance(self, i.table_class.model):
|
94
|
-
# # print("20230409", self.__class__, i)
|
95
|
-
# # return "/{}/{}".format(i.publisher_location, self.pk)
|
96
|
-
# add_user_language(kw, ar)
|
97
|
-
# # return buildurl("/" + i.publisher_location, str(self.pk), **dd.urlkwargs())
|
98
|
-
# return ar.renderer.front_end.buildurl(i.publisher_location, str(self.pk), **kw)
|
99
|
-
# # return dd.plugins.publisher.buildurl("/"+i.publisher_location, str(self.pk), **kw)
|
100
|
-
# # return buildurl("/", i.publisher_location, str(self.pk), **kw)
|
101
|
-
# available = [i.table_class.model for i in PublisherViews.get_list_items()]
|
102
|
-
# return "No publisher view for {} in {}".format(self, available)
|
103
|
-
|
104
70
|
def is_public(self):
|
105
71
|
return True
|
106
72
|
|
107
73
|
def get_preview_context(self, ar):
|
108
74
|
return ar.get_printable_context(obj=self)
|
109
75
|
|
110
|
-
# def set_previous_page(self, ppv, ppi):
|
111
|
-
# if self.previous_page_id != ppi or self.previous_page_view != ppv:
|
112
|
-
# self.previous_page_id = ppi
|
113
|
-
# self.previous_page_view = ppv
|
114
|
-
# self.save()
|
115
|
-
|
116
|
-
# @classmethod
|
117
|
-
# def update_publisher_pages(cls):
|
118
|
-
# pass
|
119
|
-
|
120
|
-
# def render_from(self, tplname, ar):
|
121
|
-
# env = settings.SITE.plugins.jinja.renderer.jinja_env
|
122
|
-
# context = self.get_preview_context(ar)
|
123
|
-
# template = env.get_template(tplname)
|
124
|
-
# # print("20210112 publish {} {} using {}".format(cls, obj, template))
|
125
|
-
# # context = dict(obj=self, request=request, language=get_language())
|
126
|
-
# return template.render(**context)
|
127
|
-
|
128
|
-
def home_and_children(self, ar):
|
129
|
-
home = rt.models.publisher.SpecialPages.home.get_object()
|
130
|
-
return home, rt.models.publisher.Page.objects.filter(parent=home)
|
131
|
-
# return dv.model.objects.filter(models.Q(parent=index_node) | models.Q(ref='index'), language=language)
|
132
|
-
|
133
76
|
def get_publisher_response(self, ar):
|
134
77
|
if not self.is_public():
|
135
78
|
return http.HttpResponseNotFound(
|
136
|
-
"{} {} is not public"
|
137
|
-
)
|
79
|
+
f"{self.__class__} {self.pk} is not public")
|
138
80
|
context = self.get_preview_context(ar)
|
139
81
|
# html = ''.join(self.as_page(ar))
|
140
82
|
# # context.update(content=html, admin_site_prefix=dd.plugins.publisher.admin_location)
|
@@ -144,8 +86,16 @@ class Publishable(Printable):
|
|
144
86
|
tpl.render(**context), content_type='text/html;charset="utf-8"'
|
145
87
|
)
|
146
88
|
|
89
|
+
def home_and_children(self, ar):
|
90
|
+
home = self.root_page
|
91
|
+
if home is None:
|
92
|
+
home = SpecialPages.home.get_object()
|
93
|
+
return home, rt.models.publisher.Page.objects.filter(parent=home)
|
94
|
+
# return dv.model.objects.filter(models.Q(parent=index_node) | models.Q(ref='index'), language=language)
|
95
|
+
|
96
|
+
|
97
|
+
class PublishableContent(Publishable, PrivacyRelevant):
|
147
98
|
|
148
|
-
class PublishableContent(Publishable):
|
149
99
|
class Meta:
|
150
100
|
abstract = True
|
151
101
|
app_label = "publisher"
|
@@ -153,7 +103,8 @@ class PublishableContent(Publishable):
|
|
153
103
|
language = dd.LanguageField()
|
154
104
|
publishing_state = PublishingStates.field(default="draft")
|
155
105
|
filler = PageFillers.field(blank=True, null=True)
|
156
|
-
main_image = dd.ForeignKey('uploads.Upload', blank=True,
|
106
|
+
main_image = dd.ForeignKey('uploads.Upload', blank=True,
|
107
|
+
null=True, verbose_name=_("Main image"))
|
157
108
|
|
158
109
|
def get_print_language(self):
|
159
110
|
return self.language
|
@@ -167,4 +118,6 @@ class PublishableContent(Publishable):
|
|
167
118
|
super().on_duplicate(ar, master)
|
168
119
|
|
169
120
|
def is_public(self):
|
121
|
+
if self.private:
|
122
|
+
return False
|
170
123
|
return self.publishing_state.is_public
|