0002-pages-add-navigation-buttons-on-page-view-12437.patch
combo/manager/static/css/combo.manager.css | ||
---|---|---|
129 | 129 |
margin-left: 2em; |
130 | 130 |
} |
131 | 131 | |
132 |
.icon-eye-open:before { content: "\f06e "; } |
|
133 | ||
134 | 132 |
div.objects-list { |
135 | 133 |
clear: both; |
136 | 134 |
} |
... | ... | |
191 | 189 | |
192 | 190 |
.icon-eye-open:before { content: "\f06e "; } |
193 | 191 |
.icon-edit:before { content: "\f044"; } |
192 |
.icon { |
|
193 |
content: ""; |
|
194 |
font-family: FontAwesome; |
|
195 |
padding-right: 1ex; |
|
196 |
} |
|
197 |
.icon-chevron-left:before { |
|
198 |
content: "\f053"; |
|
199 |
} |
|
200 |
.icon-chevron-right:before { |
|
201 |
content: "\f054"; |
|
202 |
} |
|
203 |
.icon-chevron-up:before { |
|
204 |
content: "\f077"; |
|
205 |
} |
|
206 | ||
207 |
p.navigation a:link { |
|
208 |
border-bottom: none; |
|
209 |
} |
|
194 | 210 | |
195 | 211 |
#assets-browser { |
196 | 212 |
display: flex; |
combo/manager/templates/combo/page_view.html | ||
---|---|---|
24 | 24 |
<div class="page-options"> |
25 | 25 |
<h3>{% trans 'Parameters' %}</h3> |
26 | 26 | |
27 |
<p class="navigation"> |
|
28 |
<label>{% trans 'Navigation:' %}</label> |
|
29 |
{% if object.parent_id %} |
|
30 |
<a href="{% url 'combo-manager-page-view' pk=object.parent_id %}"><i class="icon icon-chevron-up"></i></a> |
|
31 |
{% endif %} |
|
32 |
{% if previous_page %} |
|
33 |
<a href="{% url 'combo-manager-page-view' pk=previous_page.pk %}"><i class="icon icon-chevron-left"></i></a> |
|
34 |
{% endif %} |
|
35 |
{% if next_page %} |
|
36 |
<a href="{% url 'combo-manager-page-view' pk=next_page.pk %}"><i class="icon icon-chevron-right"></i></a> |
|
37 |
{% endif %} |
|
38 |
</p> |
|
39 | ||
27 | 40 |
<p> |
28 | 41 |
<label>{% trans 'Title:' %}</label> |
29 | 42 |
{{object.title}} |
combo/manager/views.py | ||
---|---|---|
255 | 255 |
placeholders.append(placeholder_dict) |
256 | 256 | |
257 | 257 |
context['placeholders'] = placeholders |
258 | ||
259 |
context.update({ |
|
260 |
'previous_page': self.object.get_previous_page(check_visibility=False), |
|
261 |
'next_page': self.object.get_next_page(check_visibility=False), |
|
262 |
}) |
|
263 | ||
258 | 264 |
return context |
259 | 265 | |
266 | ||
260 | 267 |
page_view = requires_csrf_token(PageView.as_view()) |
261 | 268 | |
262 | 269 |
tests/test_manager.py | ||
---|---|---|
186 | 186 |
assert '<img' in resp.text |
187 | 187 |
assert Page.objects.get(id=page.id).picture.url in resp.text |
188 | 188 | |
189 | ||
190 |
def test_edit_page_navigation(app, admin_user): |
|
191 |
page1 = Page.objects.create(title='One', slug='one', parent=None, template_name='standard') |
|
192 |
page2 = Page.objects.create(title='Two', slug='two', parent=page1, template_name='standard') |
|
193 |
page3 = Page.objects.create(title='Three', slug='three', parent=page1, template_name='standard') |
|
194 |
page4 = Page.objects.create(title='Four', slug='four', parent=None, template_name='standard') |
|
195 | ||
196 |
app = login(app) |
|
197 | ||
198 |
resp = app.get('/manage/pages/%s/' % page1.pk) |
|
199 |
assert '<i class="icon icon-chevron-up"></i></a>' not in resp.text |
|
200 |
assert '<i class="icon icon-chevron-left"></i></a>' not in resp.text |
|
201 |
assert '<a href="/manage/pages/%s/"><i class="icon icon-chevron-right"></i></a>' % page2.pk in resp.text |
|
202 | ||
203 |
resp = app.get('/manage/pages/%s/' % page2.pk) |
|
204 |
assert '<a href="/manage/pages/%s/"><i class="icon icon-chevron-up"></i></a>' % page1.pk in resp.text |
|
205 |
assert '<a href="/manage/pages/%s/"><i class="icon icon-chevron-left"></i></a>' % page1.pk in resp.text |
|
206 |
assert '<a href="/manage/pages/%s/"><i class="icon icon-chevron-right"></i></a>' % page3.pk in resp.text |
|
207 | ||
208 |
resp = app.get('/manage/pages/%s/' % page4.pk) |
|
209 |
assert '<i class="icon icon-chevron-up"></i></a>' not in resp.text |
|
210 |
assert '<a href="/manage/pages/%s/"><i class="icon icon-chevron-left"></i></a>' % page3.pk in resp.text |
|
211 |
assert '<i class="icon icon-chevron-right"></i></a>' not in resp.text |
|
212 | ||
213 | ||
189 | 214 |
def test_delete_page(app, admin_user): |
190 | 215 |
Page.objects.all().delete() |
191 | 216 |
page = Page(title='One', slug='one', template_name='standard') |
... | ... | |
1005 | 1030 |
assert resp.headers['content-type'] == 'application/javascript' |
1006 | 1031 |
assert resp.text.startswith('fooBar([{"') |
1007 | 1032 | |
1033 | ||
1008 | 1034 |
def test_page_multiple_link_cells(app, admin_user): |
1009 | 1035 |
Page.objects.all().delete() |
1010 | 1036 |
page = Page(title='One', slug='one', template_name='standard') |
... | ... | |
1017 | 1043 |
patched_orig = Page.get_as_reordered_flat_hierarchy |
1018 | 1044 |
app = login(app) |
1019 | 1045 |
with mock.patch('combo.data.models.Page.get_as_reordered_flat_hierarchy') as func: |
1020 |
func.return_value = [] |
|
1021 |
resp = app.get('/manage/pages/%s/' % page.id) |
|
1022 |
assert func.call_count == 1 |
|
1046 |
func.side_effect = lambda *args, **kwargs: patched_orig(*args, **kwargs) |
|
1047 |
app.get('/manage/pages/%s/' % page.id) |
|
1048 |
# only 1 call for combo.data.forms.get_page_choices |
|
1049 |
# 1 call for get_previous_page and 1 call for get_next_page |
|
1050 |
assert func.call_count == 3 |
|
1051 | ||
1023 | 1052 | |
1024 | 1053 |
def test_page_cell_placeholder(app, admin_user): |
1025 | 1054 |
page = Page(title='One', slug='one', template_name='standard') |
1026 |
- |