Renaming base.html to have .jinja extension
This commit is contained in:
parent
fabbfeb737
commit
abc6602e51
14 changed files with 59 additions and 77 deletions
|
@ -193,54 +193,6 @@
|
|||
"lineCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "reportUnknownVariableType",
|
||||
"range": {
|
||||
"startColumn": 12,
|
||||
"endColumn": 32,
|
||||
"lineCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "reportUnknownMemberType",
|
||||
"range": {
|
||||
"startColumn": 35,
|
||||
"endColumn": 52,
|
||||
"lineCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "reportAttributeAccessIssue",
|
||||
"range": {
|
||||
"startColumn": 45,
|
||||
"endColumn": 52,
|
||||
"lineCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "reportUnknownVariableType",
|
||||
"range": {
|
||||
"startColumn": 12,
|
||||
"endColumn": 33,
|
||||
"lineCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "reportUnknownMemberType",
|
||||
"range": {
|
||||
"startColumn": 36,
|
||||
"endColumn": 53,
|
||||
"lineCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "reportAttributeAccessIssue",
|
||||
"range": {
|
||||
"startColumn": 46,
|
||||
"endColumn": 53,
|
||||
"lineCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "reportAttributeAccessIssue",
|
||||
"range": {
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -23,6 +23,7 @@ docs/_build/
|
|||
|
||||
node_modules/
|
||||
frontend/dist/*
|
||||
frontend/src/js/*
|
||||
!frontend/dist/.keep
|
||||
frontend/webpack/stats.json
|
||||
backend/forum/settings_override.py
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.contrib.auth.forms import AuthenticationForm
|
|||
from django.core.exceptions import ValidationError
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms import ModelForm
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.request import HttpRequest, QueryDict
|
||||
from django.utils.functional import cached_property
|
||||
from ktools.django.utils.translation import gettext_safelazy as _
|
||||
|
||||
|
@ -89,6 +89,9 @@ class SettingsForm(ModelForm[User]):
|
|||
the introductions, because thosa are handled by the
|
||||
`IntroductionModificationForm`.
|
||||
"""
|
||||
|
||||
data: QueryDict # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
@final
|
||||
class Meta:
|
||||
model = User
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'base.html' %}
|
||||
{% extends 'base.html.jinja' %}
|
||||
{% from 'ktools/macros/render-form-simple.html' import render_form_simple with context %}
|
||||
|
||||
{% block extra_scripts_head %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% get_my_language_info as current_language %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ current_language.code|escape }}">
|
||||
<html lang="{{ current_language.code|e }}">
|
||||
<head>
|
||||
{{ render_bundle(bundle_name='onDomReady') }}
|
||||
{{ render_bundle(bundle_name='common', skip_common_chunks=True, attrs='defer') }}
|
||||
|
@ -8,8 +8,8 @@
|
|||
<link rel="icon" href="{{ static('favicon.ico') }}" type="image/x-icon" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
<script{{ render_nonce_attr(request=request) }} type="text/javascript">
|
||||
{% jsmin %}
|
||||
<script type="text/javascript">
|
||||
Forum.onDomReady(document).then(() => {
|
||||
Forum.common.init({
|
||||
languageInfo: {
|
||||
|
@ -48,10 +48,16 @@
|
|||
variables: {
|
||||
cdnHost: '{{ django_settings.CDN.url_prefix }}'
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
</script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
_paq.push(['setTrackerUrl', '/mtmo/']);
|
||||
_paq.push(['setSiteId', '7']);
|
||||
{% endjsmin %}
|
||||
</script>
|
||||
{{ render_bundle(bundle_name='mtmo', skip_common_chunks=True, attrs='defer') }}
|
||||
{% block extra_scripts_head %}{% endblock extra_scripts_head %}
|
||||
</head>
|
||||
<body>
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'base.html' %}
|
||||
{% extends 'base.html.jinja' %}
|
||||
{% from 'base/macros/topic-comment-template.html' import topic_comment_template with context %}
|
||||
{% from 'base/macros/topic-comment-action-template.html' import topic_comment_action_template with context %}
|
||||
{% from 'base/macros/js-config-topic-comment.html' import js_config_topic_comment with context %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'base.html' %}
|
||||
{% extends 'base.html.jinja' %}
|
||||
{% from 'base/macros/topic-comment-template.html' import topic_comment_template with context %}
|
||||
{% from 'base/macros/topic-comment-action-template.html' import topic_comment_action_template with context %}
|
||||
{% from 'base/macros/js-config-topic-comment.html' import js_config_topic_comment with context %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'base.html' %}
|
||||
{% extends 'base.html.jinja' %}
|
||||
{% from 'base/macros/topic-group.html' import topic_group with context %}
|
||||
|
||||
{% block extra_scripts_head %}
|
||||
|
|
|
@ -198,10 +198,10 @@ class User(AbstractUser):
|
|||
@cached_property
|
||||
def is_admin(self) -> bool:
|
||||
'Return `True` if the `User` is an administrator.'
|
||||
self.introductionmodification
|
||||
return self.is_staff or self.is_superuser
|
||||
|
||||
|
||||
@final
|
||||
@dataclass
|
||||
class FriendsGraph(object):
|
||||
# Whom did I mark as friend?
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.conf import settings
|
|||
from django.core.cache import cache
|
||||
from redis.exceptions import ConnectionError as RedisConnectionerror
|
||||
|
||||
_OBJ_TIMEOUT: int = settings.CACHE_DEFAULT_TIMEOUT
|
||||
_OBJ_TIMEOUT: int = getattr(settings, 'CACHE_DEFAULT_TIMEOUT')
|
||||
|
||||
|
||||
_T = TypeVar(name='_T')
|
||||
|
@ -22,7 +22,7 @@ def get_or_set(
|
|||
try:
|
||||
obj: _T = cache.get(key=key, default=_NOT_FOUND, version=version)
|
||||
if obj != _NOT_FOUND:
|
||||
cache.touch(key=key, timeout=_OBJ_TIMEOUT, version=version)
|
||||
_ = cache.touch(key=key, timeout=_OBJ_TIMEOUT, version=version)
|
||||
return obj
|
||||
except RedisConnectionerror:
|
||||
pass
|
||||
|
@ -55,7 +55,7 @@ def get_or_set_many(
|
|||
if not missing_items:
|
||||
return result
|
||||
try:
|
||||
cache.set_many(data=missing_items, timeout=_OBJ_TIMEOUT)
|
||||
_ = cache.set_many(data=missing_items, timeout=_OBJ_TIMEOUT)
|
||||
except RedisConnectionerror:
|
||||
pass
|
||||
result.update({
|
||||
|
|
|
@ -52,6 +52,9 @@ const defaultConfig = {
|
|||
export: 'default'
|
||||
}
|
||||
},
|
||||
mtmo: [
|
||||
'../src/js/matomo',
|
||||
],
|
||||
common: [
|
||||
// Put the JS entries always at the end, otherwise libraryTarget
|
||||
// variable exporting will not work!
|
||||
|
|
48
gulpfile.js
48
gulpfile.js
|
@ -8,8 +8,13 @@ import Server from 'webpack-dev-server'
|
|||
// import path from 'path'
|
||||
import gulpEslint from 'gulp-eslint-new'
|
||||
// import { fileURLToPath } from 'url'
|
||||
import download from 'gulp-download-stream'
|
||||
|
||||
const sourceGlob = ['frontend/src/ts/**/*.js']
|
||||
const sourceGlob = [
|
||||
'frontend/src/ts/**/*.js',
|
||||
'frontend/src/**/*.ts',
|
||||
'!frontend/src/js/matomo.js'
|
||||
]
|
||||
// const _myFileName = fileURLToPath(import.meta.url)
|
||||
// const _myDirName = path.dirname(_myFileName)
|
||||
|
||||
|
@ -26,6 +31,13 @@ const sourceGlob = ['frontend/src/ts/**/*.js']
|
|||
// Cleanup task
|
||||
GulpClient.task('clean', () => deleteAsync(['./frontend/dist/**/*']))
|
||||
|
||||
// download-matomo-js task
|
||||
GulpClient.task('download-matomo-js', () => download(
|
||||
'https://owa.ksol.io/matomo.js'
|
||||
)
|
||||
.pipe(GulpClient.dest('frontend/src/js/'))
|
||||
)
|
||||
|
||||
// Lint Task
|
||||
if (process.argv.length < 4) {
|
||||
GulpClient.task('lint', () => GulpClient.src(sourceGlob)
|
||||
|
@ -52,7 +64,9 @@ if (process.argv.length < 4) {
|
|||
.pipe(gulpEslint.failAfterError()))
|
||||
}
|
||||
|
||||
GulpClient.task('clean-lint', GulpClient.parallel(['clean', 'lint']))
|
||||
GulpClient.task(
|
||||
'clean-lint',
|
||||
GulpClient.parallel(['clean', 'lint', 'download-matomo-js']))
|
||||
|
||||
GulpClient.task('webpack-prod', GulpClient.series('clean-lint', async (done) => {
|
||||
const prodConfig = (await import('./frontend/webpack/config.prod.js')).default
|
||||
|
@ -75,21 +89,23 @@ GulpClient.task('webpack-dev', GulpClient.series(['clean-lint'], async (done) =>
|
|||
GulpClient.task('build', GulpClient.series(['webpack-prod']))
|
||||
GulpClient.task('build-dev', GulpClient.series(['clean', 'webpack-dev']))
|
||||
|
||||
GulpClient.task('webpack-dev-server', GulpClient.series(['clean'], async (done) => {
|
||||
const config = (
|
||||
await import('./frontend/webpack/config.dev-server.js')).default
|
||||
GulpClient.task(
|
||||
'webpack-dev-server',
|
||||
GulpClient.series(['clean', 'download-matomo-js'], async (done) => {
|
||||
const config = (
|
||||
await import('./frontend/webpack/config.dev-server.js')).default
|
||||
|
||||
const compiler = webpack(config, () => {})
|
||||
const devServerOptions = config.devServer
|
||||
const compiler = webpack(config, () => {})
|
||||
const devServerOptions = config.devServer
|
||||
|
||||
const server = new Server(devServerOptions, compiler)
|
||||
// @See https://webpack.js.org/configuration/dev-server/#usage-via-api
|
||||
server.startCallback((err) => {
|
||||
if (err) throw new PluginError('webpack-dev-server', err)
|
||||
// Server listening
|
||||
logger('[webpack-dev-server]', `http://${devServerOptions.host}:3000/`)
|
||||
})
|
||||
done()
|
||||
}))
|
||||
const server = new Server(devServerOptions, compiler)
|
||||
// @See https://webpack.js.org/configuration/dev-server/#usage-via-api
|
||||
server.startCallback((err) => {
|
||||
if (err) throw new PluginError('webpack-dev-server', err)
|
||||
// Server listening
|
||||
logger('[webpack-dev-server]', `http://${devServerOptions.host}:3000/`)
|
||||
})
|
||||
done()
|
||||
}))
|
||||
|
||||
GulpClient.task('default', GulpClient.series('clean-lint'))
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
"font-awesome": "^4.7.0",
|
||||
"gulp": "^5.0.0",
|
||||
"gulp-cli": "^3.0.0",
|
||||
"gulp-download-stream": "^0.0.20",
|
||||
"gulp-eslint-new": "^2.4.0",
|
||||
"html-loader": "^5.1.0",
|
||||
"imports-loader": "^5.0.0",
|
||||
|
|
Loading…
Reference in a new issue