def modes_choice(node, kw): request = node.bindings['request'] localizer = request.localizer modes = list(WORK_MODES.items()) modes = sorted(modes, key=lambda e: e[1].order) values = [(key, localizer.translate(value.title)) for key, value in modes] return CheckboxChoiceWidget(values=values, multiple=True)
def sites_choice(node, kw): context = node.bindings['context'] request = node.bindings['request'] root = getSite() values = [(f, render_site_data(f, context, request)) for f in root.site_folders] return CheckboxChoiceWidget(values=values, multiple=True)
def reporting_reasons_choice(node, kw): request = node.bindings['request'] context = node.bindings['context'] values = [(r_id, render_reason(r_id, request, context)) for r_id in REPORTING_REASONS] values = sorted(values, key=lambda e: REPORTING_REASONS[e[0]]['order']) return CheckboxChoiceWidget( values=values, multiple=True)
def content_manage_choices(node, kw): content_to_manage = DEFAULT_CONTENT_TO_MANAGE request = node.bindings['request'] localizer = request.localizer values = [(key, localizer.translate( getattr(c, 'type_title', c.__class__.__name__))) for key, c in list(core.SEARCHABLE_CONTENTS.items()) if key in content_to_manage] return CheckboxChoiceWidget(values=sorted(values), multiple=True)
def content_types_choices(node, kw): content_to_examine = ['idea', 'proposal'] request = node.bindings['request'] localizer = request.localizer values = [(key, localizer.translate( getattr(c, 'type_title', c.__class__.__name__))) for key, c in list(core.SEARCHABLE_CONTENTS.items()) if key in content_to_examine] return CheckboxChoiceWidget(values=sorted(values), multiple=True)
def newsletters_choice(node, kw): request = node.bindings['request'] root = request.root values = [(f, f.title) for f in root.get_newsletters_for_registration()] return CheckboxChoiceWidget(values=values, multiple=True)
def widgets_choices(node, kw): request = node.bindings['request'] values = [(key, renderers.render(c['renderer'], c, request)) for key, c in list(SITE_WIDGETS.items())] return CheckboxChoiceWidget( values=values)
def content_types_choices(node, kw): request = node.bindings['request'] return CheckboxChoiceWidget(values=get_default_searchable_content(request), inline=True, css_class='search-choice', item_css_class="search-choices")
def newsletters_choice(node, kw): request = node.bindings['request'] site = request.get_site_folder values = [(f, f.title) for f in site.newsletters] return CheckboxChoiceWidget(values=values, multiple=True)