Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit d6643de

Browse files
author
Greg Turner
committed
Minor refactoring of publishing_column, and a couple of tweaks to publishing to make it accommodate more types of FluentLayout model, which arose from the Articles work.
1 parent e0494a5 commit d6643de

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

icekit/dashboard/templates/admin/app_widget.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ <h3>{% firstof model.verbose_name_plural model.verbose_name|pluralize model.name
2828
<select name="type-select" class="type-select">
2929
{% for ctype_id, name in model.polymorphic_classes %}
3030
<option value="{{ model.add_url }}?ct_id={{ ctype_id }}" data-manage="{{ model.admin_url }}?ct_id={{ ctype_id }}"{% if forloop.first and not app.default_poly_child or app.default_poly_child == ctype_id %} selected{% endif %}>
31-
{{ name }}
31+
{{ name|capfirst }}
3232
</option>
3333
{% endfor %}
3434
</select>

icekit/publishing/admin.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,21 +238,13 @@ def publishing_column(self, obj):
238238
if hasattr(obj, 'get_real_instance'):
239239
obj = obj.get_real_instance()
240240

241-
try:
242-
published_obj_url = obj.get_absolute_url()
243-
draft_obj_url = published_obj_url + '?edit'
244-
except:
245-
published_obj_url = draft_obj_url = None
246-
247241
template_name = 'admin/publishing/_change_list_publishing_column.html'
248242
t = loader.get_template(template_name)
249243
c = Context({
250244
'object': obj,
251245
'has_publish_permission':
252246
self.has_publish_permission(self.request, obj),
253247
'img_path': settings.STATIC_URL + 'admin/img/',
254-
'published_url': published_obj_url,
255-
'draft_url': draft_obj_url,
256248
})
257249
try:
258250
if isinstance(obj, PublishingModel):

icekit/publishing/models.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,6 @@ def clone(src, dst):
446446

447447
@assert_draft
448448
def patch_placeholders(self):
449-
if not isinstance(self, FluentContentsPage):
450-
return
451449
published_obj = self.publishing_linked
452450

453451
for draft_placeholder, published_placeholder in zip(
@@ -494,8 +492,6 @@ def clone_placeholder(self, dst_obj):
494492
are to be related.
495493
:return: None
496494
"""
497-
if not isinstance(self, FluentContentsPage):
498-
return
499495
for src_placeholder in Placeholder.objects.parent(self):
500496
dst_placeholder = Placeholder.objects.create_for_object(
501497
dst_obj,
Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
1-
{% load i18n static %}
1+
{% load i18n static publishing_tags %}
22
<label class="publishing-links">
3-
{% if object.has_been_published and published_url %}
4-
{% if object.is_dirty %}
5-
<a target="_blank" href="{{ draft_url }}" title="Preview draft version"><i class="fa fa-circle-o"></i></a>
6-
{% else %}
7-
<i class="fa fa-circle-o" style="visibility: hidden;"></i>
8-
{% endif %}
9-
<a target="_blank" href="{{ published_url }}" title="View published{% if not object.is_dirty %}/latest{% endif %} version"><i class="fa fa-circle"></i></a>
10-
{% else %}
11-
{% if draft_url %}
12-
<a target="_blank" href="{{ draft_url }}" title="Preview draft version"><i class="fa fa-circle-o"></i></a>
13-
{% endif %}
14-
{% endif %}
15-
3+
{% with object.get_absolute_url as url %}
4+
{% if url %}
5+
{% if object.has_been_published %}
6+
{% if object.is_dirty %}
7+
<a target="_blank" href="{{ url|get_draft_url }}" title="Preview draft version"><i class="fa fa-circle-o"></i></a>
8+
{% else %}
9+
<i class="fa fa-circle-o" style="visibility: hidden;"></i>
10+
{% endif %}
11+
<a target="_blank" href="{{ url }}" title="{% if object.is_suppressed_message %}{{ object.is_suppressed_message }}{% else %}View published{% if not object.is_dirty %}/latest{% endif %} version{% endif %}" {% if object.is_suppressed_message %}class="suppressed"{% endif %}><i class="fa fa-circle"></i></a>
12+
{% else %}
13+
<a target="_blank" href="{{ url|get_draft_url }}" title="Preview draft version"><i class="fa fa-circle-o"></i></a>
14+
{% endif %}
15+
{% else %}
16+
{% if object.has_been_published %}
17+
{% if object.is_dirty %}
18+
<i class="fa fa-circle-o"></i>
19+
{% else %}
20+
<i class="fa fa-circle-o" style="visibility: hidden;"></i>
21+
{% endif %}
22+
<i class="fa fa-circle"></i>
23+
{% else %}
24+
<i class="fa fa-circle-o"></i>
25+
{% endif %}
26+
{% endif %}
27+
{% endwith %}
1628
</label>

icekit/publishing/templates/admin/publishing/publishing_change_form.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
{% block extrahead %}
1717
{{ block.super }}
1818
<script type="text/javascript">
19-
fluent_layouts.ct_id = {{ content_type_id }};
20-
fluent_layouts.layout_url = '{% url "admin:icekit_layout_changelist" %}';
19+
if (typeof fluent_layouts != 'undefined') {
20+
fluent_layouts.ct_id = {{ content_type_id }};
21+
fluent_layouts.layout_url = '{% url "admin:icekit_layout_changelist" %}';
22+
}
2123
var csrf_token = '{{ csrf_token }}';
2224
</script>
2325
<style>

0 commit comments

Comments
 (0)