diff --git a/apps/tags/__init__.py b/apps/tags/__init__.py index a00f69bf45..ea2a2444b9 100644 --- a/apps/tags/__init__.py +++ b/apps/tags/__init__.py @@ -12,8 +12,7 @@ from acls.permissions import ACLS_VIEW_ACL from taggit.models import Tag from taggit.managers import TaggableManager -from .widgets import get_tags_inline_widget_simple -from .widgets import tag_color_block +from .widgets import (get_tags_inline_widget_simple, single_tag_widget) from .permissions import (PERMISSION_TAG_CREATE, PERMISSION_TAG_ATTACH, PERMISSION_TAG_REMOVE, PERMISSION_TAG_DELETE, PERMISSION_TAG_EDIT, PERMISSION_TAG_VIEW) @@ -32,12 +31,8 @@ tag_acl_list = {'text': _(u'ACLs'), 'view': 'tag_acl_list', 'args': 'object.pk', register_model_list_columns(Tag, [ { - 'name': _(u'color'), - 'attribute': encapsulate(lambda x: tag_color_block(x)) - }, - { - 'name': _(u'color name'), - 'attribute': encapsulate(lambda x: x.tagproperties_set.get().get_color_display()), + 'name': _(u'preview'), + 'attribute': encapsulate(lambda x: single_tag_widget(x)) }, { 'name': _(u'tagged items'), diff --git a/apps/tags/views.py b/apps/tags/views.py index aa6799343b..4076571167 100644 --- a/apps/tags/views.py +++ b/apps/tags/views.py @@ -98,6 +98,7 @@ def tag_list(request, queryset=None, extra_context=None): 'title': _(u'tags'), 'hide_link': True, 'multi_select_as_buttons': True, + 'hide_object': True, } if extra_context: context.update(extra_context) diff --git a/apps/tags/widgets.py b/apps/tags/widgets.py index 521ad6a1b2..056d667498 100644 --- a/apps/tags/widgets.py +++ b/apps/tags/widgets.py @@ -6,6 +6,7 @@ def get_tags_inline_widget(document): """ A tag widget that includes the total tag count for a given document """ + # TODO: merge widgets tags_template = [] tag_count = document.tags.count() if tag_count: @@ -21,8 +22,7 @@ def get_tags_inline_widget(document): def get_tags_inline_widget_simple(document): """ - A tag widget that only displayes the rectangular colored boxes for a - given document + A tag widget that displays the tags for the given document """ tags_template = [] @@ -30,12 +30,20 @@ def get_tags_inline_widget_simple(document): if tag_count: tags_template.append('') return mark_safe(u''.join(tags_template)) -def tag_color_block(tag): - return mark_safe(u'
' % tag.tagproperties_set.get().get_color_code()) +def single_tag_widget(tag): + tags_template = [] + tags_template.append('') + return mark_safe(u''.join(tags_template)) + + +def get_single_tag_template(tag): + return '
  • %s
  • ' % (tag.tagproperties_set.get().get_color_code(), tag.name.replace(u' ', u' '))