Skip to content

Commit

Permalink
[Main Nav] Navigation item [TP-265](#12039)
Browse files Browse the repository at this point in the history
* Add description to NavLinkBlock

* Set max length
  • Loading branch information
jhonatan-lopes committed Mar 28, 2024
1 parent 70dab14 commit d70e078
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions network-api/networkapi/nav/blocks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from wagtail import blocks
from wagtail.telepath import register

from networkapi.wagtailpages.pagemodels.customblocks.common.base_link_block import (
Expand All @@ -17,6 +18,8 @@ def open_in_new_window(self) -> bool:


class NavLinkBlock(BaseLinkBlock):
description = blocks.CharBlock(required=False, max_length=100)

class Meta:
value_class = NavLinkValue
label = "Navigation Link"
Expand Down
1 change: 1 addition & 0 deletions network-api/networkapi/nav/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Params:
relative_url_link = factory.Trait(link_to="relative_url", relative_url=f'/{factory.Faker("uri_path")}')

label = factory.Faker("sentence", nb_words=3)
description = factory.Faker("sentence", nb_words=6)

# Setup default link as external URL (it won't pass validation without a link type defined though
# so it's still necessary to use the factory with traits)
Expand Down

0 comments on commit d70e078

Please sign in to comment.