diff --git a/cookbook/templates/generic/list_template.html b/cookbook/templates/generic/list_template.html index 92a82d7d..57ac4b08 100644 --- a/cookbook/templates/generic/list_template.html +++ b/cookbook/templates/generic/list_template.html @@ -2,31 +2,21 @@ {% load crispy_forms_tags %} {% load i18n %} {% load django_tables2 %} -{% load class_tag %} -{% block title %}{% trans 'List' %} - {{ title }}{% endblock %} + {% block content %} -

{{ title }} {% trans 'List' %} - {% if table.Meta.model|get_class == 'Category' %} - - {% elif table.Meta.model|get_class == 'Keyword' %} - - {% elif table.Meta.model|get_class == 'Storage' %} - - {% endif %} -

-
- - {% if table.Meta.model|get_class == 'RecipeImport' %} - {% trans 'Import all' %} -
-
- {% endif %} - - {% if table %} +
+

{{ title }} {% trans 'List' %} + {% if create_url %} + + + + {% endif %} +

{% render_table table %} - {% endif %} +
-{% endblock %} \ No newline at end of file +{% endblock content %} \ No newline at end of file diff --git a/cookbook/templates/generic/table_template.html b/cookbook/templates/generic/table_template.html index c40a9b96..10bc5dcd 100644 --- a/cookbook/templates/generic/table_template.html +++ b/cookbook/templates/generic/table_template.html @@ -1,100 +1,117 @@ -{% load django_tables2 %} +{% load crispy_forms_tags %} {% load i18n %} -{% block table-wrapper %} -
-
- {% block table %} - - {{ table.attrs.as_html }}{% else %}class="table table-bordered"{% endif %}> - {% block table.thead %} - {% if table.show_header %} - - - {% for column in table.columns %} +{% load django_tables2 %} +{% block content %} + + + +
+ {% if create_url %} + + + + {% endif %} + + + {% block table %} +
+ {% block table.thead %} + {% if table.show_header %} + + + {% for column in table.columns %} + + {{ column.header }} {% else %} - + {{ column.header }} {% endif %} + + {% endfor %} + + + {% endif %} + {% endblock table.thead %} + {% block table.tbody %} + + {% for row in table.paginated_rows %} + {% block table.tbody.row %} + + {% for column, cell in row.items %} + {% endfor %} - - {% endif %} - {% endblock table.thead %} - {% block table.tbody %} - - {% for row in table.page.object_list|default:table.rows %} {# support pagination #} - {% block table.tbody.row %} - - {% for column, cell in row.items %} - - {% endfor %} + {% endblock table.tbody.row %} + {% empty %} + {% if table.empty_text %} + {% block table.tbody.empty_text %} + + - {% endblock table.tbody.row %} - {% empty %} - {% if table.empty_text %} - {% block table.tbody.empty_text %} - - - - {% endblock table.tbody.empty_text %} - {% endif %} - {% endfor %} - - {% endblock table.tbody %} - {% block table.tfoot %} - {% if table.has_footer %} - - - {% for column in table.columns %} - - {% endfor %} - - + {% endblock table.tbody.empty_text %} {% endif %} - {% endblock table.tfoot %} -
{% if column.orderable %} - {{ column.header }} - {{ column.header }}
+ {% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %} + {{ cell|localize }}{% else %}{{ cell|unlocalize }} + {% endif %}{% endif %}
- {% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %} - {{ cell|localize }}{% else %}{{ cell|unlocalize }} - {% endif %}{% endif %}
{{ table.empty_text }}
{{ table.empty_text }}
{{ column.footer }}
- {% endblock table %} + {% endfor %} + + {% endblock table.tbody %} + {% block table.tfoot %} + {% if table.has_footer %} + + + {% for column in table.columns %} + {{ column.footer }} + {% endfor %} + + + {% endif %} + {% endblock table.tfoot %} + + {% endblock table %} + {% block pagination %} {% if table.page and table.paginator.num_pages > 1 %} - {% with current_page=table.page.number page_count=table.paginator.num_pages rows_per_page=table.page.object_list|length total_rows=table.page.paginator.count %} - {% block pagination %} - {% endif %} - -
+ {% endblock pagination %}
-{% endblock table-wrapper %} \ No newline at end of file +{% endblock content %} \ No newline at end of file diff --git a/cookbook/templates/index.html b/cookbook/templates/index.html index 1618d3cb..2323b72a 100644 --- a/cookbook/templates/index.html +++ b/cookbook/templates/index.html @@ -34,7 +34,7 @@
- {% if recipes %} + {% if user.is_authenticated and recipes %} {% render_table recipes %} {% else %}