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()
def adapted(self, showColors=False, display_tag_title=False, isViewable=True): plo = IPrettyLink(self.context) plo.showContentIcon = True plo.showColors = showColors plo.display_tag_title = display_tag_title plo.isViewable = isViewable plo.notViewableHelpMessage = '' return plo
def test_getLink_link_tooltip(self): """title attr is absent if display_tag_title is False.""" pl = IPrettyLink(self.folder) self.assertEqual( pl.getLink(), u"<a class='pretty_link state-private' title='Folder' href='http://nohost/plone/folder' " u"target='_self'><span class='pretty_link_content'>Folder</span></a>") pl.display_tag_title = False self.assertEqual( pl.getLink(), u"<a class='pretty_link state-private' href='http://nohost/plone/folder' " u"target='_self'><span class='pretty_link_content'>Folder</span></a>")
def test_getLink_link_tooltip(self): """title attr is absent if display_tag_title is False.""" pl = IPrettyLink(self.folder) self.assertEqual( pl.getLink(), u"<a class='pretty_link' title='Folder' href='http://nohost/plone/folder' " u"target='_self'><span class='pretty_link_content state-private'>Folder</span></a>" ) pl.display_tag_title = False self.assertEqual( pl.getLink(), u"<a class='pretty_link' href='http://nohost/plone/folder' " u"target='_self'><span class='pretty_link_content state-private'>Folder</span></a>" )