Update navigation app to new icon app
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from icons.literals import ERROR
|
||||||
|
from icons import Icon
|
||||||
|
|
||||||
|
icon_error = Icon(ERROR)
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
{% load main_settings_tags %}
|
{% load main_settings_tags %}
|
||||||
|
|
||||||
{% get_main_setting "DISABLE_ICONS" as disable_icons %}
|
|
||||||
|
|
||||||
{% if link.disabled %}
|
{% if link.disabled %}
|
||||||
<a class="{{ link.class }}" style="cursor: default;" href="#">{% if link.sprite and not disable_icons %}<span class="famfam inactive famfam-{{ link.sprite|default:'link' }}"></span>{% endif %}{{ link.text|capfirst }}{% if link.error %} - {{ link.error }}{% endif %}{% if link.active and not hide_active_anchor %}<span class="famfam active famfam-resultset_previous"></span>{% endif %}</a>{% if horizontal %}{% if not forloop.last %} | {% endif %}{% endif %}
|
<a class="{{ link.class }}" style="cursor: default;" href="#">{{ link.icon.display_small }}{{ link.text|capfirst }}{% if link.error %} - {{ link.error }}{% endif %}{% if link.active and not hide_active_anchor %}<span class="famfam active famfam-resultset_previous"></span>{% endif %}</a>{% if horizontal %}{% if not forloop.last %} | {% endif %}{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if link.condition_result %}<a class="{{ link.class }}" href="{{ link.url }}">{% if link.sprite and not disable_icons %}<span class="famfam active famfam-{{ link.sprite|default:'link' }}"></span>{% endif %}{{ link.text|capfirst }}{% if link.error %} - {{ link.error }}{% endif %}{% if link.active and not hide_active_anchor %}<span class="famfam active famfam-resultset_previous"></span>{% endif %}</a>{% if horizontal %}{% if not forloop.last %} | {% endif %}{% endif %}{% endif %}
|
{% if link.condition_result %}<a class="{{ link.class }}" href="{{ link.url }}">{{ link.icon.display_small }}{{ link.text|capfirst }}{% if link.error %} - {{ link.error }}{% endif %}{% if link.active and not hide_active_anchor %}<span class="famfam active famfam-resultset_previous"></span>{% endif %}</a>{% if horizontal %}{% if not forloop.last %} | {% endif %}{% endif %}{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ from django.template.defaultfilters import capfirst
|
|||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|
||||||
from icons.api import get_icon_name, get_sprite_name
|
|
||||||
from icons.literals import ERROR
|
|
||||||
from permissions.models import Permission
|
from permissions.models import Permission
|
||||||
|
|
||||||
|
from .icons import icon_error
|
||||||
|
|
||||||
|
|
||||||
def button_navigation_widget(request, link):
|
def button_navigation_widget(request, link):
|
||||||
if link.permissions:
|
if link.permissions:
|
||||||
@@ -27,9 +27,9 @@ def render_widget(request, link):
|
|||||||
context = RequestContext(request)
|
context = RequestContext(request)
|
||||||
resolved_link = link.resolve(context)
|
resolved_link = link.resolve(context)
|
||||||
if resolved_link:
|
if resolved_link:
|
||||||
return mark_safe(u'<a style="text-decoration:none; margin-right: 10px;" href="%(url)s"><button style="vertical-align: top; padding: 1px; width: 110px; height: 100px; margin: 10px;"><img src="%(static_url)simages/icons/%(icon)s" alt="%(image_alt)s" /><p style="margin: 0px 0px 0px 0px;">%(string)s</p></button></a>' % {
|
return mark_safe(u'<a style="text-decoration:none; margin-right: 10px;" href="%(url)s"><button style="vertical-align: top; padding: 1px; width: 110px; height: 100px; margin: 10px;">%(icon)s<p style="margin: 0px 0px 0px 0px;">%(string)s</p></button></a>' % {
|
||||||
'url': resolved_link.url,
|
'url': resolved_link.url,
|
||||||
'icon': get_icon_name(getattr(resolved_link, 'icon', ERROR)),
|
'icon': getattr(resolved_link, 'icon', icon_error).display_big(),
|
||||||
'static_url': settings.STATIC_URL,
|
'static_url': settings.STATIC_URL,
|
||||||
'string': capfirst(resolved_link.text),
|
'string': capfirst(resolved_link.text),
|
||||||
'image_alt': _(u'icon'),
|
'image_alt': _(u'icon'),
|
||||||
|
|||||||
Reference in New Issue
Block a user