diff --git a/HISTORY.rst b/HISTORY.rst index cdb753f03b..da9cb9b890 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -48,6 +48,9 @@ - Hide the title link of documents in the trash. - Add support for document metadata events: add, edit and remove. - Add workflow action to update the label and description of a document. +- Add COMMON_PROJECT_TITLE as a setting option to customize the title + string. + 3.0.1 (2018-07-08) diff --git a/mayan/apps/appearance/templates/appearance/about.html b/mayan/apps/appearance/templates/appearance/about.html index cdbbe04919..1f65748840 100644 --- a/mayan/apps/appearance/templates/appearance/about.html +++ b/mayan/apps/appearance/templates/appearance/about.html @@ -4,6 +4,7 @@ {% load static %} {% load common_tags %} +{% load smart_settings_tags %} {% block title %}{% trans 'About' %}{% endblock %} @@ -55,8 +56,20 @@ {% block content %} {% build as build_number %} + {% smart_setting 'COMMON_PROJECT_TITLE' as setting_project_title %} + {% project_information '__title__' as project_title %} +
-

{% project_information '__title__' %} ({% trans 'Version' %} {% project_information '__version__' %})

+

{{ setting_project_title }}

+ {% if project_title != setting_project_title %} +
+

+ {% blocktrans with setting_project_title as setting_project_title and project_title as project_title %} + {{ setting_project_title }} is based on {{ project_title }} + {% endblocktrans %} +

+ {% endif %} +

{% trans 'Version' %} {% project_information '__version__' %}

{% if build_number %}

{% blocktrans with build_number as build_number %}Build number: {{ build_number }}{% endblocktrans %}

{% endif %} diff --git a/mayan/apps/appearance/templates/appearance/base.html b/mayan/apps/appearance/templates/appearance/base.html index 7d9b43915f..6007292e54 100644 --- a/mayan/apps/appearance/templates/appearance/base.html +++ b/mayan/apps/appearance/templates/appearance/base.html @@ -3,6 +3,7 @@ {% load common_tags %} {% load navigation_tags %} +{% load smart_settings_tags %} diff --git a/mayan/apps/appearance/templates/appearance/root.html b/mayan/apps/appearance/templates/appearance/root.html index f94aa88285..a88a16bae2 100644 --- a/mayan/apps/appearance/templates/appearance/root.html +++ b/mayan/apps/appearance/templates/appearance/root.html @@ -3,6 +3,7 @@ {% load common_tags %} {% load navigation_tags %} +{% load smart_settings_tags %} {% spaceless %} {% block base_title %} - {% block title %}{% endblock %} :: {% block project_name %}{% project_information '__title__' %}{% endblock %} + {% block title %}{% endblock %} :: {% block project_name %}{% smart_setting 'COMMON_PROJECT_TITLE' %}{% endblock %} {% endblock base_title %} @@ -41,7 +42,7 @@ - {% project_information '__title__' %} + {% smart_setting 'COMMON_PROJECT_TITLE' %}
- {% project_information '__title__' as project_title %} + {% smart_setting 'COMMON_PROJECT_TITLE' as project_title %}

{% blocktrans %}You have just finished installing {{ project_title }}, congratulations!{% endblocktrans %}

{% trans 'Login using the following credentials:' %}

{% blocktrans with autoadmin_properties.account as account %}Username: {{ account }}{% endblocktrans %}

