manager: keep link label attribute on main tab (#65878)
This commit is contained in:
parent
fdad44bc89
commit
827f68b629
|
@ -42,7 +42,7 @@ class MenuCellForm(forms.ModelForm):
|
|||
class LinkCellForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = LinkCell
|
||||
fields = ('url', 'link_page', 'anchor')
|
||||
fields = ('title', 'url', 'link_page', 'anchor')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
|
@ -1586,7 +1586,7 @@ class MenuCell(CellBase):
|
|||
|
||||
@register_cell_class
|
||||
class LinkCell(CellBase):
|
||||
title = models.CharField(_('Title'), max_length=150, blank=True)
|
||||
title = models.CharField(_('Label'), max_length=150, blank=True)
|
||||
url = models.CharField(_('URL'), max_length=2000, blank=True, validators=[django_template_validator])
|
||||
link_page = models.ForeignKey(
|
||||
'data.Page',
|
||||
|
@ -1683,6 +1683,10 @@ class LinkCell(CellBase):
|
|||
extra_context['url'] = url
|
||||
return extra_context
|
||||
|
||||
def get_appearance_fields(self):
|
||||
# keep title/label on main tab
|
||||
return []
|
||||
|
||||
def get_default_form_class(self):
|
||||
from .forms import LinkCellForm
|
||||
|
||||
|
|
|
@ -2632,8 +2632,8 @@ def test_manager_link_cell_tabs(app, admin_user):
|
|||
app = login(app)
|
||||
resp = app.get('/manage/pages/%s/' % page.pk)
|
||||
|
||||
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]')
|
||||
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]')
|
||||
assert resp.pyquery('[data-tab-slug="general"] input[name$="title"]')
|
||||
assert not resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]')
|
||||
|
||||
|
||||
def test_link_cell_validation():
|
||||
|
|
Loading…
Reference in New Issue