mirror of
https://github.com/MatomoCamp/pretalx-matomocamp.git
synced 2024-09-11 06:43:44 +02:00
first version of the Matomocamp Pretalx plugin
This commit is contained in:
commit
342e6c30f4
16 changed files with 361 additions and 0 deletions
130
.github/workflows/style.yml
vendored
Normal file
130
.github/workflows/style.yml
vendored
Normal file
|
@ -0,0 +1,130 @@
|
|||
name: Code Style
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
- '{{cookiecutter.module_name}}/locale/**'
|
||||
- '{{cookiecutter.module_name}}/static/**'
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
- '{{cookiecutter.module_name}}/locale/**'
|
||||
- '{{cookiecutter.module_name}}/static/**'
|
||||
|
||||
jobs:
|
||||
isort:
|
||||
name: isort
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install pretalx
|
||||
run: pip3 install pretalx
|
||||
- name: Install Dependencies
|
||||
run: pip3 install isort -Ue .
|
||||
- name: Run isort
|
||||
run: isort -c .
|
||||
flake:
|
||||
name: flake8
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install pretalx
|
||||
run: pip3 install pretalx
|
||||
- name: Install Dependencies
|
||||
run: pip3 install flake8 -Ue .
|
||||
- name: Run flake8
|
||||
run: flake8 .
|
||||
working-directory: .
|
||||
black:
|
||||
name: black
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install pretalx
|
||||
run: pip3 install pretalx
|
||||
- name: Install Dependencies
|
||||
run: pip3 install black -Ue .
|
||||
- name: Run black
|
||||
run: black --check .
|
||||
working-directory: .
|
||||
docformatter:
|
||||
name: docformatter
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install pretalx
|
||||
run: pip3 install pretalx
|
||||
- name: Install Dependencies
|
||||
run: pip3 install docformatter -Ue .
|
||||
- name: Run docformatter
|
||||
run: docformatter --check -r .
|
||||
working-directory: .
|
||||
packaging:
|
||||
name: packaging
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install pretalx
|
||||
run: pip3 install pretalx
|
||||
- name: Install Dependencies
|
||||
run: pip3 install twine check-manifest -Ue .
|
||||
- name: Run check-manifest
|
||||
run: check-manifest .
|
||||
working-directory: .
|
||||
- name: Build package
|
||||
run: python setup.py sdist
|
||||
working-directory: .
|
||||
- name: Check package
|
||||
run: twine check dist/*
|
||||
working-directory: .
|
63
.gitignore
vendored
Normal file
63
.gitignore
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
.ropeproject/
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*,cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
#Ipython Notebook
|
||||
.ipynb_checkpoints
|
13
LICENSE
Normal file
13
LICENSE
Normal file
|
@ -0,0 +1,13 @@
|
|||
Copyright 2021 Lukas Winkler
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
3
MANIFEST.in
Normal file
3
MANIFEST.in
Normal file
|
@ -0,0 +1,3 @@
|
|||
recursive-include pretalx_matomocamp/static *
|
||||
recursive-include pretalx_matomocamp/templates *
|
||||
recursive-include pretalx_matomocamp/locale *
|
8
Makefile
Normal file
8
Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
all: localecompile
|
||||
|
||||
localecompile:
|
||||
django-admin compilemessages
|
||||
|
||||
localegen:
|
||||
django-admin makemessages -l de_DE -i build -i dist -i "*egg*"
|
||||
|
32
README.rst
Normal file
32
README.rst
Normal file
|
@ -0,0 +1,32 @@
|
|||
Pretalx Extension for the MatomoCamp
|
||||
==========================
|
||||
|
||||
This is a plugin for `pretalx`_.
|
||||
|
||||
Development setup
|
||||
-----------------
|
||||
|
||||
1. Make sure that you have a working `pretalx development setup`_.
|
||||
|
||||
2. Clone this repository, eg to ``local/pretalx-matomocamp``.
|
||||
|
||||
3. Activate the virtual environment you use for pretalx development.
|
||||
|
||||
4. Execute ``python setup.py develop`` within this directory to register this application with pretalx's plugin registry.
|
||||
|
||||
5. Execute ``make`` within this directory to compile translations.
|
||||
|
||||
6. Restart your local pretalx server. You can now use the plugin from this repository for your events by enabling it in
|
||||
the 'plugins' tab in the settings.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright 2021 Lukas Winkler
|
||||
|
||||
Released under the terms of the Apache License 2.0
|
||||
|
||||
|
||||
.. _pretalx: https://github.com/pretalx/pretalx
|
||||
.. _pretalx development setup: https://docs.pretalx.org/en/latest/developer/setup.html
|
20
pretalx_matomocamp/__init__.py
Normal file
20
pretalx_matomocamp/__init__.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from django.apps import AppConfig
|
||||
from django.utils.translation import gettext_lazy
|
||||
|
||||
|
||||
class PluginApp(AppConfig):
|
||||
name = "pretalx_matomocamp"
|
||||
verbose_name = "Pretalx Extension for the MatomoCamp"
|
||||
|
||||
class PretalxPluginMeta:
|
||||
name = gettext_lazy("Pretalx Extension for the MatomoCamp")
|
||||
author = "Lukas Winkler"
|
||||
description = gettext_lazy("Short description")
|
||||
visible = True
|
||||
version = "0.0.0"
|
||||
|
||||
def ready(self):
|
||||
from . import signals # NOQA
|
||||
|
||||
|
||||
default_app_config = "pretalx_matomocamp.PluginApp"
|
0
pretalx_matomocamp/locale/de_DE/LC_MESSAGES/.gitkeep
Normal file
0
pretalx_matomocamp/locale/de_DE/LC_MESSAGES/.gitkeep
Normal file
0
pretalx_matomocamp/locale/fr_FR/LC_MESSAGES/.gitkeep
Normal file
0
pretalx_matomocamp/locale/fr_FR/LC_MESSAGES/.gitkeep
Normal file
35
pretalx_matomocamp/signals.py
Normal file
35
pretalx_matomocamp/signals.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Register your receivers here
|
||||
from django.dispatch import receiver
|
||||
from pretalx.agenda.signals import register_recording_provider
|
||||
from pretalx.cfp.signals import html_head
|
||||
from pretalx.agenda.recording import BaseRecordingProvider
|
||||
|
||||
|
||||
class MatomoVideoProvider(BaseRecordingProvider):
|
||||
def get_recording(self, submission):
|
||||
print(submission)
|
||||
return {"iframe": '<div class="embed-responsive embed-responsive-16by9"><iframe src="https://example.com"></iframe></div>', "csp_header": " …"}
|
||||
|
||||
|
||||
# @receiver(register_recording_provider)
|
||||
# def matomo_video_provider(sender, **kwargs):
|
||||
# return MatomoVideoProvider(sender)
|
||||
|
||||
@receiver(html_head)
|
||||
def append_to_header(sender,**kwargs):
|
||||
return """<!-- Matomo -->
|
||||
<script type="text/javascript">
|
||||
var _paq = window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
_paq.push(["disableCookies"]);
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="//mtm.matomocamp.org/";
|
||||
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||
_paq.push(['setSiteId', '3']);
|
||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
</script>
|
||||
<!-- End Matomo Code -->"""
|
0
pretalx_matomocamp/static/pretalx_matomocamp/.gitkeep
Normal file
0
pretalx_matomocamp/static/pretalx_matomocamp/.gitkeep
Normal file
0
pretalx_matomocamp/templates/pretalx_matomocamp/.gitkeep
Normal file
0
pretalx_matomocamp/templates/pretalx_matomocamp/.gitkeep
Normal file
3
pylama.ini
Normal file
3
pylama.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[pylama]
|
||||
ignore = E501,
|
||||
skip = */settings.py,*/celery_app.py,*.ropeproject/*
|
2
pytest.ini
Normal file
2
pytest.ini
Normal file
|
@ -0,0 +1,2 @@
|
|||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE=pretalx.common.settings.test_settings
|
10
setup.cfg
Normal file
10
setup.cfg
Normal file
|
@ -0,0 +1,10 @@
|
|||
[isort]
|
||||
balanced_wrapping = True
|
||||
combine_as_imports = True
|
||||
default_section = THIRDPARTY
|
||||
include_trailing_comma = True
|
||||
known_third_party = pretalx
|
||||
line_length = 80
|
||||
multi_line_output = 5
|
||||
not_skip = __init__.py
|
||||
skip = migrations,setup.py
|
42
setup.py
Normal file
42
setup.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
import os
|
||||
from distutils.command.build import build
|
||||
|
||||
from django.core import management
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
try:
|
||||
with open(
|
||||
os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8"
|
||||
) as f:
|
||||
long_description = f.read()
|
||||
except FileNotFoundError:
|
||||
long_description = ""
|
||||
|
||||
|
||||
class CustomBuild(build):
|
||||
def run(self):
|
||||
management.call_command("compilemessages", verbosity=1)
|
||||
build.run(self)
|
||||
|
||||
|
||||
cmdclass = {"build": CustomBuild}
|
||||
|
||||
|
||||
setup(
|
||||
name="pretalx-matomocamp",
|
||||
version="0.0.0",
|
||||
description="Short description",
|
||||
long_description=long_description,
|
||||
url="test",
|
||||
author="Lukas Winkler",
|
||||
author_email="lukas@matomocamp.org",
|
||||
license="Apache Software License",
|
||||
install_requires=[],
|
||||
packages=find_packages(exclude=["tests", "tests.*"]),
|
||||
include_package_data=True,
|
||||
cmdclass=cmdclass,
|
||||
entry_points="""
|
||||
[pretalx.plugin]
|
||||
pretalx_matomocamp=pretalx_matomocamp:PretalxPluginMeta
|
||||
""",
|
||||
)
|
Loading…
Reference in a new issue