def page_translations_menu_items(page, page_perms, is_parent=False): prio = 1 exclude_lang = None if hasattr(page, 'language') and page.language: exclude_lang = page.language other_languages = set(Language.objects.live().exclude( pk=exclude_lang.pk).order_by('position')) translations = (page.get_translations( only_live=False).select_related('language')) taken_languages = set(t.language for t in translations) translation_targets = other_languages - taken_languages for language in translation_targets: yield widgets.Button(force_text(language), reverse('wagtailtrans_translations:add', kwargs={ 'instance_id': page.pk, 'language_code': language.code, }), priority=prio) prio += 1
def page_custom_listing_more_buttons(page, page_perms, is_parent=False): yield wagtailadmin_widgets.Button( 'Another useless dropdown button in "One more more button" dropdown', '/custom-url', priority=10)
def add_sharing_link(page, page_perms, is_parent=False): sharing_url = get_sharing_url(page) if sharing_url: if hasattr(page, 'get_admin_display_title'): title = page.get_admin_display_title() else: title = page.title yield wagtailadmin_widgets.Button( 'View sharing link', sharing_url, attrs={ 'title': _("View shared revision of '{}'").format(title), }, priority=90 )