Make icon classes file template based.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-09-17 17:08:15 -04:00
parent 58f7b1b555
commit 62e221ffbb
5 changed files with 13 additions and 7 deletions

View File

@@ -159,6 +159,7 @@
from 32 to 96 characters.
- Add file_size and datetime fields to the DocumentPageCachedImage
model.
- Make icon classes file template based.
3.0.3 (2018-08-17)
==================

View File

@@ -373,6 +373,9 @@ classes beyond the provide line chart.
- Expose more document fields for use in smart links.
- The size of the document type label field has been increased
from 32 to 96 characters.
- Add file_size and datetime fields to the DocumentPageCachedImage
model.
- Make icon classes file template based.
Removals
--------

View File

@@ -1,6 +1,6 @@
from __future__ import unicode_literals
from django.template import Context, Template
from django.template.loader import get_template
class IconDriver(object):
@@ -17,27 +17,27 @@ class IconDriver(object):
class FontAwesomeDriver(IconDriver):
name = 'fontawesome'
template_text = '<i class="hidden-xs hidden-sm hidden-md fa fa-{{ symbol }}"></i>'
template_name = 'appearance/icons/font_awesome_symbol.html'
def __init__(self, symbol):
self.symbol = symbol
def render(self):
return Template(self.template_text).render(
context=Context({'symbol': self.symbol})
return get_template(self.template_name).render(
context={'symbol': self.symbol}
)
class FontAwesomeCSSDriver(IconDriver):
name = 'fontawesomecss'
template_text = '<i class="hidden-xs hidden-sm hidden-md fa {{ css_classes }}"></i>'
template_name = 'appearance/icons/font_awesome_css.html'
def __init__(self, css_classes):
self.css_classes = css_classes
def render(self):
return Template(self.template_text).render(
context=Context({'css_classes': self.css_classes})
return get_template(self.template_name).render(
context={'css_classes': self.css_classes}
)

View File

@@ -0,0 +1 @@
<i class="hidden-xs hidden-sm hidden-md fa {{ css_classes }}"></i>

View File

@@ -0,0 +1 @@
<i class="hidden-xs hidden-sm hidden-md fa fa-{{ symbol }}"></i>