Пример #1
0
 def getPrettyLink(self, item):
     pl = IPrettyLink(item)
     pl.display_tag_title = False
     if base_hasattr(pl.context, '_link_portal_type'):
         pl.additionalCSSClasses = ['contenttype-{}'.format(pl.context._link_portal_type)]
     else:
         pl.additionalCSSClasses = ['contenttype-{}'.format(pl.context.portal_type)]
     pl.contentValue = self.contentValue(item)
     return pl.getLink()
Пример #2
0
 def test_getLink_caching_additionalCSSClasses(self):
     """Cache takes the 'additionalCSSClasses' parameter into account."""
     adapted = IPrettyLink(self.folder)
     self.assertFalse(adapted.additionalCSSClasses)
     self.assertTrue(u" class='pretty_link state-private' " in adapted.getLink())
     adapted.additionalCSSClasses = ['custom_css_class']
     self.assertTrue(u" class='pretty_link custom_css_class state-private' " in adapted.getLink())
Пример #3
0
 def test_getLink_caching_additionalCSSClasses(self):
     """Cache takes the 'additionalCSSClasses' parameter into account."""
     adapted = IPrettyLink(self.folder)
     self.assertFalse(adapted.additionalCSSClasses)
     self.assertTrue(u"<span class='pretty_link_content state-private'>" in
                     adapted.getLink())
     adapted.additionalCSSClasses = ['custom_css_class']
     # additionalCSSClasses are set on the <a> tag
     # state related CSS class is set on the <span> tag
     self.assertEqual(
         adapted.getLink(),
         u"<a class='pretty_link custom_css_class' title='Folder' "
         u"href='http://nohost/plone/folder' target='_self'>"
         u"<span class='pretty_link_content state-private'>Folder</span></a>"
     )