Unify template title rendering. Add support for template subtitles.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-08-14 03:32:19 -04:00
parent fe9a395724
commit 57e1fe8cf0
17 changed files with 40 additions and 89 deletions

View File

@@ -31,6 +31,8 @@
- Remove code statistics from the documentation.
- Remove the pending work chapter. This is now available in the Wiki:
wiki.mayan-edms.com
- Unify template title rendering.
- Add support for template subtitles.
3.0.1 (2018-07-08)
=================

View File

@@ -54,9 +54,6 @@
{% endblock stylesheets %}
{% block content %}
<h3>{% trans 'About' %}</h3>
<hr>
{% build as build_number %}
<div class="well">
<h3 class="text-center">{% project_information '__title__' %} ({% trans 'Version' %} {% project_information '__version__' %})</h3>

View File

@@ -45,6 +45,7 @@
{% else %}
<div class="col-xs-12">
{% endif %}
{% include 'appearance/calculate_form_title.html' %}
{% block content %}{% endblock %}
{% block footer %}{% endblock %}
</div>

View File

@@ -4,25 +4,37 @@
{% smart_setting 'APPEARANCE_MAXIMUM_TITLE_LENGTH' as maximum_title_length %}
{# Avoid horizontal scroll on small displays #}
{% if not html_title %}
<span style="word-break: break-all;">
{% if not non_html_title %}
<h3>
{% endif %}
{% if title %}
{{ title|truncatechars:maximum_title_length }}
{% else %}
{% if read_only %}
{% blocktrans %}Details for: {{ object }}{% endblocktrans %}
{% if delete_view %}
{% trans 'Confirm delete' %}
{% else %}
{% if object %}
{% blocktrans with object as object %}Edit: {{ object }}{% endblocktrans %}
{% if form %}
{% trans 'Confirm' %}
{% else %}
{% trans 'Create' %}
{% if read_only %}
{% blocktrans %}Details for: {{ object }}{% endblocktrans %}
{% else %}
{% if object %}
{% blocktrans with object as object %}Edit: {{ object }}{% endblocktrans %}
{% else %}
{% trans 'Create' %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if not html_title %}
</span>
{% if not non_html_title %}
</h3>
{% if subtitle %}
<small>{{ subtitle }}</small>
{% endif %}
<hr/>
{% endif %}

View File

@@ -3,30 +3,15 @@
{% load i18n %}
{% load static %}
{% block title %}{% trans 'Confirm' %} {{ title }}{% endblock %}
{% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %}
{% block content %}
<h3>
{% if delete_view %}
{% trans 'Confirm delete' %}
{% else %}
{% trans 'Confirm' %}
{% endif %}
</h3>
<hr>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">
{% if title %}
<h3>{{ title }}</h3>
{% else %}
{% if delete_view %}
<h3>{% blocktrans %}Delete: {{ object }}?{% endblocktrans %}</h3>
{% endif %}
{% endif %}
<h3>{% trans 'Are you sure?' %}</h3>
</h4>
</div>
{% if message %}

View File

@@ -2,12 +2,8 @@
{% load common_tags %}
{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %}
{% block content %}
<h3>{% include 'appearance/calculate_form_title.html' %}</h3>
<hr>
{% if form %}
{% with '' as title %}
{% include "appearance/generic_form_subtemplate.html" %}

View File

@@ -4,14 +4,9 @@
{% load navigation_tags %}
{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %}
{% block content %}
{% if title %}
<h3>{% include 'appearance/calculate_form_title.html' %}</h3>
<hr>
{% endif %}
{% if list_as_items %}
{% include 'appearance/generic_list_items_subtemplate.html' %}
{% else %}

View File

@@ -8,10 +8,6 @@
{% block title %}{{ title }}{% endblock %}
{% block content %}
<h3>
{{ title }}
</h3>
<hr>
<div class="well center-block">
<div class="row">
{% with 'navigation/large_button_link.html' as link_template %}

View File

@@ -2,14 +2,9 @@
{% load common_tags %}
{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %}
{% block content %}
{% if main_title %}
<h3>{{ main_title }}</h3>
<hr>
{% endif %}
<div class="row">
{% for subtemplate in subtemplates_list %}
{% if subtemplate.column_class %}

View File

@@ -1,9 +1,5 @@
{% load i18n %}
{% load static %}
<h4>
{% include 'appearance/calculate_form_title.html' %}
</h4>
<hr>
<div class="well">
{% if is_multipart %}
<form action="{{ form_action }}" class="{{ form_class|default:'' }}" enctype="multipart/form-data" id="{{ form_id|default:'' }}" method="{{ submit_method|default:'post' }}">

View File

@@ -3,7 +3,5 @@
{% block title %}{{ title }}{% endblock %}
{% block content %}
<h3>{{ title }}</h3>
<hr>
{% include 'appearance/generic_subtemplate.html' %}
{% endblock %}

View File

@@ -2,12 +2,9 @@
{% load i18n %}
{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %}
{% block content %}
<h3>{% include 'appearance/calculate_form_title.html' %}</h3>
<hr>
{{ wizard.management_form }}
{% with step_title as title %}

View File

@@ -17,11 +17,6 @@
{% endblock javascript %}
{% block content %}
<h3>
{% trans 'Dashboard' %}
</h3>
<hr>
<div class="row">
<div class="col-xs-12">
{% if missing_list %}

View File

@@ -5,17 +5,13 @@
{% load navigation_tags %}
{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{% static 'cabinets/packages/jstree/dist/themes/default/style.min.css' %}" />
{% endblock %}
{% block content %}
{% if title %}
<h3>{{ title }}</h3>
<hr>
{% endif %}
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-2">
<h4>{% trans 'Navigation:' %}</h4>

View File

@@ -34,7 +34,8 @@ from .permissions_runtime import permission_error_log_view
from .utils import check_version
class AboutView(TemplateView):
class AboutView(SimpleView):
extra_context = {'title': _('About')}
template_name = 'appearance/about.html'

View File

@@ -4,14 +4,9 @@
{% load navigation_tags %}
{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %}
{% block content %}
{% if title %}
<h3>{{ title }}</h3>
<hr>
{% endif %}
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-3">
{{ navigation }}

View File

@@ -177,23 +177,17 @@ class SetupWorkflowDocumentTypesView(AssignRemoveView):
# TODO: add task launching this workflow for all the document types
# of item
def dispatch(self, request, *args, **kwargs):
messages.warning(
self.request, _(
def get_extra_context(self):
return {
'object': self.get_object(),
'subtitle': _(
'Removing a document type from a workflow will also '
'remove all running instances of that workflow for '
'documents of the document type just removed.'
)
)
return super(SetupWorkflowDocumentTypesView, self).dispatch(request, *args, **kwargs)
def get_extra_context(self):
return {
),
'title': _(
'Document types assigned the workflow: %s'
) % self.get_object(),
'object': self.get_object(),
}
def get_object(self):