<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <head>
    <title>Code Comments</title>
  </head>

  <body>
    <div id="content">
        <h1>Code Comments</h1>
        <button id="send-to-ticket" type="submit" data-url="${href('code-comments', 'create-ticket')}">Create ticket with selected</button>
        &nbsp;Filter comments:
        <form action="${href('code-comments')}" method="GET" style="display: inline;">
            <select id="filter-by-path" name="filter-by-path">
                <option value='' selected="selected">-- All paths --</option>
                <option py:for="path in paths"
                           selected="${current_path_selection == path+'/' or None}"
                           value="$path/" py:content="path"></option>
            </select>
            <select id="filter-by-author" name="filter-by-author">
                <option value='' selected="selected">-- All authors --</option>
                <option py:for="author in authors"
                           selected="${current_author_selection == author or None}"
                           value="$author" py:content="author"></option>
            </select>
            <input type="hidden" name="orderby" value="$current_sorting_method" />
            <input type="hidden" name="order" value="$current_order" />
            <button id="filter" type="submit">Filter comments</button>
        </form>
        <table class="listing code-comments">
            <thead>
                <tr class="tarc-columns">
                    <th class="check"><input type="checkbox" /></th>
                    <py:for each="header in sortable_headers">
                        <th class="$header.html_class"><a href="$header.link">$header.name</a></th>
                    </py:for>
                    <th>Tickets</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
            <py:for each="idx, comment in enumerate(comments)">
                <tr class="${idx % 2 and 'odd' or 'even'}">
                    <td class="check"><input type="checkbox" id="checked-$comment.id" /></td>
                    <td>$comment.id</td>
                    <th>$comment.author</th>
                    <th>${comment.formatted_date()}</th>
                    <td>${comment.path_link_tag()}</td>
                    <td>$comment.html</td>
                    <td>${comment.get_ticket_links()}</td>
                    <td>
                        <form py:if="can_delete" action="${href('code-comments', 'delete')}" method="GET">
                            <input type="hidden" name="id" value="$comment.id" />
                            <input type="submit" name="delete" value="Delete" />
                        </form>
                    </td>
                </tr>
            </py:for>
            </tbody>
        </table>
		<xi:include href="page_index.html" />
    </div>
  </body>
</html>
