Skip to content

Commit

Permalink
Fix toolbar: App name as menu name and create articles of current con…
Browse files Browse the repository at this point in the history
…fig (if avail)
  • Loading branch information
fsbraun committed Oct 6, 2023
1 parent 5d5f691 commit e7bd194
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion djangocms_blog/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def populate(self):
self.request, get_setting("CURRENT_NAMESPACE"), current_content.app_config if current_content else None
)
with override(self.current_lang):
admin_menu = self.toolbar.get_or_create_menu("djangocms_blog", _("Blog"))
menu_name = _("Blog")
if current_config and current_config.app_title:
menu_name = current_config.app_title
admin_menu = self.toolbar.get_or_create_menu("djangocms_blog", menu_name)
object_dict = (
dict(object_name=current_config.object_name)
if current_config
Expand All @@ -110,6 +113,8 @@ def populate(self):
admin_reverse("djangocms_blog_post_change", args=(current_content.post.pk,)),
)
url = admin_reverse("djangocms_blog_post_add")
if current_config:
url += f"?app_config={current_config.pk}"
admin_menu.add_modal_item(
_("Create %(object_name)s") % object_dict,
url=url,
Expand Down

0 comments on commit e7bd194

Please sign in to comment.