{% extends "linkcheck/base_linkcheck.html" %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript">
    function clean() {
        tables = $('table.links');
        tables.each(function(i) {
            $(this).parent().show();
            if ($(this).find('tr:visible').size()==0) {
                $(this).parent().hide();
            }
        })
    }

    $(document).ready(function() {
        filter();
        $(".filters").change(function(){
            filter();
        });
    });

</script>

<style type="text/css">
    #changelist table tbody td:first-child {
        text-align: left!important;
    }
</style>
{% endblock %}
{% block innercontent %}
<div style='width: 100%; margin-left: auto; margin-right: auto; text-align: center;'>
<form action="." method="get"><strong>Show: </strong>
    <label>Good links</label>: <input type="radio" class="filters" name="filters" value="show_valid" onclick="form.submit()" {% ifequal filter 'show_valid' %}checked="CHECKED"{% endifequal %}>&nbsp;&nbsp;
    <label>Broken links</label>: <input type="radio" class="filters" name="filters" value="show_invalid" onclick="form.submit()" {% ifequal filter 'show_invalid' %}checked="CHECKED"{% endifequal %}>&nbsp;&nbsp;
    <label>Untested links</label>: <input type="radio" class="filters" name="filters" value="show_unchecked" onclick="form.submit()" {% ifequal filter 'show_unchecked' %}checked="CHECKED"{% endifequal %}>&nbsp;&nbsp;
</form>

</div>

    {% for content_type in content_types_list %}
        <table id="links" style='width: 80%!important; background-color: white; margin-left: 20px;'>
            <tr class="type-header"><td style='padding: 0;'><h2>{{content_type.content_type.name|title}} Objects</h2>
                {% for object in content_type.object_list %}
                    <div style='margin: 0; padding: 35px 0 0 0;'>
                        <h3 style='display: inline; padding-left: 5px;'>{{report_type}} in '{{object.object}}'</h3>&nbsp;&nbsp;
                        <a href='{{object.object.get_absolute_url}}' style="text-decoration: underline;">view {{content_type.content_type.name}}</a>&nbsp;&nbsp;
                        <a href='{{object.admin_url}}' style="text-decoration: underline;">edit {{content_type.content_type.name}}</a>
                        <table class="links" style='width: 100%!important; margin-top: 10px; border: 1px solid #eee;'>
                            <th style='width: 40%;'>Destination</th>
                            <th style='width: 20%;'>Linked Text</th>
                            <th style='width: 20%;'>Field to Edit</th>
                            <th style='width: 20%;'>Status</th>
                            {% for link in object.link_list %}
                                <tr>
                                    <td style='width: 40%;'><a href='{{link.url}}' target='_blank'>{{link.url}}</a></td>
                                    <td style='width: 20%;'>{% if link.text = "empty" %}none{% else %}"{{link.text}}"{% endif %}</td>
                                    <td style='width: 20%;'>{{link.field}}</td>
                                    <td style='width: 20%; font-weight: bold; color: {{link.url.colour}};'>{{link.url.get_message}}</td>
                                </tr>
                            {% endfor %}
                        </table>
                    </div>
                {% endfor %}
            </td></tr>
        </table>
        <p>&nbsp;</p>
    {% endfor %}
    {% if content_types_list %}
        {% include "linkcheck/paginator.xhtml" %}
    {% endif %}
{% endblock %}