Fix horizontal list link widget rendering
This commit is contained in:
@@ -12,7 +12,6 @@ from django.template import RequestContext, Variable
|
||||
|
||||
from permissions.models import Permission
|
||||
|
||||
#from .templatetags.navigation_tags import resolve_links
|
||||
from .utils import resolve_to_name
|
||||
|
||||
|
||||
@@ -29,23 +28,11 @@ def button_navigation_widget(request, link):
|
||||
|
||||
def render_widget(request, link):
|
||||
context = RequestContext(request)
|
||||
|
||||
request = Variable('request').resolve(context)
|
||||
current_path = request.META['PATH_INFO']
|
||||
current_view = resolve_to_name(current_path)
|
||||
|
||||
query_string = urlparse.urlparse(request.get_full_path()).query or urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).query
|
||||
parsed_query_string = urlparse.parse_qs(query_string)
|
||||
|
||||
links = []#resolve_links(context, [link], current_view, current_path, parsed_query_string)
|
||||
if links:
|
||||
link = links[0]
|
||||
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>' % {
|
||||
'url': reverse(link['view']) if 'view' in link else link['url'],
|
||||
'icon': link.getattr('icon', 'link_button.png'),
|
||||
'static_url': settings.STATIC_URL,
|
||||
'string': capfirst(link['text']),
|
||||
'image_alt': _(u'icon'),
|
||||
})
|
||||
else:
|
||||
return u''
|
||||
resolved_link = link.resolve(context)
|
||||
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>' % {
|
||||
'url': resolved_link.url,
|
||||
'icon': getattr(resolved_link, 'icon', 'link_button.png'),
|
||||
'static_url': settings.STATIC_URL,
|
||||
'string': capfirst(resolved_link.text),
|
||||
'image_alt': _(u'icon'),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user