manager: always display extra css class when option is defined (#13495)

This commit is contained in:
Frédéric Péters 2017-02-11 16:08:32 +01:00
parent 7a8e9f35a5
commit 1c41179455
2 changed files with 32 additions and 2 deletions

View File

@ -75,11 +75,10 @@
<h3><span class="handle"></span>
<span class="group1">
{{ cell.get_label }}
{% if cell.slug %} [{{cell.slug}}]
{% if cell.slug %} [{{cell.slug}}] {% endif %}
{% if cell.extra_css_class %}
<span class="extra-css-class">[{{ cell.extra_css_class }}]</span>
{% endif %}
{% endif %}
<span class="additional-label">
<i>{{cell.get_additional_label|default_if_none:""}}</i></span>
</span>

View File

@ -329,6 +329,37 @@ def test_edit_cell_visibility(app, admin_user):
assert TextCell.objects.get(id=cell.id).restricted_to_unlogged is True
assert TextCell.objects.get(id=cell.id).public is True
def test_edit_cell_options(app, admin_user):
Page.objects.all().delete()
page = Page(title='One', slug='one', template_name='standard')
page.save()
cell = TextCell(page=page, placeholder='content', text='Foobar', order=0)
cell.save()
app = login(app)
resp = app.get('/manage/pages/%s/' % page.id)
resp = resp.click(href='/data_textcell-%s/options' % cell.id)
assert resp.form['cdata_textcell-%s-slug' % cell.id].value == ''
assert resp.form['cdata_textcell-%s-extra_css_class' % cell.id].value == ''
resp.form['cdata_textcell-%s-slug' % cell.id] = 'SLUG'
resp = resp.form.submit('submit')
assert TextCell.objects.get(id=cell.id).slug == 'SLUG'
assert 'SLUG' in app.get('/manage/pages/%s/' % page.id)
resp = app.get('/manage/pages/%s/' % page.id)
resp = resp.click(href='/data_textcell-%s/options' % cell.id)
resp.form['cdata_textcell-%s-slug' % cell.id] = ''
resp = resp.form.submit('submit')
assert TextCell.objects.get(id=cell.id).slug == ''
assert not 'SLUG' in app.get('/manage/pages/%s/' % page.id)
resp = app.get('/manage/pages/%s/' % page.id)
resp = resp.click(href='/data_textcell-%s/options' % cell.id)
resp.form['cdata_textcell-%s-extra_css_class' % cell.id] = 'CSS'
resp = resp.form.submit('submit')
assert TextCell.objects.get(id=cell.id).extra_css_class == 'CSS'
assert '[CSS]' in app.get('/manage/pages/%s/' % page.id)
def test_edit_cell_order(app, admin_user):
Page.objects.all().delete()
page = Page(title='One', slug='one', template_name='standard')