summaryrefslogtreecommitdiff
path: root/lib/grappelli/templates/admin/change_list.html
blob: e40796484d88f035d8db8f8a85950df17b2f6ac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
{% extends "admin/base_site.html" %}

<!-- LOADING -->
{% load adminmedia admin_list i18n grp_tags %}

<!-- JAVASCRIPTS -->
{% block javascripts %}
    {{ block.super }}
    {% if cl.formset %}
        {% url admin:jsi18n as jsi18nurl %}
        <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
    {% endif %}
    {{ media }}
    <script type="text/javascript" src="{% admin_media_prefix %}js/grappelli.change_list.js"></script>
    <script type="text/javascript" charset="utf-8">
        {% if is_popup %}
            var IS_POPUP = true;
        {% else %}
            var IS_POPUP = false;
        {% endif %}
        (function($) {
            $(document).ready(function() {
                {% if is_popup %}
                    // UGLY HACK: REMOVE ACTIONS and LIST_EDITABLES FOR POPUPS
                    // shouldn't be there in the first place, see
                    // http://code.djangoproject.com/ticket/11700
                    $('div#actions').hide();
                    $('input.action-select').parent().hide();
                    $('input#action-toggle').parent().hide();
                    $('div.changelist-results input').attr('disabled', 'disabled');
                    $('div.changelist-results select').attr('disabled', 'disabled');
                    $('div.changelist-results textarea').attr('disabled', 'disabled').addClass("mceNoEditor");
                    $('div#submit').hide();
                    $('.related-lookup, .add-another').attr("onClick", "return false;");
                    // "really" disable datepicker in grappelli.js
                    //$('.vDateField').addClass('disabled');
                {% endif %}
                
                {% if cl.search_fields %}
                    {% get_search_fields_verbose cl.opts as search_fields_verbose %}
                    $('body').change_list({'initialSearchVal': '{% if not cl.query and not search_fields_verbose %}{% trans 'Search' %}{% endif %}{% if search_fields_verbose and not cl.query %}{{ search_fields_verbose }}{% endif %}{% if cl.query %}{{ cl.query }}{% endif %}'});
                {% else %}
                    $('body').change_list();
                {% endif %}
            });
        })(django.jQuery);
    </script>
{% endblock %}

<!-- COLTYPE/BODYCLASS-- >
{% block bodyclass %}change-list{% endblock %}
{% block content-class %}content-flexible{% endblock %}

<!-- BREADCRUMBS -- >
{% block breadcrumbs %}
    {% if not is_popup %}
        <div id="breadcrumbs">
            <a href="../../">{% trans "Home" %}</a> &rsaquo;
            <a href="../">{% trans app_label|capfirst|escape %}</a> &rsaquo;
            {{ cl.opts.verbose_name_plural|capfirst }}
        </div>
    {% endif %}
{% endblock %}

<!-- CONTENT-TITLE -->
{% block content_title %}
    <h1>
        {{ cl.opts.verbose_name_plural|capfirst }}
    </h1>
{% endblock %}

<!-- OBJECT-TOOLS -->
{% block object-tools %}
    {% if has_add_permission %}
        <ul class="tools">
            <li>
                <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="add-handler focus">
                    {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
                </a>
            </li>
        </ul>
    {% endif %}
{% endblock %}

<!-- CONTENT -->
{% block content %}
    {% if cl.search_fields or cl.has_filters or cl.date_hierarchy %}
        <div class="module changelist-filters">
            <!-- PAGINATION TOP -->
            {% pagination cl %}
            {% if cl.has_filters or cl.search_fields %}
                <!-- FILTERS -->
                {% if cl.has_filters %}
                    <div id="filters" class="module filter span-6">
                        <div class="pulldown-container">
                            <a href="javascript://" class="button toggle-filters">{% trans 'Filter' %}</a>
                            <div class="filter-pulldown">
                                {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
                            </div>
                        </div>
                    </div>
                {% endif %}
                <!-- SEARCH -->
                {% if cl.search_fields %}
                    <div id="search" class="module search span-6">
                        {% block search %}{% search_form cl %}{% endblock %}
                    </div>
                {% endif %}
            {% endif %}
            <br clear="all" />
        </div>
        <!-- DATE HIERARCHY -->
        {% if cl.date_hierarchy %}
            {% date_hierarchy cl %}
        {% endif %}
    {% endif %}
    <form action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
        <div id="changelist" class="container-full{% if cl.list_editable %} editable{% endif %}" style="">
            <!-- POPUP -->
            {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
            <!-- ERRORS -->
            {% if cl.formset.errors %}
                <p class="errornote">
                    {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
                </p>
                {{ cl.formset.non_form_errors }}
            {% endif %}
            <!-- MANAGEMENT FORM -->
            {% if cl.formset %}
                {{ cl.formset.management_form }}
            {% endif %}
            <!-- CHANGELIST-RESULTS -->
            {% block result_list %}
                {% result_list cl %}
            {% endblock %}
            <!-- PAGINATION BOTTOM -->
            {% pagination cl %}
        </div><br clear="all" />
        <!-- CHANGELIST-ACTIONS -->
        {% if action_form and cl.full_result_count and cl.result_count %}
            {% admin_actions %}
        {% endif %}
        <!-- SUBMIT ROW -->
        {% if cl.formset and cl.full_result_count and cl.result_count %}
            <div id="submit" class="module footer">
                <ul class="submit-row">
                    <li class="left delete-link-container"><a href="javascript://" class="cancel-link">Cancel</a></li>
                    <li class="submit-button-container"><input type="submit" class="default" name="_save" value="Save"/></li>
                </ul>
            </div>
        {% endif %}
    </form>
{% endblock %}