def add_integrations_context(context): # type: (Dict[str, Any]) -> None alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) alphabetical_sorted_hubot_lozenges = OrderedDict( sorted(HUBOT_LOZENGES.items())) context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration context['hubot_lozenges_dict'] = alphabetical_sorted_hubot_lozenges if "html_settings_links" in context and context["html_settings_links"]: settings_html = '<a href="../../#settings">Zulip settings page</a>' subscriptions_html = '<a target="_blank" href="../../#streams">streams page</a>' else: settings_html = 'Zulip settings page' subscriptions_html = 'streams page' context['settings_html'] = settings_html context['subscriptions_html'] = subscriptions_html for name in alphabetical_sorted_integration: alphabetical_sorted_integration[name].add_doc_context(context) for name in alphabetical_sorted_hubot_lozenges: alphabetical_sorted_hubot_lozenges[name].add_doc_context(context)
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) enabled_integrations_count = len(list(filter(lambda v: v.is_enabled(), INTEGRATIONS.values()))) # Subtract 1 so saying "Over X integrations" is correct. Then, # round down to the nearest multiple of 10. integrations_count_display = ((enabled_integrations_count - 1) // 10) * 10 context["categories_dict"] = alphabetical_sorted_categories context["integrations_dict"] = alphabetical_sorted_integration context["integrations_count_display"] = integrations_count_display
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) enabled_integrations_count = len(list(filter(lambda v: v.is_enabled(), INTEGRATIONS.values()))) # Subtract 1 so saying "Over X integrations" is correct. Then, # round down to the nearest multiple of 10. integrations_count_display = ((enabled_integrations_count - 1) // 10) * 10 context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration context['integrations_count_display'] = integrations_count_display
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration if "html_settings_links" in context and context["html_settings_links"]: settings_html = '<a href="../../#settings">Zulip settings page</a>' subscriptions_html = '<a target="_blank" href="../../#streams">streams page</a>' else: settings_html = 'Zulip settings page' subscriptions_html = 'streams page' context['settings_html'] = settings_html context['subscriptions_html'] = subscriptions_html
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration if "html_settings_links" in context and context["html_settings_links"]: settings_html = '<a href="../../#settings">Zulip settings page</a>' subscriptions_html = '<a target="_blank" href="../../#streams">streams page</a>' else: settings_html = 'Zulip settings page' subscriptions_html = 'streams page' context['settings_html'] = settings_html context['subscriptions_html'] = subscriptions_html
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) enabled_integrations_count = len(list(filter(lambda v: v.is_enabled(), INTEGRATIONS.values()))) # Subtract 1 so saying "Over X integrations" is correct. Then, # round down to the nearest multiple of 10. integrations_count_display = ((enabled_integrations_count - 1) // 10) * 10 context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration context['integrations_count_display'] = integrations_count_display if "html_settings_links" in context and context["html_settings_links"]: settings_html = '<a href="../../#settings">Zulip settings page</a>' subscriptions_html = '<a target="_blank" href="../../#streams">streams page</a>' else: settings_html = 'Zulip settings page' subscriptions_html = 'streams page' context['settings_html'] = settings_html context['subscriptions_html'] = subscriptions_html
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) enabled_integrations_count = len( list(filter(lambda v: v.is_enabled(), INTEGRATIONS.values()))) # Subtract 1 so saying "Over X integrations" is correct. Then, # round down to the nearest multiple of 10. integrations_count_display = ((enabled_integrations_count - 1) // 10) * 10 context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration context['integrations_count_display'] = integrations_count_display if "html_settings_links" in context and context["html_settings_links"]: settings_html = '<a href="../../#settings">Zulip settings page</a>' subscriptions_html = '<a target="_blank" href="../../#streams">streams page</a>' else: settings_html = 'Zulip settings page' subscriptions_html = 'streams page' context['settings_html'] = settings_html context['subscriptions_html'] = subscriptions_html
def add_integrations_context(context): # type: (Dict[str, Any]) -> None alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) alphabetical_sorted_hubot_lozenges = OrderedDict(sorted(HUBOT_LOZENGES.items())) context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration context['hubot_lozenges_dict'] = alphabetical_sorted_hubot_lozenges if "html_settings_links" in context and context["html_settings_links"]: settings_html = '<a href="../#settings">Zulip settings page</a>' subscriptions_html = '<a target="_blank" href="../#streams">streams page</a>' else: settings_html = 'Zulip settings page' subscriptions_html = 'streams page' context['settings_html'] = settings_html context['subscriptions_html'] = subscriptions_html for name in alphabetical_sorted_integration: alphabetical_sorted_integration[name].add_doc_context(context) for name in alphabetical_sorted_hubot_lozenges: alphabetical_sorted_hubot_lozenges[name].add_doc_context(context)