More updates, forum stars locally but looks crooked still

This commit is contained in:
László Károlyi 2023-05-24 21:03:42 +02:00
parent 3f09e0e855
commit b9c752f86d
Signed by: karolyi
GPG key ID: 2DCAF25E55735BFE
23 changed files with 1513 additions and 123 deletions

View file

@ -1,11 +1,13 @@
{
"env": {
"browser": true,
"node": true
"node": true,
"es6": true
},
"parser": "babel-eslint",
"extends": ["eslint:recommended", "airbnb-base"],
"parser": "@babel/eslint-parser",
"extends": ["eslint:recommended"],
"rules": {
"max-classes-per-file": 0,
"no-continue": [0],
"no-console": [1],
"semi": [2, "never"],
@ -13,13 +15,6 @@
"strict": [2, "never"],
"max-len": [2, {"code": 80, "tabWidth": 4, "ignoreUrls": true}],
"no-restricted-syntax": "off",
"max-classes-per-file": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
],
"import/prefer-default-export": ["off"],
"operator-linebreak": "off"
},

View file

@ -1,5 +1,3 @@
[settings]
multi_line_output=4
; skip=backend/ticketshop/wsgi.py
; skip-glob=*node_modules/*
src_paths=backend

View file

@ -3,7 +3,7 @@
{% from 'default/macros/render-messages.html' import render_messages with context %}
{% block extra_scripts_head %}
{{ render_bundle('settingsPage') }}
{{ render_bundle('settingsPage', skip_common_chunks=True) }}
{% endblock extra_scripts_head %}
{% block main_content %}

View file

@ -3,9 +3,7 @@
<!DOCTYPE html>
<html lang="{{ current_language.code|escape }}">
<head>
{{ render_bundle('vendor') }}
{{ render_bundle('runtime') }}
{{ render_bundle('common') }}
{{ render_bundle('common', skip_common_chunks=True) }}
<title>{% block title %}{{ django_settings.SITE_NAME }}{% endblock title %}</title>
<link rel="icon" href="{{ static('favicon.ico') }}" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=no">
@ -38,7 +36,7 @@
scrollSpeed: 300
});
</script>
{{ render_bundle('username') }}
{{ render_bundle('username', skip_common_chunks=True) }}
<script type="text/javascript">
// Init the username module
Forum.username.init({})

View file

@ -5,7 +5,7 @@
{% block extra_scripts_head %}
{{ render_bundle('topicCommentsExpansion') }}
{{ render_bundle('topicCommentsExpansion', skip_common_chunks=True) }}
{% endblock extra_scripts_head %}
{% block main_content %}

View file

@ -5,7 +5,7 @@
{% from 'default/macros/paginator-generic.html' import paginator_generic %}
{% block extra_scripts_head %}
{{ render_bundle('topicCommentListing') }}
{{ render_bundle('topicCommentListing', skip_common_chunks=True) }}
{% endblock extra_scripts_head %}
{% block main_content %}

View file

@ -2,7 +2,7 @@
{% from 'default/base/macros/topic-group.html' import topic_group %}
{% block extra_scripts_head %}
{{ render_bundle('topicGroup') }}
{{ render_bundle('topicGroup', skip_common_chunks=True) }}
{% endblock extra_scripts_head %}
{% block main_content %}

View file

@ -81,7 +81,7 @@ class CdnImageDownloader(object):
'Download the file and return its content in a `BytesIO`.'
try:
r = get(url=self._url_source, verify=False, timeout=10)
except Exception as e:
except Exception:
return None
if r.status_code != 200:
_LOGGER.error(

View file

@ -1,11 +1,11 @@
import $ from 'jquery'
import 'select2'
import templateSettings from 'lodash/templateSettings'
import templateSettings from 'lodash/templateSettings.js'
// The navbar needs these on all pages
import 'bootstrap/js/src/dropdown'
import 'bootstrap/js/src/collapse'
import 'bootstrap/js/src/dropdown.js'
import 'bootstrap/js/src/collapse.js'
import { Settings as LuxonSettings } from 'luxon'
import { init as timeActualizerInit } from './time-actualizer'
import { init as timeActualizerInit } from './time-actualizer.js'
window.$ = $

View file

@ -1,6 +1,6 @@
import $ from 'jquery'
import 'bootstrap/js/src/popover'
import { observeRemoveJq } from './mutation-observer'
import 'bootstrap/js/src/popover.js'
import { observeRemoveJq } from './mutation-observer.js'
/**
* This module expands the bootstrap provided popover with showing the
* popover until it's content is hovered or until the original element

View file

@ -1,13 +1,13 @@
import $ from 'jquery'
import 'bootstrap/js/src/tooltip'
import 'bootstrap/js/src/tab'
import 'bootstrap/js/src/tooltip.js'
import 'bootstrap/js/src/tab.js'
import URI from 'urijs'
import TextareaEditor, { formats as editorFormats } from 'textarea-editor'
import TextareaEditor, { Formats as editorFormats } from 'textarea-editor'
import template from './template/rich-text-area.html'
import {
options as commonOptions, addCsrfHeader, updateCsrfToken,
// escapeHtml,
} from './common'
} from './common.js'
editorFormats.strikethrough = {
prefix: '~~',

View file

@ -1,8 +1,8 @@
/* global Forum */
import $ from 'jquery'
import { init as richTextAreaInit } from './rich-text-area'
import 'bootstrap/js/src/tooltip'
import 'bootstrap/js/src/alert'
import { init as richTextAreaInit } from './rich-text-area.js'
import 'bootstrap/js/src/tooltip.js'
import 'bootstrap/js/src/alert.js'
// const paginator = require('./paginator')
// const userName = require('./userName')
// const timeActualizer = require('./time-actualizer')

