Merge pull request #3505 from FinnStutzenstein/legalNotice
extended the legal notice page (fixes #3504)
This commit is contained in:
commit
912876c895
@ -1,3 +1,5 @@
|
||||
__author__ = 'OpenSlides Team <support@openslides.org>'
|
||||
__description__ = 'Presentation and assembly system'
|
||||
__version__ = '2.1.2-dev'
|
||||
__license__ = 'MIT'
|
||||
__url__ = 'https://openslides.org'
|
||||
|
@ -1111,6 +1111,8 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
function ($scope, $http) {
|
||||
$http.get('/core/version/').then(function (success) {
|
||||
$scope.core_version = success.data.openslides_version;
|
||||
$scope.core_license = success.data.openslides_license;
|
||||
$scope.core_url = success.data.openslides_url;
|
||||
$scope.plugins = success.data.plugins;
|
||||
});
|
||||
}
|
||||
|
@ -7,12 +7,26 @@
|
||||
<div class="details">
|
||||
<div ng-bind-html="config('general_event_legal_notice') | translate"></div>
|
||||
<hr>
|
||||
<p>OpenSlides {{ core_version }}
|
||||
<p>
|
||||
<a ng-href="{{ core_url }}" target="_blank">
|
||||
<strong>OpenSlides {{ core_version }}</strong>
|
||||
</a>
|
||||
(<translate>License</translate>: {{ core_license }})
|
||||
</p>
|
||||
<div ng-show="plugins.length">
|
||||
<p translate>Installed plugins:</p>
|
||||
<ol>
|
||||
<ul>
|
||||
<li ng-repeat="plugin in plugins">
|
||||
{{ plugin.verbose_name }}: {{ plugin.version }}
|
||||
</ol>
|
||||
<a ng-if="plugin.url" ng-href="{{ plugin.url }}" target="_blank">
|
||||
{{ plugin.verbose_name }} {{ plugin.version }}
|
||||
</a>
|
||||
<span ng-if="!plugin.url">
|
||||
{{ plugin.verbose_name }} {{ plugin.version }}
|
||||
</span>
|
||||
<span ng-if="plugin.license">
|
||||
(<translate>License</translate>: {{ plugin.license}})
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -13,12 +13,16 @@ from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext as _
|
||||
from mypy_extensions import TypedDict
|
||||
|
||||
from .. import __license__ as license
|
||||
from .. import __url__ as url
|
||||
from .. import __version__ as version
|
||||
from ..utils import views as utils_views
|
||||
from ..utils.auth import anonymous_is_enabled, has_perm
|
||||
from ..utils.autoupdate import inform_changed_data, inform_deleted_data
|
||||
from ..utils.plugins import (
|
||||
get_plugin_description,
|
||||
get_plugin_license,
|
||||
get_plugin_url,
|
||||
get_plugin_verbose_name,
|
||||
get_plugin_version,
|
||||
)
|
||||
@ -783,12 +787,22 @@ class VersionView(utils_views.APIView):
|
||||
http_method_names = ['get']
|
||||
|
||||
def get_context_data(self, **context):
|
||||
Result = TypedDict('Result', {'openslides_version': str, 'plugins': List[Dict[str, str]]}) # noqa
|
||||
result = dict(openslides_version=version, plugins=[]) # type: Result
|
||||
Result = TypedDict('Result', { # noqa
|
||||
'openslides_version': str,
|
||||
'openslides_license': str,
|
||||
'openslides_url': str,
|
||||
'plugins': List[Dict[str, str]]})
|
||||
result = dict(
|
||||
openslides_version=version,
|
||||
openslides_license=license,
|
||||
openslides_url=url,
|
||||
plugins=[]) # type: Result
|
||||
# Versions of plugins.
|
||||
for plugin in settings.INSTALLED_PLUGINS:
|
||||
result['plugins'].append({
|
||||
'verbose_name': get_plugin_verbose_name(plugin),
|
||||
'description': get_plugin_description(plugin),
|
||||
'version': get_plugin_version(plugin)})
|
||||
'version': get_plugin_version(plugin),
|
||||
'license': get_plugin_license(plugin),
|
||||
'url': get_plugin_url(plugin)})
|
||||
return result
|
||||
|
@ -93,6 +93,38 @@ def get_plugin_version(plugin: str) -> str:
|
||||
return version
|
||||
|
||||
|
||||
def get_plugin_license(plugin: str) -> str:
|
||||
"""
|
||||
Returns the license string of a plugin. The plugin argument must be a
|
||||
python dotted module path.
|
||||
"""
|
||||
plugin_app_config = apps.get_app_config(plugin)
|
||||
try:
|
||||
license = plugin_app_config.get_license()
|
||||
except AttributeError:
|
||||
try:
|
||||
license = plugin_app_config.license
|
||||
except AttributeError:
|
||||
license = ''
|
||||
return license
|
||||
|
||||
|
||||
def get_plugin_url(plugin: str) -> str:
|
||||
"""
|
||||
Returns the url of a plugin. The plugin argument must be a
|
||||
python dotted module path.
|
||||
"""
|
||||
plugin_app_config = apps.get_app_config(plugin)
|
||||
try:
|
||||
url = plugin_app_config.get_url()
|
||||
except AttributeError:
|
||||
try:
|
||||
url = plugin_app_config.url
|
||||
except AttributeError:
|
||||
url = ''
|
||||
return url
|
||||
|
||||
|
||||
def get_plugin_urlpatterns(plugin: str) -> Any:
|
||||
"""
|
||||
Returns the urlpatterns object for a plugin. The plugin argument must be
|
||||
|
6
setup.py
6
setup.py
@ -5,6 +5,8 @@ from setuptools import find_packages, setup
|
||||
from openslides import __author__ as openslides_author
|
||||
from openslides import __description__ as openslides_description
|
||||
from openslides import __version__ as openslides_version
|
||||
from openslides import __license__ as openslides_license
|
||||
from openslides import __url__ as openslides_url
|
||||
|
||||
with open('README.rst') as readme:
|
||||
long_description = readme.read()
|
||||
@ -17,9 +19,9 @@ setup(
|
||||
author=openslides_author,
|
||||
author_email='support@openslides.org',
|
||||
description=openslides_description,
|
||||
license='MIT',
|
||||
license=openslides_license,
|
||||
long_description=long_description,
|
||||
url='https://openslides.org',
|
||||
url=openslides_url,
|
||||
version=openslides_version,
|
||||
|
||||
classifiers=[
|
||||
|
@ -5,6 +5,8 @@ from django.core.urlresolvers import reverse
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from openslides import __license__ as license
|
||||
from openslides import __url__ as url
|
||||
from openslides import __version__ as version
|
||||
from openslides.core.config import ConfigVariable, config
|
||||
from openslides.core.models import Projector
|
||||
@ -71,10 +73,14 @@ class VersionView(TestCase):
|
||||
response = self.client.get(reverse('core_version'))
|
||||
self.assertEqual(json.loads(response.content.decode()), {
|
||||
'openslides_version': version,
|
||||
'openslides_license': license,
|
||||
'openslides_url': url,
|
||||
'plugins': [
|
||||
{'verbose_name': 'OpenSlides Test Plugin',
|
||||
'description': 'This is a test plugin for OpenSlides.',
|
||||
'version': 'unknown'}]})
|
||||
'version': 'unknown',
|
||||
'license': 'MIT',
|
||||
'url': ''}]})
|
||||
|
||||
|
||||
class WebclientJavaScriptView(TestCase):
|
||||
|
@ -1,4 +1,5 @@
|
||||
__verbose_name__ = 'OpenSlides Test Plugin'
|
||||
__description__ = 'This is a test plugin for OpenSlides.'
|
||||
__license__ = 'MIT'
|
||||
|
||||
default_app_config = 'tests.integration.test_plugin.apps.TestPluginAppConfig'
|
||||
|
@ -1,6 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
from . import __description__, __verbose_name__
|
||||
from . import __description__, __license__, __verbose_name__
|
||||
|
||||
|
||||
class TestPluginAppConfig(AppConfig):
|
||||
@ -11,3 +11,4 @@ class TestPluginAppConfig(AppConfig):
|
||||
label = 'tests.integration.test_plugin'
|
||||
verbose_name = __verbose_name__
|
||||
description = __description__
|
||||
license = __license__
|
||||
|
Loading…
Reference in New Issue
Block a user