0001-assets-display-only-name-wihout-link-when-asset-is-n.patch
combo/apps/assets/templates/combo/manager_assets_fragment.html | ||
---|---|---|
13 | 13 |
<tbody> |
14 | 14 |
{% for asset in object_list %} |
15 | 15 |
<tr class="{{ asset.css_classes }}" data-href="{{ asset.src }}"> |
16 |
<td>{% if not asset_for_ckeditor %}<a href="{{ asset.src }}">{{ asset.name }}</a>{% else %}{{ asset.name }}{% endif %}</td> |
|
16 |
<td> |
|
17 |
{% if asset_for_ckeditor %} |
|
18 |
{{ asset.name }} |
|
19 |
{% elif asset.src %} |
|
20 |
<a href="{{ asset.src }}">{{ asset.name }}</a> |
|
21 |
{% else %} |
|
22 |
{{ asset.name }} <span class="not-defined">({% trans "not defined" %})</span> |
|
23 |
{% endif %} |
|
17 | 24 |
<td>{% if asset.size %}{{ asset.size|filesizeformat }}{% else %}-{% endif %}</td> |
18 | 25 |
<td class="image">{% if asset.is_image %}<img data-href="{{ asset.src }}" src="{{ asset.thumb }}"/>{% endif %}</td> |
19 | 26 |
{% if not asset_for_ckeditor %} |
tests/test_manager.py | ||
---|---|---|
1227 | 1227 | |
1228 | 1228 |
with override_settings(COMBO_ASSET_SLOTS={'collectivity:banner': {'label': 'Banner'}}): |
1229 | 1229 |
resp = app.get('/manage/assets/') |
1230 |
assert '>Banner<' in resp.text
|
|
1230 |
assert 'Banner <span class="not-defined">' in resp.text
|
|
1231 | 1231 |
assert '>Delete<' not in resp.text |
1232 | 1232 | |
1233 | 1233 |
resp = resp.click('Overwrite') |
... | ... | |
1258 | 1258 |
resp = resp.form.submit() |
1259 | 1259 |
assert resp.location.endswith('?page=1') |
1260 | 1260 |
resp = resp.follow() |
1261 |
assert '>Banner<' in resp.text
|
|
1261 |
assert 'Banner <span class="not-defined">' in resp.text
|
|
1262 | 1262 |
assert '>Delete<' not in resp.text |
1263 | 1263 |
assert Asset.objects.filter(key='collectivity:banner').count() == 0 |
1264 | 1264 | |
... | ... | |
1266 | 1266 | |
1267 | 1267 |
with override_settings(COMBO_ASSET_SLOTS={'collectivity:cgu': {'label': 'CGU', 'asset-type': 'document'}}): |
1268 | 1268 |
resp = app.get('/manage/assets/') |
1269 |
assert '>CGU<' in resp.text
|
|
1269 |
assert 'CGU <span class="not-defined">' in resp.text
|
|
1270 | 1270 |
assert '>Delete<' not in resp.text |
1271 | 1271 | |
1272 | 1272 |
resp = resp.click('Overwrite') |
... | ... | |
1363 | 1363 |
app = login(app) |
1364 | 1364 | |
1365 | 1365 |
resp = app.get('/manage/assets/') |
1366 |
assert '>Banner<' in resp.text
|
|
1366 |
assert 'Banner <span class="not-defined">' in resp.text
|
|
1367 | 1367 |
assert '>Delete<' not in resp.text |
1368 | 1368 |
resp = resp.click('Overwrite') |
1369 | 1369 |
resp.form['upload'] = Upload( |
... | ... | |
1390 | 1390 |
assert Asset.objects.filter(key='collectivity:banner').count() == 0 |
1391 | 1391 | |
1392 | 1392 |
resp = app.get('/manage/assets/') |
1393 |
assert '>Banner<' in resp.text
|
|
1393 |
assert 'Banner <span class="not-defined">' in resp.text
|
|
1394 | 1394 |
assert '>Delete<' not in resp.text |
1395 | 1395 |
resp = resp.click('Overwrite') |
1396 | 1396 |
resp.form['upload'] = Upload( |
tests/test_wcs.py | ||
---|---|---|
990 | 990 |
'wcs_wcsformsofcategorycell': {'logo': {'prefix': 'Logo blabla', 'suffix': 'test'}}, |
991 | 991 |
} |
992 | 992 |
resp = app.get('/manage/assets/') |
993 |
assert u'>Logo — %s<' % cell2.get_label_for_asset() in resp.text
|
|
994 |
assert u'>Logo blabla — %s<' % cell2.get_label_for_asset() not in resp.text
|
|
995 |
assert u'>Picture — %s<' % cell1.get_label_for_asset() in resp.text
|
|
996 |
assert u'>Picture blabla — %s<' % cell1.get_label_for_asset() not in resp.text
|
|
993 |
assert u'Logo — %s' % cell2.get_label_for_asset() in resp.text
|
|
994 |
assert u'Logo blabla — %s' % cell2.get_label_for_asset() not in resp.text
|
|
995 |
assert u'Picture — %s' % cell1.get_label_for_asset() in resp.text
|
|
996 |
assert u'Picture blabla — %s' % cell1.get_label_for_asset() not in resp.text
|
|
997 | 997 |
# New settings |
998 | 998 |
settings.WCS_CATEGORY_ASSET_SLOTS = {} |
999 | 999 |
settings.WCS_FORM_ASSET_SLOTS = {} |
... | ... | |
1002 | 1002 |
'wcs_wcsformsofcategorycell': {'logo': {'prefix': 'Logo'}}, |
1003 | 1003 |
} |
1004 | 1004 |
resp = app.get('/manage/assets/') |
1005 |
assert u'>Logo — %s<' % cell2.get_label_for_asset() in resp.text
|
|
1006 |
assert u'>Picture — %s<' % cell1.get_label_for_asset() in resp.text
|
|
1005 |
assert u'Logo — %s' % cell2.get_label_for_asset() in resp.text
|
|
1006 |
assert u'Picture — %s' % cell1.get_label_for_asset() in resp.text
|
|
1007 | 1007 | |
1008 | 1008 |
# test suffix |
1009 | 1009 |
settings.COMBO_CELL_ASSET_SLOTS = { |
... | ... | |
1011 | 1011 |
'wcs_wcsformsofcategorycell': {'logo': {'prefix': 'Logo', 'suffix': 'test'}}, |
1012 | 1012 |
} |
1013 | 1013 |
resp = app.get('/manage/assets/') |
1014 |
assert u'>Logo — %s (test)<' % cell2.get_label_for_asset() in resp.text
|
|
1015 |
assert u'>Picture — %s (test)<' % cell1.get_label_for_asset() in resp.text
|
|
1014 |
assert u'Logo — %s (test)' % cell2.get_label_for_asset() in resp.text
|
|
1015 |
assert u'Picture — %s (test)' % cell1.get_label_for_asset() in resp.text
|
|
1016 | 1016 | |
1017 | 1017 | |
1018 | 1018 |
def test_tracking_code_search(settings, app, nocache): |
1019 |
- |