def render(self): if INavigationLeaf.providedBy(self.model): return u'{} {}'.format( tag('span', class_=self.icon), tag('span', self.text) ) return LinkAction.render(self)
def render(self): rendered = LinkAction.render(self) attrs = { 'class_': 'reftitle', 'style': 'display:none;', } title = self.model.metadata.get('title', self.model.name) return rendered + tag('span', title, **attrs)
def test_LinkAction(self): model = BaseNode() request = self.layer.new_request() rendered = LinkAction()(model, request) self.checkOutput( """ ...<a\n...ajax:bind="click"\n...ajax:target="http://example.com/"\n...></a>... """, rendered) action = LinkAction() action.id = 'link_id' action.href = 'http://example.com/foo' action.css = 'link_action' action.title = 'Foo' action.action = 'actionname:#content:replace' action.event = 'contextchanged:.contextsensitiv' action.confirm = 'Do you want to perform?' action.overlay = 'someaction' action.path = '/foo' action.path_target = 'target' action.path_action = action.action action.path_event = action.event action.path_overlay = action.overlay action.text = 'Foo' rendered = action(model, request) self.checkOutput( """ ...<a id="link_id" href="http://example.com/foo" class="link_action" title="Foo" ajax:bind="click" ajax:target="http://example.com/" ajax:event="contextchanged:.contextsensitiv" ajax:action="actionname:#content:replace" ajax:confirm="Do you want to perform?" ajax:overlay="someaction" ajax:path="/foo" ajax:path-target="target" ajax:path-action="actionname:#content:replace" ajax:path-event="contextchanged:.contextsensitiv" ajax:path-overlay="someaction" > Foo</a>... """, rendered) action.enabled = False self.assertTrue( action(model, request).find('class="link_action disabled"') > -1) action.display = False self.assertEqual(action(model, request), u'')
def render(self): if INavigationLeaf.providedBy(self.model): return self.text return LinkAction.render(self)