0001-misc-move-title-fields-to-appearance-tab-64681.patch
combo/apps/calendar/models.py | ||
---|---|---|
70 | 70 |
get_calendar_context_vars(context['request'], extra_context['cell'], events_data) |
71 | 71 |
) |
72 | 72 |
return extra_context |
73 | ||
74 |
def get_appearance_fields(self): |
|
75 |
return ['title'] |
combo/apps/dataviz/forms.py | ||
---|---|---|
126 | 126 |
class Meta: |
127 | 127 |
model = ChartNgCell |
128 | 128 |
fields = ( |
129 |
'title', |
|
130 | 129 |
'statistic', |
131 | 130 |
'time_range', |
132 | 131 |
'time_range_start', |
combo/apps/dataviz/models.py | ||
---|---|---|
91 | 91 |
'jsonp': self.jsonp_data_source, |
92 | 92 |
} |
93 | 93 | |
94 |
def get_appearance_fields(self): |
|
95 |
return ['title'] |
|
96 | ||
94 | 97 | |
95 | 98 |
@register_cell_class |
96 | 99 |
class ChartCell(CellBase): |
... | ... | |
115 | 118 | |
116 | 119 |
return ChartForm |
117 | 120 | |
121 |
def get_appearance_fields(self): |
|
122 |
return ['title'] |
|
123 | ||
118 | 124 |
def get_additional_label(self): |
119 | 125 |
if self.title: |
120 | 126 |
return self.title |
... | ... | |
727 | 733 |
self.filter_params = {k: v for k, v in self.filter_params.items() if k in subfilter_ids} |
728 | 734 |
self.save() |
729 | 735 | |
736 |
def get_appearance_fields(self): |
|
737 |
return ['title'] |
|
738 | ||
730 | 739 | |
731 | 740 |
@register_cell_class |
732 | 741 |
class ChartFiltersCell(CellBase): |
combo/apps/family/forms.py | ||
---|---|---|
23 | 23 |
class Meta: |
24 | 24 |
model = WeeklyAgendaCell |
25 | 25 |
fields = [ |
26 |
'title', |
|
27 | 26 |
'agenda_type', |
28 | 27 |
'agenda_references_template', |
29 | 28 |
'agenda_categories', |
combo/apps/family/models.py | ||
---|---|---|
112 | 112 |
from .forms import WeeklyAgendaCellForm |
113 | 113 | |
114 | 114 |
return WeeklyAgendaCellForm |
115 | ||
116 |
def get_appearance_fields(self): |
|
117 |
return ['title'] |
combo/apps/gallery/models.py | ||
---|---|---|
16 | 16 | |
17 | 17 |
import json |
18 | 18 | |
19 |
from django import forms |
|
19 | 20 |
from django.core import serializers |
20 | 21 |
from django.db import models |
21 | 22 |
from django.utils.translation import ugettext_lazy as _ |
... | ... | |
47 | 48 |
image.object.gallery_id = self.id |
48 | 49 |
image.save() |
49 | 50 | |
51 |
def get_default_form_class(self, fields=None): |
|
52 |
if fields is None: |
|
53 |
fields = [] |
|
54 |
return forms.models.modelform_factory(self.__class__, fields=fields) |
|
55 | ||
56 |
def get_appearance_fields(self): |
|
57 |
return ['title'] |
|
58 | ||
50 | 59 | |
51 | 60 |
class Image(models.Model): |
52 | 61 |
gallery = models.ForeignKey(GalleryCell, on_delete=models.CASCADE, verbose_name=_('Gallery')) |
combo/apps/lingo/models.py | ||
---|---|---|
1187 | 1187 |
return getattr(context['request'], 'user', None) and context['request'].user.is_authenticated |
1188 | 1188 | |
1189 | 1189 |
def get_default_form_class(self): |
1190 |
fields = ['title', 'text']
|
|
1190 |
fields = ['text'] |
|
1191 | 1191 |
if hasattr(self, 'hide_if_empty'): |
1192 | 1192 |
fields.append('hide_if_empty') |
1193 | 1193 |
widgets = {} |
... | ... | |
1199 | 1199 |
fields.insert(0, 'regie') |
1200 | 1200 |
return model_forms.modelform_factory(self.__class__, fields=fields, widgets=widgets) |
1201 | 1201 | |
1202 |
def get_appearance_fields(self): |
|
1203 |
return ['title'] |
|
1204 | ||
1202 | 1205 |
def get_regies(self): |
1203 | 1206 |
if self.regie: |
1204 | 1207 |
return [Regie.objects.get(slug=self.regie)] |
... | ... | |
1377 | 1380 |
regie_id = id_search.group(1) |
1378 | 1381 |
context['regies'].append((regie_id, regie)) |
1379 | 1382 |
return extra_context |
1383 | ||
1384 |
def get_appearance_fields(self): |
|
1385 |
return ['title'] |
combo/apps/maps/models.py | ||
---|---|---|
399 | 399 | |
400 | 400 |
def get_default_form_class(self): |
401 | 401 |
fields = ( |
402 |
'title', |
|
403 | 402 |
'initial_state', |
404 | 403 |
'group_markers', |
405 | 404 |
'marker_behaviour_onclick', |
... | ... | |
418 | 417 |
) |
419 | 418 |
return tabs |
420 | 419 | |
420 |
def get_appearance_fields(self): |
|
421 |
return ['title'] |
|
422 | ||
421 | 423 |
@classmethod |
422 | 424 |
def is_enabled(cls): |
423 | 425 |
return MapLayer.objects.exists() |
combo/apps/search/forms.py | ||
---|---|---|
27 | 27 |
class SearchCellForm(forms.ModelForm): |
28 | 28 |
class Meta: |
29 | 29 |
model = SearchCell |
30 |
fields = ('title', 'autofocus', 'input_placeholder')
|
|
30 |
fields = ('autofocus', 'input_placeholder') |
|
31 | 31 | |
32 | 32 | |
33 | 33 |
class SelectWithDisabled(forms.Select): |
combo/apps/search/models.py | ||
---|---|---|
173 | 173 |
extra_context.update({'initial_q': initial_q, 'initial_query_string': initial_query_string}) |
174 | 174 |
return extra_context |
175 | 175 | |
176 |
def get_appearance_fields(self): |
|
177 |
return ['title'] |
|
178 | ||
176 | 179 |
@classmethod |
177 | 180 |
def ajax_results_view(cls, request, cell_pk, service_slug): |
178 | 181 |
cell = get_object_or_404(cls, pk=cell_pk) |
combo/apps/wcs/forms.py | ||
---|---|---|
54 | 54 | |
55 | 55 |
class Meta: |
56 | 56 |
model = WcsCardsCell |
57 |
fields = ('carddef_reference', 'custom_title', 'limit', 'only_for_user')
|
|
57 |
fields = ('carddef_reference', 'limit', 'only_for_user') |
|
58 | 58 | |
59 | 59 |
def __init__(self, *args, **kwargs): |
60 | 60 |
instance = kwargs['instance'] |
... | ... | |
80 | 80 |
model = WcsCardInfosCell |
81 | 81 |
fields = ( |
82 | 82 |
'carddef_reference', |
83 |
'title_type', |
|
84 |
'custom_title', |
|
85 | 83 |
'related_card_path', |
86 | 84 |
'card_ids', |
87 | 85 |
'custom_schema', |
... | ... | |
210 | 208 |
field_order = [ |
211 | 209 |
'wcs_site', |
212 | 210 |
'categories', |
213 |
'custom_title', |
|
214 | 211 |
'current_forms', |
215 | 212 |
'done_forms', |
216 | 213 |
'include_drafts', |
... | ... | |
221 | 218 |
model = WcsCurrentFormsCell |
222 | 219 |
fields = [ |
223 | 220 |
'wcs_site', |
224 |
'custom_title', |
|
225 | 221 |
'current_forms', |
226 | 222 |
'done_forms', |
227 | 223 |
'include_drafts', |
combo/apps/wcs/models.py | ||
---|---|---|
555 | 555 | |
556 | 556 |
return context |
557 | 557 | |
558 |
def get_appearance_fields(self): |
|
559 |
yield 'custom_title' |
|
560 | ||
558 | 561 | |
559 | 562 |
@register_cell_class |
560 | 563 |
class WcsCurrentDraftsCell(CategoriesAndWcsSiteValidityMixin, CategoriesFilteringMixin, WcsUserDataBaseCell): |
... | ... | |
929 | 932 | |
930 | 933 |
return WcsCardsCellForm |
931 | 934 | |
935 |
def get_appearance_fields(self): |
|
936 |
return ['custom_title'] |
|
937 | ||
932 | 938 |
def render_for_search(self): |
933 | 939 |
return '' |
934 | 940 | |
... | ... | |
961 | 967 | |
962 | 968 |
default_template_name = 'combo/wcs/card.html' |
963 | 969 |
manager_form_template = 'combo/wcs/manager/card-infos-cell-form.html' |
970 |
manager_appearance_template = 'combo/wcs/manager/card-infos-cell-form-appearance.html' |
|
964 | 971 | |
965 | 972 |
class Meta: |
966 | 973 |
verbose_name = _('Card Information Cell') |
... | ... | |
1375 | 1382 | |
1376 | 1383 |
return WcsCardInfoCellForm |
1377 | 1384 | |
1385 |
def get_appearance_fields(self): |
|
1386 |
return ['title_type', 'custom_title'] |
|
1387 | ||
1378 | 1388 |
def get_custom_schema(self): |
1379 | 1389 |
custom_schema = self.custom_schema or {} |
1380 | 1390 |
combo/apps/wcs/templates/combo/wcs/manager/card-infos-cell-form-appearance.html | ||
---|---|---|
1 |
{% extends "combo/cell_appearance.html" %} |
|
2 | ||
3 |
{% block cell-form-appearance %} |
|
4 |
{{ block.super }} |
|
5 |
<script> |
|
6 |
{# display/hide custom_title field #} |
|
7 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-title_type').on('change', function() { |
|
8 |
if ($(this).val() == 'manual') { |
|
9 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-custom_title').parent().show(); |
|
10 |
} else { |
|
11 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-custom_title').parent().hide(); |
|
12 |
} |
|
13 |
}); |
|
14 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-title_type').change(); |
|
15 | ||
16 |
{# display/hide card_ids field #} |
|
17 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-related_card_path').on('change', function() { |
|
18 |
if (!$(this).val()) { |
|
19 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-card_ids').parent().show(); |
|
20 |
} else { |
|
21 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-card_ids').parent().hide(); |
|
22 |
} |
|
23 |
}); |
|
24 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-related_card_path').change(); |
|
25 |
</script> |
|
26 |
{% endblock %} |
combo/apps/wcs/templates/combo/wcs/manager/card-infos-cell-form.html | ||
---|---|---|
166 | 166 |
</script> |
167 | 167 | |
168 | 168 |
{% endif %} |
169 | ||
170 |
<script> |
|
171 |
{# display/hide custom_title field #} |
|
172 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-title_type').on('change', function() { |
|
173 |
if ($(this).val() == 'manual') { |
|
174 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-custom_title').parent().show(); |
|
175 |
} else { |
|
176 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-custom_title').parent().hide(); |
|
177 |
} |
|
178 |
}); |
|
179 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-title_type').change(); |
|
180 | ||
181 |
{# display/hide card_ids field #} |
|
182 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-related_card_path').on('change', function() { |
|
183 |
if (!$(this).val()) { |
|
184 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-card_ids').parent().show(); |
|
185 |
} else { |
|
186 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-card_ids').parent().hide(); |
|
187 |
} |
|
188 |
}); |
|
189 |
$('#id_cwcs_wcscardinfoscell-{{ cell.pk }}-related_card_path').change(); |
|
190 |
</script> |
|
191 | 169 |
{% endblock %} |
combo/data/forms.py | ||
---|---|---|
42 | 42 |
class LinkCellForm(forms.ModelForm): |
43 | 43 |
class Meta: |
44 | 44 |
model = LinkCell |
45 |
fields = ('title', 'url', 'link_page', 'anchor')
|
|
45 |
fields = ('url', 'link_page', 'anchor') |
|
46 | 46 | |
47 | 47 |
def __init__(self, *args, **kwargs): |
48 | 48 |
super().__init__(*args, **kwargs) |
... | ... | |
58 | 58 |
class LinkListCellForm(forms.ModelForm): |
59 | 59 |
class Meta: |
60 | 60 |
model = LinkListCell |
61 |
fields = ['title', 'limit']
|
|
61 |
fields = ['limit'] |
|
62 | 62 | |
63 | 63 |
def __init__(self, *args, **kwargs): |
64 | 64 |
super().__init__(*args, **kwargs) |
combo/data/models.py | ||
---|---|---|
1146 | 1146 |
'restricted_to_unlogged', |
1147 | 1147 |
'template_name', |
1148 | 1148 |
) |
1149 |
+ tuple(self.get_appearance_fields()) |
|
1149 | 1150 |
] |
1150 | 1151 | |
1151 | 1152 |
def get_default_form_class(self, fields=None): |
... | ... | |
1161 | 1162 |
self.__class__, fields=fields, **self.manager_form_factory_kwargs |
1162 | 1163 |
) |
1163 | 1164 | |
1165 |
def get_appearance_fields(self): |
|
1166 |
return [] |
|
1167 | ||
1164 | 1168 |
def get_appearance_form_class(self): |
1165 |
fields = ['slug', 'extra_css_class'] |
|
1169 |
fields = list(self.get_appearance_fields()) + ['slug', 'extra_css_class']
|
|
1166 | 1170 |
widgets = None |
1167 | 1171 |
extra_templates = settings.COMBO_CELL_TEMPLATES.get(self.get_cell_type_str()) |
1168 | 1172 |
if extra_templates: |
... | ... | |
1688 | 1692 |
) |
1689 | 1693 |
return tabs |
1690 | 1694 | |
1695 |
def get_appearance_fields(self): |
|
1696 |
return ['title'] |
|
1697 | ||
1691 | 1698 |
def render_for_search(self): |
1692 | 1699 |
return '' |
1693 | 1700 | |
... | ... | |
1796 | 1803 | |
1797 | 1804 |
return LinkListCellForm |
1798 | 1805 | |
1806 |
def get_appearance_fields(self): |
|
1807 |
return ['title'] |
|
1808 | ||
1799 | 1809 |
def export_subobjects(self): |
1800 | 1810 |
links = json.loads( |
1801 | 1811 |
serializers.serialize( |
... | ... | |
1908 | 1918 |
pass |
1909 | 1919 |
return extra_context |
1910 | 1920 | |
1921 |
def get_appearance_fields(self): |
|
1922 |
return ['title'] |
|
1923 | ||
1911 | 1924 |
def render(self, context): |
1912 | 1925 |
cache_key = hashlib.md5(smart_bytes(self.url)).hexdigest() |
1913 | 1926 |
feed_content = cache.get(cache_key) |
... | ... | |
2245 | 2258 |
def varnames(self): |
2246 | 2259 |
return [vn.strip() for vn in self.varnames_str.split(',') if vn.strip()] |
2247 | 2260 | |
2261 |
def get_appearance_fields(self): |
|
2262 |
return ['title'] |
|
2263 | ||
2248 | 2264 | |
2249 | 2265 |
class ConfigJsonCellManager(models.Manager): |
2250 | 2266 |
def get_queryset(self): |
combo/manager/templates/combo/cell_appearance.html | ||
---|---|---|
1 | 1 |
{% load i18n %} |
2 |
{% block cell-form-appearance %} |
|
2 | 3 |
{{ appearance_form.as_p }} |
3 | 4 |
{% if cell.can_have_assets %} |
4 | 5 |
<p><a rel="popup" data-selector="div#assets-listing" href="{% url 'combo-manager-slot-assets' cell_reference=cell.get_reference %}" |
5 | 6 |
>{% trans 'Assets' %}</a></p> |
6 | 7 |
{% endif %} |
8 |
{% endblock %} |
tests/test_cells.py | ||
---|---|---|
377 | 377 |
assert ValidityInfo.objects.exists() is False |
378 | 378 | |
379 | 379 | |
380 |
def test_manager_feed_cell_tabs(app, admin_user): |
|
381 |
page = Page.objects.create(title='example page', slug='example-page') |
|
382 |
FeedCell.objects.create(page=page, placeholder='content', order=1) |
|
383 |
app = login(app) |
|
384 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
385 | ||
386 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
387 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
388 | ||
389 | ||
380 | 390 |
def test_menu_cell(): |
381 | 391 |
Page.objects.all().delete() |
382 | 392 |
parent = Page.objects.create( |
... | ... | |
840 | 850 |
assert ValidityInfo.objects.exists() is False |
841 | 851 | |
842 | 852 | |
853 |
def test_manager_json_cell_tabs(app, admin_user): |
|
854 |
page = Page.objects.create(title='example page', slug='example-page') |
|
855 |
JsonCell.objects.create( |
|
856 |
page=page, |
|
857 |
placeholder='content', |
|
858 |
order=1, |
|
859 |
varnames_str='var1, var2, ', |
|
860 |
url='http://foo?varone=[var1]&vartwo=[var2]', |
|
861 |
) |
|
862 |
app = login(app) |
|
863 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
864 | ||
865 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
866 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
867 | ||
868 | ||
843 | 869 |
def test_config_json_cell(): |
844 | 870 |
page = Page(title='example page', slug='example-page') |
845 | 871 |
page.save() |
tests/test_dataviz.py | ||
---|---|---|
1619 | 1619 |
assert [x[0] for x in color_field.options] == ['red', 'green', 'blue'] |
1620 | 1620 | |
1621 | 1621 | |
1622 |
def test_chartng_cell_manager_new_api_tabs(app, admin_user): |
|
1623 |
page = Page.objects.create(title='One', slug='index') |
|
1624 |
cell = ChartNgCell(page=page, order=1, placeholder='content') |
|
1625 |
cell.save() |
|
1626 | ||
1627 |
login(app) |
|
1628 |
resp = app.get('/manage/pages/%s/' % page.id) |
|
1629 | ||
1630 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
1631 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
1632 | ||
1633 | ||
1622 | 1634 |
@with_httmock(bijoe_mock) |
1623 | 1635 |
def test_table_cell(app, admin_user, statistics): |
1624 | 1636 |
page = Page(title='One', slug='index') |
tests/test_family.py | ||
---|---|---|
84 | 84 |
assert cell.end_date_filter == '{{ end_date }}' |
85 | 85 | |
86 | 86 | |
87 |
def test_manager_weeklyagenda_cell_tabs(app, admin_user): |
|
88 |
page = Page.objects.create(title='Family', slug='family', template_name='standard') |
|
89 |
WeeklyAgendaCell.objects.create(page=page, placeholder='content', order=0) |
|
90 |
login(app) |
|
91 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
92 | ||
93 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
94 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
95 | ||
96 | ||
87 | 97 |
def test_weeklyagenda_cell_user_external_id(context): |
88 | 98 |
page = Page.objects.create(title='Family', slug='index', template_name='standard') |
89 | 99 |
cell = WeeklyAgendaCell.objects.create(page=page, placeholder='content', order=0, agenda_type='manual') |
tests/test_gallery_cell.py | ||
---|---|---|
73 | 73 |
status=404, |
74 | 74 |
) |
75 | 75 |
app.get(reverse('combo-gallery-image-order', kwargs={'gallery_pk': 0}), status=404) |
76 | ||
77 | ||
78 |
def test_manager_gallery_cell_tabs(app, admin_user): |
|
79 |
page = Page(title='Pictures', slug='test_gallery_cell', template_name='standard') |
|
80 |
page.save() |
|
81 |
cell = GalleryCell(page=page, placeholder='content', order=0) |
|
82 |
cell.save() |
|
83 | ||
84 |
app = login(app) |
|
85 |
resp = app.get('/manage/pages/%s/' % page.id) |
|
86 | ||
87 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
88 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
tests/test_lingo_manager.py | ||
---|---|---|
566 | 566 |
assert resp.text.count('ROLDET:') == 1 |
567 | 567 | |
568 | 568 | |
569 |
def test_manager_tipi_cell_tabs(app, admin_user): |
|
570 |
page = Page(title='tipi', slug='tipi', template_name='standard') |
|
571 |
page.save() |
|
572 |
cell = TipiPaymentFormCell(title='Test payment', page=page, placeholder='content', order=0) |
|
573 |
cell.save() |
|
574 | ||
575 |
app = login(app) |
|
576 |
resp = app.get('/manage/pages/%s/' % page.id, status=200) |
|
577 | ||
578 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
579 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
580 | ||
581 | ||
569 | 582 |
def test_configure_invoices_cell(app, admin_user, payment_backend): |
570 | 583 |
page = Page(title='xxx', slug='test', template_name='standard') |
571 | 584 |
page.save() |
... | ... | |
621 | 634 |
assert ActiveItems.objects.get(id=cell.id).regie == regie2.slug |
622 | 635 | |
623 | 636 | |
637 |
def test_manager_invoices_cell_tabs(app, admin_user): |
|
638 |
page = Page(title='xxx', slug='test', template_name='standard') |
|
639 |
page.save() |
|
640 |
cell = ActiveItems(regie='remote', page=page, placeholder='content', order=0) |
|
641 |
cell.save() |
|
642 | ||
643 |
app = login(app) |
|
644 |
resp = app.get('/manage/pages/%s/' % page.id, status=200) |
|
645 | ||
646 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
647 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
648 | ||
649 | ||
624 | 650 |
def test_payment_backend_list(app, admin_user): |
625 | 651 |
PaymentBackend.objects.create(label='label1', slug='slug1') |
626 | 652 |
PaymentBackend.objects.create(label='label2', slug='slug2') |
tests/test_manager.py | ||
---|---|---|
2591 | 2591 |
assert 'extra_css_class' not in form.fields |
2592 | 2592 | |
2593 | 2593 | |
2594 |
def test_manager_link_cell_tabs(app, admin_user): |
|
2595 |
page = Page.objects.create(title='One', slug='one', template_name='standard') |
|
2596 |
LinkCell.objects.create(order=0, placeholder='content', page=page) |
|
2597 |
app = login(app) |
|
2598 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
2599 | ||
2600 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
2601 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
2602 | ||
2603 | ||
2594 | 2604 |
def test_link_cell_validation(): |
2595 | 2605 |
form = LinkCellForm(data={'url': 'http://example.com'}) |
2596 | 2606 |
assert form.is_valid() is True |
tests/test_maps_manager.py | ||
---|---|---|
311 | 311 |
assert resp.status_int == 302 |
312 | 312 |
assert resp.location.endswith('/manage/pages/%s/#cell-%s' % (page.pk, cell.get_reference())) |
313 | 313 |
assert MapLayerOptions.objects.count() == 0 |
314 | ||
315 | ||
316 |
def test_manager_maps_cell_tabs(app, admin_user): |
|
317 |
page = Page.objects.create(title='One', slug='one', template_name='standard') |
|
318 |
Map.objects.create(page=page, placeholder='content', order=0, public=True, title='Map') |
|
319 |
app = login(app) |
|
320 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
321 | ||
322 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
323 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
tests/test_search.py | ||
---|---|---|
851 | 851 |
assert cell._search_services == {'data': ['search_tmpl', '_text', 'search1']} |
852 | 852 | |
853 | 853 | |
854 |
def test_manager_search_cell_tabs(app, admin_user): |
|
855 |
page = Page.objects.create(title='One', slug='one', template_name='standard') |
|
856 |
SearchCell.objects.create(page=page, placeholder='content', order=0) |
|
857 |
app = login(app) |
|
858 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
859 | ||
860 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
861 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
862 | ||
863 | ||
854 | 864 |
def test_manager_waiting_index_message(app, admin_user): |
855 | 865 |
page = Page.objects.create(title='One', slug='one', template_name='standard') |
856 | 866 |
cell = SearchCell.objects.create(page=page, placeholder='content', order=0) |
tests/test_wcs.py | ||
---|---|---|
1594 | 1594 |
assert resp.form['c%s-wcs_site' % cells[0].get_reference()].attrs['type'] == 'hidden' |
1595 | 1595 | |
1596 | 1596 | |
1597 |
def test_manager_current_forms_tabs(app, admin_user): |
|
1598 |
page = Page(title='One', slug='one', template_name='standard') |
|
1599 |
page.save() |
|
1600 |
cell = WcsCurrentFormsCell.objects.create(page=page, placeholder='content', order=1) |
|
1601 |
cell.save() |
|
1602 |
app = login(app) |
|
1603 |
resp = app.get('/manage/pages/%s/' % page.id) |
|
1604 | ||
1605 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="custom_title"]') |
|
1606 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="custom_title"]') |
|
1607 | ||
1608 | ||
1597 | 1609 |
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send) |
1598 | 1610 |
def test_manager_forms_in_your_care_cell(mock_send, app, admin_user): |
1599 | 1611 |
page = Page(title='One', slug='one', template_name='standard') |
... | ... | |
1635 | 1647 |
assert resp.forms[0]['c%s-with_user' % cell.get_reference()].value is None |
1636 | 1648 | |
1637 | 1649 | |
1650 |
def test_manager_cards_cell_tabs(app, admin_user): |
|
1651 |
page = Page.objects.create(title='xxx', slug='test_cards_cell_save_cache', template_name='standard') |
|
1652 |
WcsCardsCell.objects.create(page=page, placeholder='content', order=0) |
|
1653 |
login(app) |
|
1654 | ||
1655 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
1656 | ||
1657 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="custom_title"]') |
|
1658 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="custom_title"]') |
|
1659 | ||
1660 | ||
1638 | 1661 |
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send) |
1639 | 1662 |
def test_cards_cell_setup(mock_send): |
1640 | 1663 |
cell = WcsCardsCell() |
... | ... | |
2456 | 2479 |
] |
2457 | 2480 | |
2458 | 2481 | |
2482 |
def test_manager_card_cell_tabs(app, admin_user): |
|
2483 |
page = Page.objects.create(title='xxx', slug='test_cards', template_name='standard', sub_slug='foobar') |
|
2484 |
WcsCardInfosCell.objects.create(page=page, placeholder='content', order=0) |
|
2485 | ||
2486 |
app = login(app) |
|
2487 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
2488 | ||
2489 |
assert not resp.pyquery('[data-tab-slug="general"] select[name$="title_type"]') |
|
2490 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="custom_title"]') |
|
2491 |
assert resp.pyquery('[data-tab-slug="appearance"] select[name$="title_type"]') |
|
2492 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="custom_title"]') |
|
2493 | ||
2494 | ||
2459 | 2495 |
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send) |
2460 | 2496 |
def test_card_cell_load(mock_send): |
2461 | 2497 |
page = Page.objects.create(title='xxx', slug='test_cards', template_name='standard') |
... | ... | |
4203 | 4239 |
assert WcsFormCell.objects.count() == 0 |
4204 | 4240 | |
4205 | 4241 | |
4242 |
def test_manager_link_list_tabs(app, admin_user): |
|
4243 |
page = Page.objects.create(title='One', slug='one', template_name='standard') |
|
4244 |
LinkListCell.objects.create(order=0, placeholder='content', page=page) |
|
4245 |
app = login(app) |
|
4246 |
resp = app.get('/manage/pages/%s/' % page.pk) |
|
4247 | ||
4248 |
assert not resp.pyquery('[data-tab-slug="general"] input[name$="title"]') |
|
4249 |
assert resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]') |
|
4250 | ||
4251 | ||
4206 | 4252 |
def test_import_export_pages_with_links(): |
4207 | 4253 |
page = Page(title='bar', slug='bar', order=1) |
4208 | 4254 |
page.save() |
4209 |
- |