<div xmlns:py="http://genshi.edgewall.org/"
     class="tagging_tags_block ${w.css_class}"
     id="${w.compound_id}">
    <ul class="tagging_tags">
        <li py:for="tag in w.value['tag_list']">
            <a py:if="w.editmode" class="tagging_tag_delete" href="#"
               onclick="return tagging_delete_tag(this, '${w.tagging_url}', '${w.value['target_id']}', '${tag[0]}');">
                &nbsp;
            </a>

            <a class="tagging_tag" title="${tag[0]}"
               href="${w.tg_url('%s/search' % w.tagging_url, params=dict(tags=tag[0]))}">
                ${Markup(tag[0])}
            </a>
        </li>
    </ul>

    <a py:if="w.editmode" class="tagging_add_tag_button" href="#"
       onclick="jQuery(this).parent().find('.tagging_add_tag_form').slideToggle(); return false;">
        Add a Tag
    </a>
    <div class="tagging_add_tag_form" style="display:none">
        <form onsubmit="return tagging_add_tag(this, '${w.tagging_url}', '${w.value['target_id']}');" method="post">
            <input type="hidden" value="${w.value['target_id']}" name="target_id" />
            <input type="text" name="tags" />
            <input type="submit" value="Add" />
            <input type="reset" Value="Cancel" />
        </form>
    </div>
</div>