{% extends "admin/base_site.html" %}
{% load i18n %}
{% block bodyclass %}grp-doc{% endblock %}
{% block content-class %}{% endblock %}
{% block title %}Grappelli Documentation &raquo; Modules{% endblock %}

{% block extrahead %}
    <script type="text/javascript" charset="utf-8">
        (function($) {
            $(document).ready(function() {
                $("#grp-content-container .grp-group").grp_collapsible_group();
                $("#grp-content-container .grp-collapse").grp_collapsible({
                    on_init: function(elem, options) {
                        // open collapse (and all collapse parents) in case of errors
                        if (elem.find("ul.errorlist").length > 0) {
                            elem.removeClass("grp-closed")
                                .addClass("grp-open");
                            elem.parents(".grp-collapse")
                                .removeClass("grp-closed")
                                .addClass("grp-open");
                        }
                    }
                });
            });
        })(grp.jQuery);
    </script>
{% endblock %}

{% block breadcrumbs %}
    <ul>
        <li><a href="../">Grappelli Documentation</a></li>
        <li>Modules</li>
    </ul>
{% endblock %}

{% block content %}
    <h1>Modules</h1>
    <div class="g-d-c">
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Modules &amp; Rows</h1>
                    <p>The most essential component of Grappelli is a <span class="grp-doc-class">.grp-module</span>, wrapping pieces of related content. The horizontal layout within a module is structured by one ore more <span class="grp-doc-class">.grp-row</span>. A row stretches over the full width of the parent module and represents one piece of content or contains multiple pieces of content which belong together. Additionally, there might be a description for a module. In that case, just put a <span class="grp-doc-dom"><span>p.grp-description</span></span> in a <span class="grp-doc-class">.grp-row</span>.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <div class="grp-module">
                        <h2>Module</h2>
                        <div class="grp-row"><p class="grp-description">Some text describing the module</p></div>
                        <div class="grp-row"><p>Row</p></div>
                        <div class="grp-row"><p>Row</p></div>
                        <div class="grp-row"><p>Row</p></div>
                    </div>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code"><pre><code>{% filter force_escape %}
<div class="grp-module">
    <h2>Module</h2>
    <div class="grp-row"><p class="grp-description">Some text describing the module</p></div>
    <div class="grp-row"><p>Row</p></div>
    <div class="grp-row"><p>Row</p></div>
    <div class="grp-row"><p>Row</p></div>
</div>
{% endfilter %}</code></pre></div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Rows Split into Cells</h1>
                    <p>Rows might be split into two or more cells. To do so assign <span class="grp-doc-class">.grp-cells</span> to the <span class="grp-doc-class">.grp-row</span> you want to carry the cells. Each cell within that row is a <span class="grp-doc-class">.grp-cell</span> then.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <div class="grp-module">
                        <h2>Module</h2>
                        <div class="grp-row grp-cells">
                            <div class="grp-cell"><p>Cell</p></div>
                            <div class="grp-cell"><p>Cell</p></div>
                            <div class="grp-cell"><p>Cell</p></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code"><pre><code>{% filter force_escape %}
<div class="grp-module">
    <h2>Module</h2>
    <div class="grp-row grp-cells">
        <div class="grp-cell"><p>Cell</p></div>
        <div class="grp-cell"><p>Cell</p></div>
        <div class="grp-cell"><p>Cell</p></div>
    </div>
</div>
{% endfilter %}</code></pre></div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Nested Modules</h1>
                    <p>Modules may be nested up to three levels.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <div class="grp-module">
                        <h2>Parent Module</h2>
                        <div class="grp-module">
                            <h3>Child Module</h3>
                            <div class="grp-row"><p>Row</p></div>
                            <div class="grp-row"><p>Row</p></div>
                        </div>
                        <div class="grp-module">
                            <h3>Child Module</h3>
                            <div class="grp-module">
                                <h4>Grandchild Module</h4>
                                <div class="grp-row"><p>Row</p></div>
                                <div class="grp-row"><p>Row</p></div>
                            </div>
                            <div class="grp-module">
                                <h4>Grandchild Module</h4>
                                <div class="grp-row"><p>Row</p></div>
                                <div class="grp-row"><p>Row</p></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code"><pre><code>{% filter force_escape %}
