Unify the way to gather the project's metadata.

Signed-off-by: Michael Price <loneviking72@gmail.com>
This commit is contained in:
Michael Price
2018-03-18 04:00:32 -04:00
committed by Roberto Rosario
parent eb5bd252db
commit c7fda3447c
10 changed files with 30 additions and 52 deletions

View File

@@ -49,6 +49,7 @@ Next (2018-XX-XX)
- Add support for OR type searches. Use the "OR" string between the terms. Example: term1 OR term2.
- Removed redundant permissions checks.
- Move the page count display to the top of the image.
- Unify the way to gather the project's metadata. Use mayan.__XX__ and a new common tag named {% project_information '' %}
2.8 (2018-02-27)
================

View File

@@ -8,3 +8,5 @@ __author_email__ = 'roberto.rosario@mayan-edms.com'
__description__ = 'Free Open Source Electronic Document Management System'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2011-2016 Roberto Rosario'
__website__ = 'https://www.mayan-edms.com'

View File

@@ -59,21 +59,22 @@
{% build as build_number %}
<div class="well">
<h3 class="text-center">{% project_name %} ({% trans 'Version' %} {% project_version %})</h3>
<h3 class="text-center">{% project_information '__title__' %} ({% trans 'Version' %} {% project_information '__version__' %})</h3>
{% if build_number %}
<p class='text-center'>{% blocktrans with build_number as build_number %}Build number: {{ build_number }}{% endblocktrans %}</p>
{% endif %}
<p class="text-center">
{% project_description as project_description %}
{% project_information '__description__' as project_description %}
{% trans project_description %}
</p>
<p class="text-center">
<i class="fa fa-home"></i><a href="{% project_website %}"> {% project_website %}</a>
<i class="fa fa-home"></i><a href="{% project_information '__website__' %}"> {% project_information '__website__' %}</a>
</p>
<p class="text-center">
{% trans 'Released under the Apache 2.0 License' %}
{% project_information '__license__' as license_information %}
{% trans 'Released under the license:' %} {% trans license_information %}
</p>
<p class="text-center mayan-edms-logo">Mayan <span class="icon-mayan-edms-logo"></span> EDMS</p>
@@ -85,7 +86,7 @@
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-body">
{% trans 'Copyright &copy; 2011-2015 Roberto Rosario.' %}
{% project_information '__copyright__' %}
</div>
</div>
</div>

View File

@@ -105,6 +105,6 @@ var DjangoMessages = [
{% block javascript %}{% endblock %}
<script>
document.title = '{% spaceless %}{% block title %}{% endblock %}{% endspaceless %} :: {% block project_name %}{% project_name %}{% endblock %}';
document.title = '{% spaceless %}{% block title %}{% endblock %}{% endspaceless %} :: {% block project_name %}{% project_information '__title__' %}{% endblock %}';
afterBaseLoad();
</script>

View File

@@ -17,7 +17,7 @@
<meta http-equiv="Content-Language" content="{{ LANGUAGE_CODE }}" />
<title>
{% block base_title %}
{% block title %}{% endblock %} :: {% block project_name %}{% project_name %}{% endblock %}
{% block title %}{% endblock %} :: {% block project_name %}{% project_information '__title__' %}{% endblock %}
{% endblock base_title %}
</title>

View File

@@ -17,7 +17,7 @@
<meta http-equiv="Content-Language" content="{{ LANGUAGE_CODE }}" />
<title>
{% block base_title %}
{% block title %}{% endblock %} :: {% block project_name %}{% project_name %}{% endblock %}
{% block title %}{% endblock %} :: {% block project_name %}{% project_information '__title__' %}{% endblock %}
{% endblock base_title %}
</title>
@@ -58,7 +58,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url home_view %}">{% project_name %}</a>
<a class="navbar-brand" href="{% url home_view %}">{% project_information '__title__' %}</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">

View File

@@ -14,6 +14,8 @@ from django.utils.translation import ugettext_lazy as _
from stronghold.decorators import public
import mayan
from .forms import EmailAuthenticationForm, UsernameAuthenticationForm
from .settings import setting_login_method, setting_maximum_session_length
@@ -124,10 +126,10 @@ def password_reset_view(request):
request, extra_context=extra_context,
email_template_name='authentication/password_reset_email.html',
extra_email_context={
'project_title': settings.PROJECT_TITLE,
'project_website': settings.PROJECT_WEBSITE,
'project_copyright': settings.PROJECT_COPYRIGHT,
'project_license': settings.PROJECT_LICENSE,
'project_title': mayan.__title__,
'project_website': mayan.__website__,
'project_copyright': mayan.__copyright__,
'project_license': mayan.__license__,
}, subject_template_name='authentication/password_reset_subject.txt',
template_name='authentication/password_reset_form.html',
post_reset_redirect=reverse(

View File

@@ -42,41 +42,16 @@ def get_encoded_parameter(item, parameters_dict):
return dumps(result)
@register.simple_tag
def project_information(attribute_name):
return getattr(mayan, attribute_name)
@register.filter
def object_property(value, arg):
return return_attrib(value, arg)
@register.simple_tag
def project_copyright():
return settings.PROJECT_COPYRIGHT
@register.simple_tag
def project_description():
return getattr(settings, 'PROJECT_DESCRIPTION', mayan.__description__)
@register.simple_tag
def project_license():
return settings.PROJECT_LICENSE
@register.simple_tag
def project_name():
return settings.PROJECT_TITLE
@register.simple_tag
def project_website():
return settings.PROJECT_WEBSITE
@register.simple_tag
def project_version():
return mayan.__version__
@register.simple_tag(takes_context=True)
def render_subtemplate(context, template_name, template_context):
"""

View File

@@ -9,6 +9,8 @@ from django.utils.translation import ugettext_lazy as _
from acls.models import AccessControlList
from common.forms import DynamicModelForm
import mayan
from .classes import MailerBackend
from .models import UserMailer
from .permissions import permission_user_mailer_use
@@ -31,16 +33,16 @@ class DocumentMailForm(forms.Form):
self.fields[
'body'
].initial = setting_document_body_template.value % {
'project_title': settings.PROJECT_TITLE,
'project_website': settings.PROJECT_WEBSITE
'project_title': mayan.__title__,
'project_website': mayan.__website__
}
else:
self.fields[
'subject'
].initial = setting_link_subject_template.value
self.fields['body'].initial = setting_link_body_template.value % {
'project_title': settings.PROJECT_TITLE,
'project_website': settings.PROJECT_WEBSITE
'project_title': mayan.__title__,
'project_website': mayan.__website__
}
queryset = AccessControlList.objects.filter_by_access(

View File

@@ -197,11 +197,6 @@ STATIC_URL = '/static/'
# ------------ Custom settings section ----------
PROJECT_TITLE = mayan.__title__
PROJECT_WEBSITE = 'http://www.mayan-edms.com'
PROJECT_COPYRIGHT = mayan.__copyright__
PROJECT_LICENSE = mayan.__license__
LANGUAGES = (
('ar', _('Arabic')),
('bg', _('Bulgarian')),