Skip to content

Commit

Permalink
backwards compatibility for block/pageblock
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas committed Jul 2, 2015
1 parent 09c49d8 commit 141c42f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pagetree/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ def render(self, **kwargs):
if hasattr(self.content_object, "template_file"):
t = get_template(getattr(self.content_object, "template_file"))
d = kwargs
d['block'] = self.content_object
d['pageblock'] = self.content_object
d['block'] = d['pageblock']
c = Context(d)
return t.render(c)
else:
Expand Down
4 changes: 4 additions & 0 deletions pagetree/templates/pagetree/edit_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ <h3 style="margin-top: 0;"><a href="{{root.get_edit_url}}">{{section.hierarchy.n
<p>Drag the <span class="glyphicon glyphicon-resize-vertical"></span> arrows to reorder pageblocks:</p>

{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
<div class="row block-dragger" id="pageblock-{{pageblock.id}}">

<div class="col-md-1 draghandle">
Expand Down Expand Up @@ -219,10 +220,12 @@ <h3 style="margin-top: 0;"><a href="{{root.get_edit_url}}">{{section.hierarchy.n


</div>
{% endwith %}
{% endfor %}


{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
<div class="modal fade block-edit" id="edit-pageblock-{{pageblock.id}}" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
Expand Down Expand Up @@ -261,6 +264,7 @@ <h3>Edit {{pageblock.block.display_name}}</h3>
</form>
</div></div>
</div>
{% endwith %}
{% endfor %}

{% else %}
Expand Down
6 changes: 6 additions & 0 deletions pagetree/templates/pagetree/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@

{% block js %}
{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
{% renderjs pageblock %}
{% endwith %}
{% endfor %}
{% endblock %}

{% block css %}
{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
{% rendercss pageblock %}
{% endwith %}
{% endfor %}
{% endblock %}

Expand Down Expand Up @@ -59,10 +63,12 @@ <h3>Sections</h3>


{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
<div class="pageblock{% if pageblock.css_extra %} {{pageblock.css_extra}}{% endif %}">
{% if pageblock.label %}<h3>{{pageblock.label}}</h3>{% endif %}
{% render pageblock %}
</div>
{% endwith %}
{% endfor %}


Expand Down
6 changes: 6 additions & 0 deletions pagetree/templates/pagetree/test_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

{% block js %}
{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
{% renderjs pageblock %}
{% endwith %}
{% endfor %}
{% endblock %}

{% block css %}
{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
{% rendercss pageblock %}
{% endwith %}
{% endfor %}
{% endblock %}

Expand Down Expand Up @@ -56,10 +60,12 @@ <h3>Sections</h3>


{% for pageblock in section.pageblock_set.all %}
{% with block=pageblock %}
<div class="pageblock{% if pageblock.css_extra %} {{pageblock.css_extra}}{% endif %}">
{% if pageblock.label %}<h3>{{pageblock.label}}</h3>{% endif %}
{% render block %}
</div>
{% endwith %}
{% endfor %}


Expand Down

0 comments on commit 141c42f

Please sign in to comment.