diff --git a/mayan/apps/common/management/commands/createsettings.py b/mayan/apps/common/management/commands/createsettings.py deleted file mode 100644 index 7a47ed1077..0000000000 --- a/mayan/apps/common/management/commands/createsettings.py +++ /dev/null @@ -1,25 +0,0 @@ -from __future__ import unicode_literals - -import os - -from django.conf import settings -from django.core import management -from django.core.management.utils import get_random_secret_key - -from ...settings import setting_local_settings_filename - -from .literals import SETTING_FILE_TEMPLATE - - -class Command(management.BaseCommand): - help = 'Creates a local settings file with a random secret key.' - - def handle(self, *args, **options): - path = os.path.join(settings.BASE_DIR, 'settings', '{}.py'.format(setting_local_settings_filename.value)) - if os.path.exists(path): - self.stdout.write(self.style.NOTICE('Existing settings file at: {0}. Backup, remove this file, and try again.'.format(path))) - else: - with open(path, 'w+') as file_object: - file_object.write( - SETTING_FILE_TEMPLATE.format(get_random_secret_key()) - ) diff --git a/mayan/apps/common/settings.py b/mayan/apps/common/settings.py index aa78de6fc0..2c45389f47 100644 --- a/mayan/apps/common/settings.py +++ b/mayan/apps/common/settings.py @@ -6,9 +6,11 @@ import tempfile from django.conf import settings from django.utils.translation import ugettext_lazy as _ +import mayan from smart_settings import Namespace namespace = Namespace(name='common', label=_('Common')) + setting_auto_logging = namespace.add_setting( global_name='COMMON_AUTO_LOGGING', default=True, @@ -22,13 +24,6 @@ settings_db_sync_task_delay = namespace.add_setting( 'propagate.' ) ) -setting_local_settings_filename = namespace.add_setting( - global_name='COMMON_LOCAL_SETTINGS_FILENAME', - default='local', help_text=_( - 'Filename of the local settings file (just the filename, extension ' - 'will be .py).' - ) -) setting_paginate_by = namespace.add_setting( global_name='COMMON_PAGINATE_BY', default=40, @@ -45,7 +40,7 @@ setting_shared_storage_arguments = namespace.add_setting( global_name='COMMON_SHARED_STORAGE_ARGUMENTS', default='{{location: {}}}'.format( os.path.join(settings.MEDIA_ROOT, 'shared_files') - ) + ), quoted=True ) setting_temporary_directory = namespace.add_setting( global_name='COMMON_TEMPORARY_DIRECTORY', default=tempfile.gettempdir(), @@ -70,3 +65,9 @@ setting_production_error_log_path = namespace.add_setting( ), is_path=True ) +setting_project_title = namespace.add_setting( + global_name='COMMON_PROJECT_TITLE', + default=mayan.__title__, help_text=_( + 'Name to be displayed in the main menu.' + ), +) diff --git a/mayan/apps/common/tests/test_commands.py b/mayan/apps/common/tests/test_commands.py deleted file mode 100644 index 4f61ef242f..0000000000 --- a/mayan/apps/common/tests/test_commands.py +++ /dev/null @@ -1,32 +0,0 @@ -from __future__ import unicode_literals - -import os -import uuid - -from django.core import management -from django.conf import settings -from django.utils.encoding import force_text - -from ..utils import fs_cleanup -from ..management.commands.literals import SETTING_FILE_TEMPLATE - -from .base import BaseTestCase - - -class CommonCommandsTestCase(BaseTestCase): - def test_createsettings_command(self): - filename = force_text(uuid.uuid4()) - with self.settings(COMMON_LOCAL_SETTINGS_FILENAME=filename): - management.call_command('createsettings', interactive=False) - file_path = os.path.join( - settings.BASE_DIR, 'settings', '{}.py'.format(filename) - ) - - with open(file_path) as file_object: - content = file_object.read() - - fs_cleanup(filename=file_path) - # Compare without the string substitution and the final linefeeds - self.assertTrue( - SETTING_FILE_TEMPLATE.replace("{0}'", '')[0:-2] in content - ) diff --git a/mayan/apps/smart_settings/templatetags/smart_settings_tags.py b/mayan/apps/smart_settings/templatetags/smart_settings_tags.py index 34c8975a1d..38f7743c0a 100644 --- a/mayan/apps/smart_settings/templatetags/smart_settings_tags.py +++ b/mayan/apps/smart_settings/templatetags/smart_settings_tags.py @@ -9,4 +9,4 @@ register = Library() @register.simple_tag def smart_setting(global_name): - return Setting.get(global_name=global_name) + return Setting.get(global_name=global_name).value