{% extends "admin/base_site.html" %}
{% load i18n %}
{% block bodyclass %}grp-doc{% endblock %}
{% block content-class %}{% endblock %}
{% block title %}Grappelli Documentation &raquo; Object-Tools{% 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>Object-Tools</li>
    </ul>
{% endblock %}

{% block content %}
    <h1>Object-Tools</h1>
    <div class="g-d-c">
        <div class="g-d-24">
            <div class="grp-doc-description">
                <p>The object-tools define actions which apply directly to an object.</p>
            </div>
        </div>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Location</h1>
                    <p>They appear on the right-hand side within <span class="grp-doc-class">#grp-content-title</span> and are currently used with changelists and changeforms.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <p class="h1 grp-font-color-quiet">Title of your object</p>
                    <ul class="grp-object-tools">
                        <li><a href="">Object-Tools</a></li>
                    </ul>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code"><pre><code>{% filter force_escape %}
<header id="grp-content-title">
    <h1>Title of your object</h1>
    {% templatetag openblock %} block object-tools {% templatetag closeblock %}{% templatetag openblock %} endblock {% templatetag closeblock %}
</header>
{% endfilter %}</code></pre></div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Basics</h1>
                    <p>The object-tools are defined in a block <span class="grp-doc-django">{% templatetag openblock %} block object-tools {% templatetag closeblock %}</span>. They are always written as a <span class="grp-doc-dom"><span>ul.grp-object-tools</span></span> wrapping another block <span class="grp-doc-django">{% templatetag openblock %} block object-tools-items {% templatetag closeblock %}</span> which contains <span class="grp-doc-dom"><span>li</span></span> and <span class="grp-doc-dom"><span>a</span></span> elements defining the options.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <p class="h1 grp-font-color-quiet">Title of your object</p>
                    <ul class="grp-object-tools">
                        <li><a href="">Object-Tools Item</a></li>
                        <li><a href="">Object-Tools Item</a></li>
                    </ul>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code"><pre><code>{% filter force_escape %}
{% templatetag openblock %} block object-tools {% templatetag closeblock %}
    <ul class="grp-object-tools">
        {% templatetag openblock %} block object-tools-items {% templatetag closeblock %}
            <li><a href="">Object-Tools Item</a></li>
            <li><a href="">Object-Tools Item</a></li>
        {% templatetag openblock %} endblock {% templatetag closeblock %}
    </ul>
{% templatetag openblock %} endblock {% templatetag closeblock %}
{% endfilter %}</code></pre></div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Item Types</h1>
                    <p>There are different types of items which, defined by additional classes for the <span class="grp-doc-dom"><span>a</span></span> element. The default item is not further specified. The item for adding something (usually used on changelists) gets the class <span class="grp-doc-class">.grp-add-link</span>. The item for viewing something outside the admin (usually used on changeforms) gets the class <span class="grp-doc-class">.grp-viewsite-link</span>, but stylewise it's recognized by its attribute <span class="grp-doc-class">target="_blank"</span>. All links with such a target are handled as external links.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <p class="h1 grp-font-color-quiet">Title of your object</p>
                    <ul class="grp-object-tools">
                        <li><a href="#">History</a></li>
                        <li><a href="#" class="grp-add-link">Add something</a></li>
                        <li><a href="#" class="grp-viewsite-link">View on site (class)</a></li>
                        <li><a href="#" target="_blank">View on site (target)</a></li>
                    </ul>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code"><pre><code>{% filter force_escape %}
{% templatetag openblock %} block object-tools {% templatetag closeblock %}
    <ul class="grp-object-tools">
        {% templatetag openblock %} block object-tools-items {% templatetag closeblock %}
            <li><a href="#">History</a></li>
            <li><a href="#" class="grp-add-link">Add something</a></li>
            <li><a href="#" class="grp-viewsite-link">View on site</a></li>
            <li><a href="#" target="_blank">View on site</a></li>
        {% templatetag openblock %} endblock {% templatetag closeblock %}
    </ul>
{% templatetag openblock %} endblock {% templatetag closeblock %}
{% endfilter %}</code></pre></div>
            </div>
        </section>
        <section>
            <div class="g-d-24">
                <div class="grp-doc-description">
                    <h1>Item States</h1>
                    <p>By default the items visually appear in a reduced state. Add <span class="grp-doc-class">.grp-state-focus</span> to elements you want to emphasize.</p>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code-source">
                    <p class="h1 grp-font-color-quiet">Title of your object</p>
                    <ul class="grp-object-tools">
                        <li><a href="#">Item</a></li>
                        <li><a href="#" class="grp-add-link grp-state-focus">Focused Item</a></li>
                    </ul>
                </div>
            </div>
            <div class="g-d-24">
                <div class="grp-doc-code"><pre><code>{% filter force_escape %}
{% templatetag openblock %} block object-tools {% templatetag closeblock %}
    <ul class="grp-object-tools">
        {% templatetag openblock %} block object-tools-items {% templatetag closeblock %}
            <li><a href="#">Item</a></li>
            <li><a href="#" class="grp-add-link grp-state-focus">Focused Item</a></li>
        {% templatetag openblock %} endblock {% templatetag closeblock %}
    </ul>
{% templatetag openblock %} endblock {% templatetag closeblock %}
{% endfilter %}</code></pre></div>
            </div>
        </section>
    </div>
{% endblock %}