View file

@ -1,7 +1,7 @@
import 'bootstrap/js/src/tooltip'
import 'bootstrap/js/src/tooltip.js'
import $ from 'jquery'
import { DateTime } from 'luxon'
import { observeRemoveJq } from './mutation-observer'
import { observeRemoveJq } from './mutation-observer.js'
window.DateTime = DateTime

View file

@ -1,12 +1,12 @@
import $ from 'jquery'
import 'bootstrap/js/src/tooltip'
import template from 'lodash/template'
import { ScrollFix } from './scroll-fix'
import { options as commonOptions, extractTemplateHtml } from './common'
import { add as popoverHovercontentAdd } from './popover-hovercontent'
import { add as usernameAdd } from './username'
import { add as timeActualizerAdd } from './time-actualizer'
import { init as paginatorInit } from './paginator'
import 'bootstrap/js/src/tooltip.js'
import template from 'lodash/template.js'
import { ScrollFix } from './scroll-fix.js'
import { options as commonOptions, extractTemplateHtml } from './common.js'
import { add as popoverHovercontentAdd } from './popover-hovercontent.js'
import { add as usernameAdd } from './username.js'
import { add as timeActualizerAdd } from './time-actualizer.js'
import { init as paginatorInit } from './paginator.js'
export class CommentListing {
onClickLinkPreviousComment(event) {

View file

@ -1,4 +1,4 @@
import { CommentListing } from './topic-comment-listing'
import { CommentListing } from './topic-comment-listing.js'
const $ = require('jquery')

View file

@ -1,13 +1,13 @@
import $ from 'jquery'
import 'bootstrap/js/src/tooltip'
import { options as commonOptions, extractTemplateHtml } from './common'
import { init as paginatorInit } from './paginator'
import { add as usernameAdd } from './username'
import { add as timeActualizerAdd } from './time-actualizer'
import 'bootstrap/js/src/tooltip.js'
import { options as commonOptions, extractTemplateHtml } from './common.js'
import { init as paginatorInit } from './paginator.js'
import { add as usernameAdd } from './username.js'
import { add as timeActualizerAdd } from './time-actualizer.js'
import {
add as popoverHovercontentAdd,
clearGroup as popoverClearGroup,
} from './popover-hovercontent'
} from './popover-hovercontent.js'
class Instance {
constructor(options) {

View file

@ -1,9 +1,11 @@
import $ from 'jquery'
import 'bootstrap/js/src/tooltip'
import template from 'lodash/template'
import cloneDeep from 'lodash/cloneDeep'
import { DefaultWhitelist } from 'bootstrap/js/src/tools/sanitizer'
import { options as commonOptions, extractTemplateHtml } from './common'
import 'bootstrap/js/src/tooltip.js'
import template from 'lodash/template.js'
import cloneDeep from 'lodash/cloneDeep.js'
import {
DefaultAllowlist as DefaultWhitelist
} from 'bootstrap/js/src/util/sanitizer.js'
import { options as commonOptions, extractTemplateHtml } from './common.js'
let classInstance

View file

@ -35,7 +35,7 @@
.navbar-content-spacer {
// Adjust when necessary
height: 51px + $grid-gutter-width / 2;
height: 1.5rem + $grid-gutter-width / 2;
}
.page-content-wrapper {

View file

@ -1,23 +1,22 @@
/* eslint-env node */
/* eslint strict: 0, prefer-const: 1 */
'use strict'
const webpack = require('webpack')
const path = require('path')
const BundleTracker = require('webpack-bundle-tracker')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
import path from 'path'
import BundleTrackerPlugin from 'webpack-bundle-tracker'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import { fileURLToPath } from 'url'
const _myFileName = fileURLToPath(import.meta.url)
const _myDirName = path.dirname(_myFileName)
const configBase = require('./config.base')
import configBase, { myPostCssOptions } from './config.base.js'
const extractCSS = new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'stylesheets/[name].css',
chunkFilename: 'stylesheets/[id].css',
// chunkFilename: 'stylesheets/[id].css',
})
const postCssConfigPath = path.resolve(
path.join(__dirname, '..', '..', 'postcss.config.js'))
// This turns on the creation of map files, in addition to turning on
// sourcemaps in plugins, this MUST be specified
@ -32,7 +31,7 @@ configBase.module.rules.push({
{ loader: 'css-loader', options: { sourceMap: true, importLoaders: 1 } },
{
loader: 'postcss-loader',
options: { config: { path: postCssConfigPath }, sourceMap: true },
options: myPostCssOptions,
},
{
loader: 'sass-loader',
@ -40,7 +39,7 @@ configBase.module.rules.push({
sourceMap: true,
sassOptions: {
includePaths: [
path.resolve(__dirname, '../../node_modules'),
path.resolve(_myDirName, '../../node_modules'),
],
},
},
@ -56,23 +55,29 @@ configBase.module.rules.push({
{ loader: 'css-loader', options: { sourceMap: true, importLoaders: 1 } },
{
loader: 'postcss-loader',
options: { config: { path: postCssConfigPath }, sourceMap: true },
options: myPostCssOptions,
},
{
loader: 'stylus-loader',
options: { sourceMap: true, preferPathResolver: 'webpack' },
options: { sourceMap: true },
},
],
})
// Override font naming in development
configBase.module.rules[0].generator.filename = 'fonts/[name][ext]'
configBase.module.rules[1].generator.filename = 'fonts/[name][ext]'
configBase.plugins = configBase.plugins.concat([
new BundleTracker({
path: __dirname,
filename: path.join('..', 'webpack', 'stats.json'),
new BundleTrackerPlugin({
path: path.resolve(_myDirName, '..', 'webpack'),
filename: 'stats.json',
}),
extractCSS,
])
configBase.mode = 'development'
module.exports = configBase
export default configBase

View file

@ -1,27 +1,25 @@
const path = require('path')
const BundleTracker = require('webpack-bundle-tracker')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const cleanCss = require('clean-css')
import path from 'path'
import BundleTrackerPlugin from 'webpack-bundle-tracker'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import TerserPlugin from 'terser-webpack-plugin'
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'
import { fileURLToPath } from 'url'
const _myFileName = fileURLToPath(import.meta.url)
const _myDirName = path.dirname(_myFileName)
const configBase = require('./config.base')
import configBase, { myPostCssOptions } from './config.base.js'
myPostCssOptions.sourceMap = false
const extractCSS = new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'stylesheets/[name]-[hash:6].css',
chunkFilename: 'stylesheets/[id]-[hash:6].css',
filename: 'stylesheets/[name]-[contenthash:6].css',
})
const postCssConfigPath = path.resolve(
path.join(__dirname, '..', '..', 'postcss.config.js'),
)
configBase.plugins = configBase.plugins.concat([
new BundleTracker({
path: __dirname,
filename: path.join('..', 'webpack', 'stats.json'),
new BundleTrackerPlugin({
path: path.resolve(_myDirName, '..', 'webpack'),
filename: 'stats.json',
}),
// To split all the CSS files
extractCSS,
@ -35,14 +33,14 @@ configBase.module.rules.push({
{ loader: 'css-loader', options: { importLoaders: 1 } },
{
loader: 'postcss-loader',
options: { config: { path: postCssConfigPath }, sourceMap: false },
options: myPostCssOptions,
},
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: [
path.resolve(__dirname, '../../node_modules'),
path.resolve(_myDirName, '../../node_modules'),
],
},
},
@ -55,48 +53,53 @@ configBase.module.rules.push({
test: /\.styl$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: 'css-loader', options: { importLoaders: 1 } },
{ loader: 'css-loader', options: { sourceMap: false, importLoaders: 2 } },
{
loader: 'postcss-loader',
options: { config: { path: postCssConfigPath }, sourceMap: false },
options: myPostCssOptions,
},
{
loader: 'stylus-loader',
options: { sourceMap: false },
},
{ loader: 'stylus-loader', options: { preferPathResolver: 'webpack' } },
],
})
// Override font naming in production
configBase.module.rules[0].generator.filename = 'fonts/[name]-[hash:6][ext]'
configBase.module.rules[1].generator.filename = 'fonts/[name]-[hash:6][ext]'
configBase.output.filename = '[name]-[chunkhash:6].js'
// log(configBase)
configBase.mode = 'production'
configBase.optimization.minimizer = [
// we specify a custom UglifyJsPlugin here to get source maps in production
new TerserPlugin({
cache: true,
// cache: true,
extractComments: true,
parallel: true,
terserOptions: {
ecma: 8,
// compress: true,
compress: false,
// mangle: true,
mangle: false,
compress: true,
// compress: false,
mangle: true,
// mangle: false,
output: {
comments: false,
},
},
sourceMap: false,
}),
// Related issue: https://github.com/cssnano/cssnano/issues/712
new OptimizeCSSAssetsPlugin({
cssProcessor: cleanCss,
cssProcessorPluginOptions: {
preset: ['default', { discardComments: { removeAll: true } }],
},
canPrint: true,
// sourceMap: false,
}),
new CssMinimizerPlugin({
minify: CssMinimizerPlugin.cleanCssMinify,
minimizerOptions: {
preset: [
'default', {
discardComments: { removeAll: true },
}
]
}
})
]
configBase.mode = 'production'
// Override font naming in production
configBase.module.rules[0].use[0].options.name = 'fonts/[name]-[hash:6].[ext]'
configBase.module.rules[1].use[0].options.name = 'fonts/[name]-[hash:6].[ext]'
configBase.output.filename = '[name]-[hash:6].js'
module.exports = configBase
export default configBase

1388
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,10 +6,15 @@
"type": "module",
"devDependencies": {
"@babel/core": "^7.21.8",
"@babel/eslint-parser": "^7.21.8",
"@babel/plugin-proposal-function-bind": "^7.18.9",
"@babel/preset-env": "^7.21.5",
"@babel/runtime": "^7.21.5",
"@popperjs/core": "^2.11.7",
"@types/bootstrap": "^5.2.6",
"@types/lodash": "^4.14.194",
"@types/luxon": "^3.3.0",
"@types/urijs": "^1.19.19",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2",
"bootstrap": "^5.2.3",
@ -40,6 +45,7 @@
"npm-check-updates": "^16.10.12",
"plugin-error": "^2.0.1",
"postcss-loader": "^7.3.0",
"postcss-preset-env": "^8.4.1",
"raw-loader": "^4.0.2",
"resolve-url-loader": "^5.0.0",
"sass-loader": "^13.3.0",

View file

@ -1,5 +0,0 @@
module.exports = {
plugins: {
autoprefixer: {},
},
}