diff --git a/combo/manager/templates/combo/ajax_cell_form.html b/combo/manager/templates/combo/ajax_cell_form.html deleted file mode 100644 index 572164d0..00000000 --- a/combo/manager/templates/combo/ajax_cell_form.html +++ /dev/null @@ -1 +0,0 @@ -{{form.as_p}} diff --git a/combo/manager/templates/combo/cell_form.html b/combo/manager/templates/combo/cell_form.html index 4f81ef12..e971b049 100644 --- a/combo/manager/templates/combo/cell_form.html +++ b/combo/manager/templates/combo/cell_form.html @@ -1,24 +1,3 @@ -{% load i18n %} {% block cell-form %} -
-{% csrf_token %} -{% if form %} -
- {{ form.as_p }} -
-{% else %} -

{% trans "There are no options for this cell." %}

-{% endif %} +{{form.as_p}} {% endblock %} -
-{% block cell-buttons %} -{% trans 'Delete' %} | -{% trans 'Visibility' %} | -{% trans 'Options' %} | -{% trans 'Close' %} -{% if form %} - -{% endif %} -{% endblock %} -
-
diff --git a/combo/manager/templates/combo/manager_edit_cell_block.html b/combo/manager/templates/combo/manager_edit_cell_block.html new file mode 100644 index 00000000..337d7a38 --- /dev/null +++ b/combo/manager/templates/combo/manager_edit_cell_block.html @@ -0,0 +1,26 @@ +{% load i18n %} +{% block cell-form %} +
+{% csrf_token %} +{% if form %} +
+ {% block cell-form-content %} + {% include cell.manager_form_template %} + {% endblock %} +
+{% else %} +

{% trans "There are no options for this cell." %}

+{% endif %} +{% endblock %} +
+{% block cell-buttons %} +{% trans 'Delete' %} | +{% trans 'Visibility' %} | +{% trans 'Options' %} | +{% trans 'Close' %} +{% if form %} + +{% endif %} +{% endblock %} +
+
diff --git a/combo/manager/templatetags/cells.py b/combo/manager/templatetags/cells.py index bd429dcb..3f95a6d7 100644 --- a/combo/manager/templatetags/cells.py +++ b/combo/manager/templatetags/cells.py @@ -29,7 +29,7 @@ def cell_form(context, cell): else: context['form'] = None context['cell'] = cell - cell_form_template = template.loader.get_template(cell.manager_form_template) + cell_form_template = template.loader.get_template('combo/manager_edit_cell_block.html') with context.push(): context = context.flatten() context.update(cell.get_extra_manager_context()) diff --git a/combo/manager/views.py b/combo/manager/views.py index 7fa45241..cca2a79a 100644 --- a/combo/manager/views.py +++ b/combo/manager/views.py @@ -352,7 +352,13 @@ page_add_cell = PageAddCellView.as_view() class PageEditCellView(UpdateView): - template_name = 'combo/ajax_cell_form.html' + def get_template_names(self): + return [self.template_name or self.object.manager_form_template] + + def get_context_data(self, **kwargs): + context = super(PageEditCellView, self).get_context_data(**kwargs) + context['cell'] = self.get_object() + return context def get_object(self, queryset=None): page_pk = self.kwargs.get('page_pk')