Add support for truncating view titles via the APPEARANCE_MAXIMUM_TITLE_LENGTH
setting. The default value is 80 characters. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ XX (2017-XX-XX)
|
||||
- Add support for updating configuration options from environment variables.
|
||||
- Add purgelocks management command. GitLab issue #221.
|
||||
- Fix index rebuilding for multi value first levels. GitLab issue #391.
|
||||
- Truncate views titles via the APPEARANCE_MAXIMUM_TITLE_LENGTH setting. GitLab issue #217.
|
||||
|
||||
2.3 (2017-06-08)
|
||||
================
|
||||
|
||||
1
mayan/apps/appearance/literals.py
Normal file
1
mayan/apps/appearance/literals.py
Normal file
@@ -0,0 +1 @@
|
||||
DEFAULT_MAXIMUM_TITLE_LENGTH = 80
|
||||
13
mayan/apps/appearance/settings.py
Normal file
13
mayan/apps/appearance/settings.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from smart_settings import Namespace
|
||||
|
||||
from .literals import DEFAULT_MAXIMUM_TITLE_LENGTH
|
||||
|
||||
namespace = Namespace(name='appearance', label=_('Appearance'))
|
||||
setting_max_title_length = namespace.add_setting(
|
||||
global_name='APPEARANCE_MAXIMUM_TITLE_LENGTH',
|
||||
default=DEFAULT_MAXIMUM_TITLE_LENGTH
|
||||
)
|
||||
@@ -1,7 +1,11 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% load smart_settings_tags %}
|
||||
|
||||
{% smart_setting 'APPEARANCE_MAXIMUM_TITLE_LENGTH' as maximum_title_length %}
|
||||
|
||||
{% if title %}
|
||||
{{ title }}
|
||||
{{ title|truncatechars:maximum_title_length }}
|
||||
{% else %}
|
||||
{% if read_only %}
|
||||
{% blocktrans %}Details for: {{ object }}{% endblocktrans %}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
{% block content %}
|
||||
{% if title %}
|
||||
<h3>{{ title }}</h3>
|
||||
<h3>{% include 'appearance/calculate_form_title.html' %}</h3>
|
||||
<hr>
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user