Add COMMON_PROJECT_TITLE as a setting option to customize the title string.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -48,6 +48,9 @@
|
|||||||
- Hide the title link of documents in the trash.
|
- Hide the title link of documents in the trash.
|
||||||
- Add support for document metadata events: add, edit and remove.
|
- Add support for document metadata events: add, edit and remove.
|
||||||
- Add workflow action to update the label and description of a document.
|
- 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)
|
3.0.1 (2018-07-08)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% load common_tags %}
|
{% load common_tags %}
|
||||||
|
{% load smart_settings_tags %}
|
||||||
|
|
||||||
{% block title %}{% trans 'About' %}{% endblock %}
|
{% block title %}{% trans 'About' %}{% endblock %}
|
||||||
|
|
||||||
@@ -55,8 +56,20 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% build as build_number %}
|
{% build as build_number %}
|
||||||
|
{% smart_setting 'COMMON_PROJECT_TITLE' as setting_project_title %}
|
||||||
|
{% project_information '__title__' as project_title %}
|
||||||
|
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<h3 class="text-center">{% project_information '__title__' %} ({% trans 'Version' %} {% project_information '__version__' %})</h3>
|
<h3 class="text-center">{{ setting_project_title }}</h3>
|
||||||
|
{% if project_title != setting_project_title %}
|
||||||
|
<br>
|
||||||
|
<p class="text-center">
|
||||||
|
{% blocktrans with setting_project_title as setting_project_title and project_title as project_title %}
|
||||||
|
{{ setting_project_title }} is based on {{ project_title }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
<p class="text-center">{% trans 'Version' %} {% project_information '__version__' %}</p>
|
||||||
{% if build_number %}
|
{% if build_number %}
|
||||||
<p class='text-center'>{% blocktrans with build_number as build_number %}Build number: {{ build_number }}{% endblocktrans %}</p>
|
<p class='text-center'>{% blocktrans with build_number as build_number %}Build number: {{ build_number }}{% endblocktrans %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
{% load common_tags %}
|
{% load common_tags %}
|
||||||
{% load navigation_tags %}
|
{% load navigation_tags %}
|
||||||
|
{% load smart_settings_tags %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
if (typeof partialNavigation === 'undefined') {
|
if (typeof partialNavigation === 'undefined') {
|
||||||
@@ -112,6 +113,6 @@
|
|||||||
{% block javascript %}{% endblock %}
|
{% block javascript %}{% endblock %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.title = '{% filter escapejs %}{% spaceless %}{% block title %}{% endblock %} :: {% block project_name %}{% project_information '__title__' %}{% endblock %}{% endspaceless %}{% endfilter %}';
|
document.title = '{% filter escapejs %}{% spaceless %}{% block title %}{% endblock %} :: {% block project_name %}{% smart_setting "COMMON_PROJECT_TITLE" %}{% endblock %}{% endspaceless %}{% endfilter %}';
|
||||||
afterBaseLoad();
|
afterBaseLoad();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
{% load common_tags %}
|
{% load common_tags %}
|
||||||
{% load navigation_tags %}
|
{% load navigation_tags %}
|
||||||
|
{% load smart_settings_tags %}
|
||||||
|
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
<meta http-equiv="Content-Language" content="{{ LANGUAGE_CODE }}" />
|
<meta http-equiv="Content-Language" content="{{ LANGUAGE_CODE }}" />
|
||||||
<title>
|
<title>
|
||||||
{% block base_title %}
|
{% 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 %}
|
{% endblock base_title %}
|
||||||
</title>
|
</title>
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="{% url home_view %}">{% project_information '__title__' %}</a>
|
<a class="navbar-brand" href="{% url home_view %}">{% smart_setting 'COMMON_PROJECT_TITLE' %}</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="navbar" class="navbar-collapse collapse">
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
{% load autoadmin_tags %}
|
{% load autoadmin_tags %}
|
||||||
{% load common_tags %}
|
{% load common_tags %}
|
||||||
{% load motd_tags %}
|
{% load motd_tags %}
|
||||||
|
{% load smart_settings_tags %}
|
||||||
|
|
||||||
{% block base_title %}{% trans 'Login' %}{% endblock %}
|
{% block base_title %}{% trans 'Login' %}{% endblock %}
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
<h3 class="panel-title">{% trans "First time login" %}</h3>
|
<h3 class="panel-title">{% trans "First time login" %}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% project_information '__title__' as project_title %}
|
{% smart_setting 'COMMON_PROJECT_TITLE' as project_title %}
|
||||||
<p>{% blocktrans %}You have just finished installing <strong>{{ project_title }}</strong>, congratulations!{% endblocktrans %}</p>
|
<p>{% blocktrans %}You have just finished installing <strong>{{ project_title }}</strong>, congratulations!{% endblocktrans %}</p>
|
||||||
<p>{% trans 'Login using the following credentials:' %}</p>
|
<p>{% trans 'Login using the following credentials:' %}</p>
|
||||||
<p>{% blocktrans with autoadmin_properties.account as account %}Username: <strong>{{ account }}</strong>{% endblocktrans %}</p>
|
<p>{% blocktrans with autoadmin_properties.account as account %}Username: <strong>{{ account }}</strong>{% endblocktrans %}</p>
|
||||||
|
|||||||
@@ -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())
|
|
||||||
)
|
|
||||||
@@ -6,9 +6,11 @@ import tempfile
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
import mayan
|
||||||
from smart_settings import Namespace
|
from smart_settings import Namespace
|
||||||
|
|
||||||
namespace = Namespace(name='common', label=_('Common'))
|
namespace = Namespace(name='common', label=_('Common'))
|
||||||
|
|
||||||
setting_auto_logging = namespace.add_setting(
|
setting_auto_logging = namespace.add_setting(
|
||||||
global_name='COMMON_AUTO_LOGGING',
|
global_name='COMMON_AUTO_LOGGING',
|
||||||
default=True,
|
default=True,
|
||||||
@@ -22,13 +24,6 @@ settings_db_sync_task_delay = namespace.add_setting(
|
|||||||
'propagate.'
|
'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(
|
setting_paginate_by = namespace.add_setting(
|
||||||
global_name='COMMON_PAGINATE_BY',
|
global_name='COMMON_PAGINATE_BY',
|
||||||
default=40,
|
default=40,
|
||||||
@@ -45,7 +40,7 @@ setting_shared_storage_arguments = namespace.add_setting(
|
|||||||
global_name='COMMON_SHARED_STORAGE_ARGUMENTS',
|
global_name='COMMON_SHARED_STORAGE_ARGUMENTS',
|
||||||
default='{{location: {}}}'.format(
|
default='{{location: {}}}'.format(
|
||||||
os.path.join(settings.MEDIA_ROOT, 'shared_files')
|
os.path.join(settings.MEDIA_ROOT, 'shared_files')
|
||||||
)
|
), quoted=True
|
||||||
)
|
)
|
||||||
setting_temporary_directory = namespace.add_setting(
|
setting_temporary_directory = namespace.add_setting(
|
||||||
global_name='COMMON_TEMPORARY_DIRECTORY', default=tempfile.gettempdir(),
|
global_name='COMMON_TEMPORARY_DIRECTORY', default=tempfile.gettempdir(),
|
||||||
@@ -70,3 +65,9 @@ setting_production_error_log_path = namespace.add_setting(
|
|||||||
),
|
),
|
||||||
is_path=True
|
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.'
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|||||||
@@ -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
|
|
||||||
)
|
|
||||||
@@ -9,4 +9,4 @@ register = Library()
|
|||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def smart_setting(global_name):
|
def smart_setting(global_name):
|
||||||
return Setting.get(global_name=global_name)
|
return Setting.get(global_name=global_name).value
|
||||||
|
|||||||
Reference in New Issue
Block a user