diff --git a/deme_django/cms/templates/person/show.html b/deme_django/cms/templates/agent/show.html similarity index 85% rename from deme_django/cms/templates/person/show.html rename to deme_django/cms/templates/agent/show.html index 4052f694..e37f6791 100644 --- a/deme_django/cms/templates/person/show.html +++ b/deme_django/cms/templates/agent/show.html @@ -5,7 +5,7 @@ {% block title-section %}{% endblock %} {% block content %} -
+
{% if item.photo %} {% ifagentcan 'view FileDocument.datafile' item.photo %} @@ -17,9 +17,8 @@

{% viewable_name item %}

    - {% for contactmethod in item.contact_methods.all %} - -
  • {{ contactmethod }}
  • + {% for contact_method in contact_methods %} +
  • {{ contact_method }}
  • {% endfor %}
diff --git a/deme_django/cms/views.py b/deme_django/cms/views.py index a3cf3be1..58379bb1 100644 --- a/deme_django/cms/views.py +++ b/deme_django/cms/views.py @@ -830,6 +830,47 @@ class AgentViewer(ItemViewer): accepted_item_type = Agent viewer_name = 'agent' + def item_show_html(self): + self.context['action_title'] = '' + self.require_ability('view ', self.item, wildcard_suffix=True) + # copied from symsys/views.py + contact_method_fields = [] + contact_methods = self.permission_cache.filter_items('view ContactMethod.agent', self.item.contact_methods).filter(active=True) + for contact_method in contact_methods: + if issubclass(contact_method.actual_item_type(), EmailContactMethod): + contact_method = contact_method.downcast() + if self.permission_cache.agent_can('view EmailContactMethod.email', contact_method): + contact_method_fields.append(contact_method.email) + if issubclass(contact_method.actual_item_type(), WebsiteContactMethod): + contact_method = contact_method.downcast() + if self.permission_cache.agent_can('view WebsiteContactMethod.url', contact_method): + link = ("""%s""" % (contact_method.url, contact_method.url)) + contact_method_fields.append(mark_safe(link)) + if issubclass(contact_method.actual_item_type(), PhoneContactMethod): + contact_method = contact_method.downcast() + if self.permission_cache.agent_can('view PhoneContactMethod.phone', contact_method): + contact_method_fields.append(contact_method.phone) + if issubclass(contact_method.actual_item_type(), FaxContactMethod): + contact_method = contact_method.downcast() + if self.permission_cache.agent_can('view FaxContactMethod.fax', contact_method): + contact_method_fields.append('(Fax) ' + contact_method.fax) + if issubclass(contact_method.actual_item_type(), AIMContactMethod): + contact_method = contact_method.downcast() + if self.permission_cache.agent_can('view AIMContactMethod.screen_name', contact_method): + contact_method_fields.append('(AIM Screename) ' + contact_method.screen_name) + if issubclass(contact_method.actual_item_type(), AddressContactMethod): + contact_method = contact_method.downcast() + if self.permission_cache.agent_can('view AddressContactMethod.street1', contact_method): + if contact_method.street2: + address = (""" %s
%s
%s, %s %s %s """ % (contact_method.street1, contact_method.street2, contact_method.city, contact_method.state, contact_method.country, contact_method.zip)) + else: + address = (""" %s
%s, %s %s %s """ % (contact_method.street1, contact_method.city, contact_method.state, contact_method.country, contact_method.zip)) + contact_method_fields.append(mark_safe(address)) + + self.context['contact_methods'] = contact_method_fields + + template = loader.get_template('agent/show.html') + return HttpResponse(template.render(self.context)) class AnonymousAgentViewer(AgentViewer): accepted_item_type = AnonymousAgent @@ -911,13 +952,6 @@ class PersonViewer(AgentViewer): accepted_item_type = Person viewer_name = 'person' - def item_show_html(self): - self.context['action_title'] = '' - self.require_ability('view ', self.item, wildcard_suffix=True) - - template = loader.get_template('person/show.html') - return HttpResponse(template.render(self.context)) - class ContactMethodViewer(ItemViewer): accepted_item_type = ContactMethod diff --git a/deme_django/static/css/deme.css b/deme_django/static/css/deme.css index 0fa284ee..79f462cb 100644 --- a/deme_django/static/css/deme.css +++ b/deme_django/static/css/deme.css @@ -5338,7 +5338,7 @@ you can use the generic selector below, but it's slower: .proposition-result .proposition_graph .mark100 .count { display: block; } -.person-profile .thumb { +.agent-profile .thumb { margin-top: 20px; height: 200px; background-size: cover; @@ -5348,10 +5348,10 @@ you can use the generic selector below, but it's slower: border: 1px solid #eee; display: block; } -.person-profile .thumb img { +.agent-profile .thumb img { display: none; } -.person-profile .activity-inner h3 { +.agent-profile .activity-inner h3 { display: none; } .HiddenMenu { diff --git a/deme_django/static/less/deme/profiles.less b/deme_django/static/less/deme/profiles.less index 29f3c8a8..d071cd85 100644 --- a/deme_django/static/less/deme/profiles.less +++ b/deme_django/static/less/deme/profiles.less @@ -1,4 +1,4 @@ -.person-profile { +.agent-profile { .thumb { margin-top: 20px; height: 200px;