<div class="grp-module">
    <h2>Parent Module</h2>
    <div class="grp-module">
        <h3>Child Module</h3>
        <div class="grp-row"><p>Row</p></div>
        <div class="grp-row"><p>Row</p></div>
    </div>
    <div class="grp-module">
        <h3>Child Module</h3>
        <div class="grp-module">
            <h4>Grandchild Module</h4>
            <div class="grp-row"><p>Row</p></div>
            <div class="grp-row"><p>Row</p></div>
        </div>
        <div class="grp-module">
            <h4>Grandchild Module</h4>
            <div class="grp-row"><p>Row</p></div>
            <div class="grp-row"><p>Row</p></div>
        </div>
    </div>
</div>
                {% endfilter %}</code></pre></div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Headings in Modules</h1>
                    <p>A module usually contains a heading. Although that heading is optional, modules without it do not appear in document outlines &mdash; besides, the heading is required if your module is collapsible.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <div class="g-d-12">
                        <div class="grp-module">
                            <h2>Heading 2</h2>
                            <div class="grp-row"><p>Row</p></div>
                            <div class="grp-row"><p>Row</p></div>
                        </div>
                    </div>
                    <div class="g-d-12 g-d-l">
                        <div class="grp-module">
                            <div class="grp-row"><p>Row</p></div>
                            <div class="grp-row"><p>Row</p></div>
                            <div class="grp-row"><p>Row</p></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="g-d-24">
                <div class="g-d-12">
                    <div class="grp-doc-code"><pre><code>{% filter force_escape %}
<div class="grp-module">
    <h2>Heading 2</h2>
    <div class="grp-row"><p>Row</p></div>
    <div class="grp-row"><p>Row</p></div>
</div>
                    {% endfilter %}</code></pre></div>
                </div>
                <div class="g-d-12 g-d-l">
                    <div class="grp-doc-code"><pre><code>{% filter force_escape %}
<div class="grp-module">
    <div class="grp-row"><p>Row</p></div>
    <div class="grp-row"><p>Row</p></div>
    <div class="grp-row"><p>Row</p></div>
</div>
                    {% endfilter %}</code></pre></div>
                </div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Collapsible Modules</h1>
                    <p>To make a module collapsible, just add <span class="grp-doc-class">.grp-collapse</span>. With adding <span class="grp-doc-class">.grp-open</span> or <span class="grp-doc-class">.grp-closed</span> you define whether the collapsible module is opened or closed by default. Moreover, you need to define a <span class="grp-doc-class">.grp-collapse-handler</span> which is usually the heading, but you may assign that class to other elements as well. Finally, you have to use some javascript code (see source code below).</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <div class="grp-module grp-collapse grp-open">
                        <h2 class="grp-collapse-handler">Parent Module</h2>
                        <div class="grp-module grp-collapse grp-open">
                            <h3 class="grp-collapse-handler">Child Module</h3>
                            <div class="grp-row"><p>Row</p></div>
                            <div class="grp-row"><p>Row</p></div>
                        </div>
                        <div class="grp-module grp-collapse grp-closed">
                            <h3 class="grp-collapse-handler">Child Module</h3>
                            <div class="grp-row"><p>Row</p></div>
                            <div class="grp-row"><p>Row</p></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="g-d-24">
                <div class="g-d-24">
                    <div class="grp-doc-code"><pre><code>{% filter force_escape %}
<div class="grp-module grp-collapse grp-open">
    <h2 class="grp-collapse-handler">Parent Module</h2>
    <div class="grp-module grp-collapse grp-open">
        <h3 class="grp-collapse-handler">Child Module</h3>
        <div class="grp-row"><p>Row</p></div>
        <div class="grp-row"><p>Row</p></div>
    </div>
    <div class="grp-module grp-collapse grp-closed">
        <h3 class="grp-collapse-handler">Child Module</h3>
        <div class="grp-row"><p>Row</p></div>
        <div class="grp-row"><p>Row</p></div>
    </div>
</div>
                    {% endfilter %}</code></pre></div>
                </div>
                <div class="g-d-24">
                    <div class="grp-doc-code"><pre><code>{% filter force_escape %}
(function($) {
    $(document).ready(function() {
        $("#grp-content-container .grp-collapse").grp_collapsible();
    });
})(grp.jQuery);
                    {% endfilter %}</code></pre></div>
                </div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Nesting Modules in Groups</h1>
                    <p>Find out how you may nest modules in stacked &amp; tabular <a href="{% url 'grp_doc_groups' %}">groups</a>.</p>
                </div>
            </div>
        </section>
    </div>
{% endblock %}

