def render_exits(self, ctx, data): if self.bse != 'Room': return '' xs = self.obj.exits() xs.sort(key=attrgetter('name')) if xs: lines = [T.h2(_class="section")['Exits:']] rows = [] for x in xs: tzid = x.tzid destf = 'dest_%s' % tzid namef = 'name_%s' % tzid dest = x.destination rows.append(T.tr[ T.td[self.deletelink_widget(x)], T.td[self.editlink_widget(x)], T.td[self.str_widget(namef, x.name, 20)], T.td['-->'], T.td[self.rooms_widget(destf, dest)], T.td[self.editlink_widget(dest)], T.td[T.input(_type="submit", value="update")]]) tbl = T.table(_class="center")[rows] lines.append(tbl) return T.form(action="/exits/update/", method="POST")[lines] else: return T.h2(_class="warn")['No exits']
def test_authenticatedStartmenu(self): """ The I{startmenu} renderer should add navigation elements to the tag it is passed if it is called on a L{_PublicPageMixin} being rendered for an authenticated user. """ navigable = FakeNavigableElement(store=self.userStore) installOn(navigable, self.userStore) navigable.tabs = [Tab('foo', 123, 0, [Tab('bar', 432, 0)])] page = self.createPage(self.username) startMenuTag = div[ h1(pattern='tab'), h2(pattern='subtabs')] ctx = context.WebContext(tag=startMenuTag) tag = page.render_startmenu(ctx, None) self.assertEqual(tag.tagName, 'div') self.assertEqual(tag.attributes, {}) children = [child for child in tag.children if child.pattern is None] self.assertEqual(len(children), 0) # This structure seems overly complex. tabs = list(tag.slotData.pop('tabs')) self.assertEqual(len(tabs), 1) fooTab = tabs[0] self.assertEqual(fooTab.tagName, 'h1') self.assertEqual(fooTab.attributes, {}) self.assertEqual(fooTab.children, []) self.assertEqual(fooTab.slotData['href'], self.privateApp.linkTo(123)) self.assertEqual(fooTab.slotData['name'], 'foo') self.assertEqual(fooTab.slotData['kids'].tagName, 'h2') subtabs = list(fooTab.slotData['kids'].slotData['kids']) self.assertEqual(len(subtabs), 1) barTab = subtabs[0] self.assertEqual(barTab.tagName, 'h1') self.assertEqual(barTab.attributes, {}) self.assertEqual(barTab.children, []) self.assertEqual(barTab.slotData['href'], self.privateApp.linkTo(432)) self.assertEqual(barTab.slotData['name'], 'bar') self.assertEqual(barTab.slotData['kids'], '')
def test_authenticatedStartmenu(self): """ The I{startmenu} renderer should add navigation elements to the tag it is passed if it is called on a L{_PublicPageMixin} being rendered for an authenticated user. """ navigable = FakeNavigableElement(store=self.userStore) installOn(navigable, self.userStore) navigable.tabs = [Tab('foo', 123, 0, [Tab('bar', 432, 0)])] page = self.createPage(self.username) startMenuTag = div[h1(pattern='tab'), h2(pattern='subtabs')] ctx = context.WebContext(tag=startMenuTag) tag = page.render_startmenu(ctx, None) self.assertEqual(tag.tagName, 'div') self.assertEqual(tag.attributes, {}) children = [child for child in tag.children if child.pattern is None] self.assertEqual(len(children), 0) # This structure seems overly complex. tabs = list(tag.slotData.pop('tabs')) self.assertEqual(len(tabs), 1) fooTab = tabs[0] self.assertEqual(fooTab.tagName, 'h1') self.assertEqual(fooTab.attributes, {}) self.assertEqual(fooTab.children, []) self.assertEqual(fooTab.slotData['href'], self.privateApp.linkTo(123)) self.assertEqual(fooTab.slotData['name'], 'foo') self.assertEqual(fooTab.slotData['kids'].tagName, 'h2') subtabs = list(fooTab.slotData['kids'].slotData['kids']) self.assertEqual(len(subtabs), 1) barTab = subtabs[0] self.assertEqual(barTab.tagName, 'h1') self.assertEqual(barTab.attributes, {}) self.assertEqual(barTab.children, []) self.assertEqual(barTab.slotData['href'], self.privateApp.linkTo(432)) self.assertEqual(barTab.slotData['name'], 'bar') self.assertEqual(barTab.slotData['kids'], '')
def render_title(self, context, data): return tags.h2()["Channels"]
def render_title(self, context, data): return tags.h2()["Clients"]
def render_title(self, context, data): return tags.h2()['Overview']
def render_title(self, context, data): return tags.h2()['Transports']