def render(self, request): """Initialize renderer""" # Get the bundles_actions. # If bundle_actions is True, display checkboxes and more in the table. bundled_actions = [] for action in get_item_actions(request, self.listing.clazz): if action.bundle and security.has_permission( action.name.lower(), request.context, request): bundled_actions.append(action) table_id = self._get_table_id() table_config = self._render_js_config(request, table_id, bundled_actions) values = { 'items': self.listing.items, 'clazz': self.listing.clazz, 'listing': self.listing, 'request': request, '_': request.translate, 's': security, 'h': ringo.lib.helpers, 'bundled_actions': bundled_actions, 'tableconfig': self.config, 'tableid': table_id, 'dtconfig': table_config } return literal(self.template.render(**values))
def render(self, request): """Initialize renderer""" # Get the bundles_actions. # If bundle_actions is True, display checkboxes and more in the table. bundled_actions = [] for action in get_item_actions(request, self.listing.clazz): if action.bundle and security.has_permission(action.name.lower(), request.context, request): bundled_actions.append(action) table_id = self._get_table_id() table_config = self._render_js_config(request, table_id) values = {'items': self.listing.items, 'clazz': self.listing.clazz, 'listing': self.listing, 'request': request, '_': request.translate, 's': security, 'h': ringo.lib.helpers, 'bundled_actions': bundled_actions, 'tableconfig': self.config, 'tableid': table_id, 'dtconfig': table_config} return literal(self.template.render(**values))
def test_get_item_actions(apprequest): from ringo.model.modul import ModulItem from ringo.model.modul import ActionItem from ringo.lib.helpers import get_item_actions result = get_item_actions(apprequest, ModulItem) assert isinstance(result, list) if len(result) > 0: assert isinstance(result[0], ActionItem)
def render(self, request): """Initialize renderer""" # TODO: Enabled sorting of lists. Mind that these lists might be # presorted if the user clicked on the header. In this case some # get params with sort configurations are in the session. This # logic is currently in base/view. (ti) <2014-01-23 23:15> # sort_field = self.config.get_default_sort_column() # sort_order = self.config.get_default_sort_order() # self.listing.sort(sort_field, sort_order) if len(self.listing.search_filter) > 0: search = self.listing.search_filter[-1][0] search_field = self.listing.search_filter[-1][1] regexpr = self.listing.search_filter[-1][2] else: search = "" search_field = "" regexpr = False ssearch = get_saved_searches(request, self.listing.clazz.__tablename__) bundled_actions = [] for action in get_item_actions(request, self.listing.clazz): if action.bundle and security.has_permission( action.name.lower(), request.context, request): bundled_actions.append(action) values = { 'items': self.listing.items, 'clazz': self.listing.clazz, 'listing': self.listing, 'request': request, '_': request.translate, 'h': ringo.lib.helpers, 's': security, 'bundled_actions': bundled_actions, 'search': search, 'regexpr': regexpr, 'search_field': search_field, 'saved_searches': ssearch, 'tableconfig': self.config } return literal(self.template.render(**values))
def render(self, request): """Initialize renderer""" # TODO: Enabled sorting of lists. Mind that these lists might be # presorted if the user clicked on the header. In this case some # get params with sort configurations are in the session. This # logic is currently in base/view. (ti) <2014-01-23 23:15> # sort_field = self.config.get_default_sort_column() # sort_order = self.config.get_default_sort_order() # self.listing.sort(sort_field, sort_order) if len(self.listing.search_filter) > 0: search = self.listing.search_filter[-1][0] search_field = self.listing.search_filter[-1][1] regexpr = self.listing.search_filter[-1][2] else: search = "" search_field = "" regexpr = False ssearch = get_saved_searches(request, self.listing.clazz.__tablename__) bundled_actions = [] for action in get_item_actions(request, self.listing.clazz): if action.bundle and security.has_permission(action.name.lower(), request.context, request): bundled_actions.append(action) values = {'items': self.listing.items, 'clazz': self.listing.clazz, 'listing': self.listing, 'request': request, '_': request.translate, 'h': ringo.lib.helpers, 's': security, 'bundled_actions': bundled_actions, 'search': search, 'regexpr': regexpr, 'search_field': search_field, 'saved_searches': ssearch, 'tableconfig': self.config} return literal(self.template.render(**values))