Skip to content

Commit

Permalink
Use 'pageblock' instead of 'block' as django template var
Browse files Browse the repository at this point in the history
Because 'block' has the potential to conflict with django's 'block'
templatetag.

Closes github issue #29
  • Loading branch information
nikolas committed Jul 1, 2015
1 parent c03d63f commit 09c49d8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
38 changes: 19 additions & 19 deletions pagetree/templates/pagetree/edit_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,39 +179,39 @@ <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 block in section.pageblock_set.all %}
<div class="row block-dragger" id="pageblock-{{block.id}}">
{% for pageblock in section.pageblock_set.all %}
<div class="row block-dragger" id="pageblock-{{pageblock.id}}">

<div class="col-md-1 draghandle">
<span class="glyphicon glyphicon-resize-vertical"></span>
</div>

<div class="col-md-2">
<b><a data-toggle="modal" href="#edit-pageblock-{{block.id}}">{{block.block.display_name}}</a></b>
<b><a data-toggle="modal" href="#edit-pageblock-{{pageblock.id}}">{{pageblock.block.display_name}}</a></b>
</div>

<div class="col-md-6">
<a data-toggle="modal" href="#edit-pageblock-{{block.id}}">{{block.label}}</a>
{% rendersummary block %}
<a data-toggle="modal" href="#edit-pageblock-{{pageblock.id}}">{{pageblock.label}}</a>
{% rendersummary pageblock %}
</div>

<div class="col-md-3">
<div class="btn-group">
<a data-toggle="modal" class="btn btn-default btn-sm"
href="#edit-pageblock-{{block.id}}" title="Edit">
href="#edit-pageblock-{{pageblock.id}}" title="Edit">
<span class="glyphicon glyphicon-edit"></span> edit</a>

<a href="{% url 'delete-pageblock' block.id %}"
<a href="{% url 'delete-pageblock' pageblock.id %}"
class="btn btn-danger btn-sm" title="Delete">
<span class="glyphicon glyphicon-trash"></span></a>
</div>

<div class="btn-group">
{% if block.block.exportable %}
{% if pageblock.block.exportable %}
<a class="btn btn-sm"
rel="tooltip" title="Download JSON dump of this block"
id="export-{{block.id}}"
href="{% url 'export-pageblock-json' block.id %}">
id="export-{{pageblock.id}}"
href="{% url 'export-pageblock-json' pageblock.id %}">
<span class="glyphicon glyphicon-download"></span> export</a>
{% endif %}
</div>
Expand All @@ -222,29 +222,29 @@ <h3 style="margin-top: 0;"><a href="{{root.get_edit_url}}">{{section.hierarchy.n
{% endfor %}


{% for block in section.pageblock_set.all %}
<div class="modal fade block-edit" id="edit-pageblock-{{block.id}}" role="dialog">
{% for pageblock in section.pageblock_set.all %}
<div class="modal fade block-edit" id="edit-pageblock-{{pageblock.id}}" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>Edit {{block.block.display_name}}</h3>
<h3>Edit {{pageblock.block.display_name}}</h3>
</div>
<div class="modal-body">

{% if block.block.importable %}
<a href="{% url 'import-pageblock-json' block.id %}">import json</a>
{% if pageblock.block.importable %}
<a href="{% url 'import-pageblock-json' pageblock.id %}">import json</a>
{% endif %}

<form action="{% url 'edit-pageblock' block.id %}" method="post"
<form action="{% url 'edit-pageblock' pageblock.id %}" method="post"
class=""
{% if block.edit_form.is_multipart %}
{% if pageblock.edit_form.is_multipart %}
enctype="multipart/form-data"
{% endif %}>
{% csrf_token %}

{{ block.default_edit_form|bootstrap }}
{% with block.edit_form as ef %}
{{ pageblock.default_edit_form|bootstrap }}
{% with pageblock.edit_form as ef %}
{{ ef|bootstrap }}
{% if ef.alt_text %}
<div>{{ ef.alt_text|safe }}</div>
Expand Down
16 changes: 8 additions & 8 deletions pagetree/templates/pagetree/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
{% load render %}

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

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

Expand Down Expand Up @@ -58,10 +58,10 @@ <h3>Sections</h3>
{% endif %}


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

Expand Down
14 changes: 7 additions & 7 deletions pagetree/templates/pagetree/test_page.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% load render %}

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

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

Expand Down Expand Up @@ -55,9 +55,9 @@ <h3>Sections</h3>
{% endif %}


{% for block in section.pageblock_set.all %}
<div class="pageblock{% if block.css_extra %} {{block.css_extra}}{% endif %}">
{% if block.label %}<h3>{{block.label}}</h3>{% endif %}
{% for pageblock in section.pageblock_set.all %}
<div class="pageblock{% if pageblock.css_extra %} {{pageblock.css_extra}}{% endif %}">
{% if pageblock.label %}<h3>{{pageblock.label}}</h3>{% endif %}
{% render block %}
</div>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion pagetree/templates/pagetree/testblock.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{% load markup %}
{{block.body|markdown}}
{{pageblock.body|markdown}}

0 comments on commit 09c49d8

Please sign in to comment.