fix: default values in subordinate entities based on static_filtering, add: button visibility callbacks in entities' forms
This commit is contained in:
@@ -45,21 +45,24 @@ async def entities_menu(
|
||||
entity_metadata = app.entity_metadata
|
||||
|
||||
for entity in entity_metadata.entity_descriptors.values():
|
||||
if entity.full_name_plural.__class__ == EntityCaptionCallable:
|
||||
caption = entity.full_name_plural(entity) or entity.name
|
||||
elif entity.full_name_plural.__class__ == LazyProxy:
|
||||
caption = f"{f'{entity.icon} ' if entity.icon else ''}{entity.full_name_plural.value or entity.name}"
|
||||
else:
|
||||
caption = f"{f'{entity.icon} ' if entity.icon else ''}{entity.full_name_plural or entity.name}"
|
||||
|
||||
keyboard_builder.row(
|
||||
InlineKeyboardButton(
|
||||
text=caption,
|
||||
callback_data=ContextData(
|
||||
command=CallbackCommand.ENTITY_LIST, entity_name=entity.name
|
||||
).pack(),
|
||||
if entity.show_in_entities_menu:
|
||||
|
||||
if entity.full_name_plural.__class__ == EntityCaptionCallable:
|
||||
caption = entity.full_name_plural(entity) or entity.name
|
||||
elif entity.full_name_plural.__class__ == LazyProxy:
|
||||
caption = f"{f'{entity.icon} ' if entity.icon else ''}{entity.full_name_plural.value or entity.name}"
|
||||
else:
|
||||
caption = f"{f'{entity.icon} ' if entity.icon else ''}{entity.full_name_plural or entity.name}"
|
||||
|
||||
keyboard_builder.row(
|
||||
InlineKeyboardButton(
|
||||
text=caption,
|
||||
callback_data=ContextData(
|
||||
command=CallbackCommand.ENTITY_LIST, entity_name=entity.name
|
||||
).pack(),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
context = pop_navigation_context(navigation_stack)
|
||||
if context:
|
||||
|
||||
Reference in New Issue
Block a user