ExtractionError, ) from yafowil.common import ( generic_extractor, generic_required_extractor, select_renderer, select_extractor, ) from yafowil.utils import ( tag, cssid, cssclasses, ) registerTile('referencebrowser', 'bda.bfg.app:browser/templates/referencebrowser.pt', permission='view', strict=False) registerTile('referencebrowser_pathbar', 'bda.bfg.app:browser/templates/referencebrowser_pathbar.pt', permission='view', class_=PathBar, strict=False) @tile('referencelisting', 'templates/referencelisting.pt', strict=False) class ReferenceListing(ContentsTile): @property def batch(self): batch = ContentsBatch(self.contents) batch.name = 'referencebatch'
child['showchildren'] = curnode tree['children'].append(child) def navtree(self): root = self.navtreeitem(None, None, '') model = self.model.root path = nodepath(self.model) self.fillchildren(model, path, root) return root def rendertree(self, children, level=1): return render_template('bda.bfg.app.browser:templates/navtree_recue.pt', model=self.model, request=self.request, context=self, children=children, level=level) @tile('byline', 'templates/byline.pt', strict=False) class Byline(Tile): """Byline tile. """ def format_date(self, dt): return format_date(dt) registerTile('listing', 'bda.bfg.app:browser/templates/listing.pt', class_=ProtectedContentTile, permission='login', strict=False)
from repoze.bfg.view import bfg_view from bda.bfg.tile import ( registerTile, render_tile, ) registerTile('bdajax', 'bdajax:bdajax.pt', permission='login', strict=False) @bfg_view(name='ajaxaction', accept='application/json', renderer='json') def ajax_tile(model, request): """Render an ajax action by name. Request must provide the parameter ``name`` containing the view or tile name. """ # XXX: prefix action name with tile to indicate tile rendering, otherwise # render view name = request.params.get('bdajax.action') rendered = render_tile(model, request, name) return { 'mode': request.params.get('bdajax.mode'), 'selector': request.params.get('bdajax.selector'), 'payload': rendered, } def dummy_livesearch_callback(model, request): """Dummy callback for Livesearch. Set as default.
from bda.bfg.tile import ( tile, Tile, registerTile, render_tile, ) from bda.bfg.app.browser.layout import ProtectedContentTile registerTile('content', 'bda.bfg.ugm:browser/templates/columns.pt', class_=ProtectedContentTile, permission='login', strict=False) class Column(Tile): """Abstract column. """ def _render(self, model, name): return render_tile(model, self.request, name)
@property def info(self): factory = self.request.params.get('factory') allowed = self.model.nodeinfo.addables if not factory or not allowed or not factory in allowed: return None return getNodeInfo(factory) @bfg_view('edit', permission='login') def edit(model, request): return render_main_template(model, request, contenttilename='edit') registerTile('edit', 'bda.bfg.app:browser/templates/edit.pt', class_=ProtectedContentTile, permission='login', strict=False) @tile('add_dropdown', 'templates/add_dropdown.pt', strict=False) class AddDropdown(Tile): @property def items(self): ret = list() addables = self.model.nodeinfo.addables if not addables: return ret for addable in addables: info = getNodeInfo(addable) if not info: