diff --git a/HISTORY.rst b/HISTORY.rst index 33c632cde1..a4aaac2604 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,3 +1,7 @@ +3.3 (2019-XX-XX) +================ +* Add support for icon shadows. + 3.2.5 (2019-07-05) ================== * Don't error out if the EXTRA_APPS or the DISABLED_APPS settings diff --git a/docs/releases/3.3.rst b/docs/releases/3.3.rst new file mode 100644 index 0000000000..229f7a466c --- /dev/null +++ b/docs/releases/3.3.rst @@ -0,0 +1,101 @@ +Version 3.3 +=========== + +Released: XX XX, 2019 + + +Changes +------- + +- Add support for icon shadows. + +Removals +-------- + +- None + + +Upgrading from a previous version +--------------------------------- + +If installed via Python's PIP +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Remove deprecated requirements:: + + $ curl https://gitlab.com/mayan-edms/mayan-edms/raw/master/removals.txt | pip uninstall -r /dev/stdin + +Type in the console:: + + $ pip install mayan-edms==3.3 + +the requirements will also be updated automatically. + + +Using Git +^^^^^^^^^ + +If you installed Mayan EDMS by cloning the Git repository issue the commands:: + + $ git reset --hard HEAD + $ git pull + +otherwise download the compressed archived and uncompress it overriding the +existing installation. + +Remove deprecated requirements:: + + $ pip uninstall -y -r removals.txt + +Next upgrade/add the new requirements:: + + $ pip install --upgrade -r requirements.txt + + +Common steps +^^^^^^^^^^^^ + +Perform these steps after updating the code from either step above. + +Make a backup of your supervisord file:: + + sudo cp /etc/supervisor/conf.d/mayan.conf /etc/supervisor/conf.d/mayan.conf.bck + +Update the supervisord configuration file. Replace the environment +variables values show here with your respective settings. This step will refresh +the supervisord configuration file with the new queues and the latest +recommended layout:: + + sudo MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \ + MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan \ + MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=/opt/mayan-edms/media \ + /opt/mayan-edms/bin/mayan-edms.py platformtemplate supervisord > /etc/supervisor/conf.d/mayan.conf + +Edit the supervisord configuration file and update any setting the template +generator missed:: + + sudo vi /etc/supervisor/conf.d/mayan.conf + +Migrate existing database schema with:: + + $ mayan-edms.py performupgrade + +Add new static media:: + + $ mayan-edms.py preparestatic --noinput + +The upgrade procedure is now complete. + + +Backward incompatible changes +----------------------------- + +- None + + +Bugs fixed or issues closed +--------------------------- + +- :gitlab-issue:`XX` + +.. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/docs/releases/index.rst b/docs/releases/index.rst index 80bdb19c1e..33d838bd3d 100644 --- a/docs/releases/index.rst +++ b/docs/releases/index.rst @@ -20,6 +20,7 @@ versions of the documentation contain the release notes for any later releases. .. toctree:: :maxdepth: 1 + 3.3 3.2.5 3.2.4 3.2.3 diff --git a/mayan/apps/appearance/classes.py b/mayan/apps/appearance/classes.py index 9b05a39fc3..7f1ad604ec 100644 --- a/mayan/apps/appearance/classes.py +++ b/mayan/apps/appearance/classes.py @@ -4,6 +4,7 @@ from django.template.loader import get_template class IconDriver(object): + context = {} _registry = {} @classmethod @@ -14,6 +15,17 @@ class IconDriver(object): def register(cls, driver_class): cls._registry[driver_class.name] = driver_class + def get_context(self): + return self.context + + def render(self, extra_context=None): + context = self.get_context() + if extra_context: + context.update(extra_context) + return get_template(template_name=self.template_name).render( + context=context + ) + class FontAwesomeDriver(IconDriver): name = 'fontawesome' @@ -22,10 +34,8 @@ class FontAwesomeDriver(IconDriver): def __init__(self, symbol): self.symbol = symbol - def render(self): - return get_template(template_name=self.template_name).render( - context={'symbol': self.symbol} - ) + def get_context(self): + return {'symbol': self.symbol} class FontAwesomeDualDriver(IconDriver): @@ -36,23 +46,21 @@ class FontAwesomeDualDriver(IconDriver): self.primary_symbol = primary_symbol self.secondary_symbol = secondary_symbol - def render(self): - return get_template(template_name=self.template_name).render( - context={ - 'data': ( - { - 'class': 'fas fa-circle', - 'transform': 'down-3 right-10', - 'mask': 'fas fa-{}'.format(self.primary_symbol) - }, - {'class': 'far fa-circle', 'transform': 'down-3 right-10'}, - { - 'class': 'fas fa-{}'.format(self.secondary_symbol), - 'transform': 'shrink-4 down-3 right-10' - }, - ) - } - ) + def get_context(self): + return { + 'data': ( + { + 'class': 'fas fa-circle', + 'transform': 'down-3 right-10', + 'mask': 'fas fa-{}'.format(self.primary_symbol) + }, + {'class': 'far fa-circle', 'transform': 'down-3 right-10'}, + { + 'class': 'fas fa-{}'.format(self.secondary_symbol), + 'transform': 'shrink-4 down-3 right-10' + }, + ) + } class FontAwesomeCSSDriver(IconDriver): @@ -62,10 +70,8 @@ class FontAwesomeCSSDriver(IconDriver): def __init__(self, css_classes): self.css_classes = css_classes - def render(self): - return get_template(template_name=self.template_name).render( - context={'css_classes': self.css_classes} - ) + def get_context(self): + return {'css_classes': self.css_classes} class FontAwesomeMasksDriver(IconDriver): @@ -75,23 +81,23 @@ class FontAwesomeMasksDriver(IconDriver): def __init__(self, data): self.data = data - def render(self): - return get_template(template_name=self.template_name).render( - context={'data': self.data} - ) + def get_context(self): + return {'data': self.data} class FontAwesomeLayersDriver(IconDriver): name = 'fontawesome-layers' template_name = 'appearance/icons/font_awesome_layers.html' - def __init__(self, data): + def __init__(self, data, shadow_class=None): self.data = data + self.shadow_class = shadow_class - def render(self): - return get_template(template_name=self.template_name).render( - context={'data': self.data} - ) + def get_context(self): + return { + 'data': self.data, + 'shadow_class': self.shadow_class, + } class Icon(object): diff --git a/mayan/apps/appearance/templates/appearance/icons/font_awesome_layers.html b/mayan/apps/appearance/templates/appearance/icons/font_awesome_layers.html index 4356ad89e1..8a8b454966 100644 --- a/mayan/apps/appearance/templates/appearance/icons/font_awesome_layers.html +++ b/mayan/apps/appearance/templates/appearance/icons/font_awesome_layers.html @@ -1,4 +1,7 @@ + {% if enable_shadow %} + + {% endif %} {% for entry in data %} {% endfor %} diff --git a/mayan/apps/appearance/templates/appearance/icons/font_awesome_symbol.html b/mayan/apps/appearance/templates/appearance/icons/font_awesome_symbol.html index fac6aeca4d..84e7b87eb8 100644 --- a/mayan/apps/appearance/templates/appearance/icons/font_awesome_symbol.html +++ b/mayan/apps/appearance/templates/appearance/icons/font_awesome_symbol.html @@ -1 +1,8 @@ - +{% if enable_shadow %} + + + + +{% else %} + +{% endif %} diff --git a/mayan/apps/appearance/templatetags/appearance_tags.py b/mayan/apps/appearance/templatetags/appearance_tags.py index 05c3ba043d..eb9cf1bc02 100644 --- a/mayan/apps/appearance/templatetags/appearance_tags.py +++ b/mayan/apps/appearance/templatetags/appearance_tags.py @@ -7,6 +7,11 @@ from django.utils.translation import ugettext_lazy as _ register = Library() +@register.simple_tag +def appearance_icon_render(icon_class, enable_shadow=False): + return icon_class.render(extra_context={'enable_shadow': enable_shadow}) + + @register.filter def get_choice_value(field): try: diff --git a/mayan/apps/documents/icons.py b/mayan/apps/documents/icons.py index 7d411a30f0..8b9b4067d9 100644 --- a/mayan/apps/documents/icons.py +++ b/mayan/apps/documents/icons.py @@ -7,7 +7,7 @@ icon_document_type = Icon( driver_name='fontawesome-layers', data=[ {'class': 'fas fa-circle', 'transform': 'shrink-12 up-2'}, {'class': 'fas fa-cog', 'transform': 'shrink-6 up-2', 'mask': 'fas fa-torah'} - ] + ], shadow_class='fas fa-torah' ) icon_menu_documents = Icon(driver_name='fontawesome', symbol='book') diff --git a/mayan/apps/navigation/templates/navigation/large_button_link.html b/mayan/apps/navigation/templates/navigation/large_button_link.html index dacbe785d9..e9c2d84f97 100644 --- a/mayan/apps/navigation/templates/navigation/large_button_link.html +++ b/mayan/apps/navigation/templates/navigation/large_button_link.html @@ -1,6 +1,8 @@ +{% load appearance_tags %} +
- - {% if link.icon_class %}{{ link.icon_class.render }}{% endif %} + + {% if link.icon_class %}{% appearance_icon_render link.icon_class enable_shadow=True %}{% endif %}
{{ link.text }}