Remove famfam use from the acls app
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# Content type <-> fam fam icon mapping
|
||||
CONTENT_TYPE_ICON_MAP = {
|
||||
'auth.user': 'user',
|
||||
'auth.group': 'group',
|
||||
'documents.document': 'page',
|
||||
'permissions.role': 'medal_gold_1',
|
||||
'folders.folder': 'folder',
|
||||
'tags.tag': 'tag_blue',
|
||||
'linking.smartlink': 'page_link',
|
||||
'common.anonymoususersingleton': 'user',
|
||||
'acls.creatorsingleton': 'user',
|
||||
}
|
||||
@@ -27,7 +27,7 @@ from .models import AccessEntry, DefaultAccessEntry
|
||||
from .permissions import (
|
||||
ACLS_EDIT_ACL, ACLS_CLASS_EDIT_ACL, ACLS_CLASS_VIEW_ACL, ACLS_VIEW_ACL
|
||||
)
|
||||
from .widgets import object_w_content_type_icon
|
||||
from .widgets import object_indentifier
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -48,7 +48,7 @@ def acl_list_for(request, obj, extra_context=None):
|
||||
'object_list': AccessEntry.objects.get_holders_for(obj),
|
||||
'title': _('Access control lists for: %s' % obj),
|
||||
'extra_columns': [
|
||||
{'name': _('Holder'), 'attribute': encapsulate(lambda x: object_w_content_type_icon(x.source_object))},
|
||||
{'name': _('Holder'), 'attribute': encapsulate(lambda x: object_indentifier(x.source_object))},
|
||||
{'name': _('Permissions'), 'attribute': encapsulate(lambda x: _permission_titles(AccessEntry.objects.get_holder_permissions_for(obj, x.source_object, db_only=True)))},
|
||||
],
|
||||
'hide_object': True,
|
||||
@@ -369,7 +369,7 @@ def acl_setup_valid_classes(request):
|
||||
'object_list': DefaultAccessEntry.get_classes(),
|
||||
'title': _('Classes'),
|
||||
'extra_columns': [
|
||||
{'name': _('Class'), 'attribute': encapsulate(lambda x: object_w_content_type_icon(x.source_object))},
|
||||
{'name': _('Class'), 'attribute': encapsulate(lambda x: object_indentifier(x.source_object))},
|
||||
],
|
||||
'hide_object': True,
|
||||
}
|
||||
@@ -390,7 +390,7 @@ def acl_class_acl_list(request, access_object_class_gid):
|
||||
'object_list': DefaultAccessEntry.objects.get_holders_for(access_object_class.source_object),
|
||||
'title': _('Default access control lists for class: %s') % access_object_class,
|
||||
'extra_columns': [
|
||||
{'name': _('Holder'), 'attribute': encapsulate(lambda x: object_w_content_type_icon(x.source_object))},
|
||||
{'name': _('Holder'), 'attribute': encapsulate(lambda x: object_indentifier(x.source_object))},
|
||||
{'name': _('Permissions'), 'attribute': encapsulate(lambda x: _permission_titles(DefaultAccessEntry.objects.get_holder_permissions_for(access_object_class.source_object, x.source_object)))},
|
||||
],
|
||||
'hide_object': True,
|
||||
|
||||
@@ -4,14 +4,8 @@ from django.utils.safestring import mark_safe
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db.models.base import ModelBase
|
||||
|
||||
from .literals import CONTENT_TYPE_ICON_MAP
|
||||
|
||||
|
||||
def content_type_icon(content_type):
|
||||
return mark_safe('<span class="famfam active famfam-%s"></span>' % CONTENT_TYPE_ICON_MAP.get('%s.%s' % (content_type.app_label, content_type.model), 'help'))
|
||||
|
||||
|
||||
def object_w_content_type_icon(obj):
|
||||
def object_indentifier(obj):
|
||||
content_type = ContentType.objects.get_for_model(obj)
|
||||
|
||||
ct_fullname = '%s.%s' % (content_type.app_label, content_type.name)
|
||||
@@ -23,4 +17,4 @@ def object_w_content_type_icon(obj):
|
||||
else:
|
||||
label = unicode(obj)
|
||||
|
||||
return mark_safe('%s<span>%s</span>' % (content_type_icon(content_type), label))
|
||||
return mark_safe('<span>{}</span>'.format(label))
|
||||
|
||||
Reference in New Issue
Block a user