{% load i18n %}
{% load comments %}
{% load extra_filters %}
<td id="id_case_text_{{ forloop.counter }}" colspan="12">
	<table class="case_detail">
		<tr>
			<td valign="top" colspan='2'>
                            <h4>{% trans "Text" %}:</h4>
				<div class="content">{{ test_case.text|markdown2html }}</div>
			</td>
			<td valign="top" rowspan="2" width="200">
                            <h4><span class="title strong">{% trans "Attachment" %}:</span></h4>
				<ul class="ul-no-format">
					{% for attachment_file in attachments %}
					<li>
						<a href="{% url "mgmt-check_file" attachment_file.attachment_id %}">
							{{ attachment_file.file_name }}
						</a>
					</li>
					{% empty %}
                                        <li class="grey">{% trans "No attachment found" %}</li>
					{% endfor %}
				</ul>
                                <h4><span class="title strong">{% trans "Component" %}:</span></h4>
				<ul class="ul-no-format">
					{% for component in components %}
					<li id="display_component" >{{ component.name }}</li>
					{% empty %}
                                        <li class="grey">{% trans "No component found" %}</li>
					{% endfor %}
				</ul>
                                <h4><span class="title strong">{% trans "Tag" %}:</span></h4>
				<ul class="ul-no-format">
					{% for tag in tags %}
					<li>{{ tag }}</li>
					{% empty %}
                                        <li class="grey">{% trans "No tag found" %}</li>
					{% endfor %}
				</ul>
                                <h4><span class="title strong">{% trans "bug" %}:</span></h4>
				<ul class="ul-no-format">
					{% for bug in test_case.get_bugs %}
					<li>
						<a href="{{ bug.get_full_url }}">{{ bug }}</a>
						{% if bug.case_run_id %}
                                                <span class="grey"> - {% trans "From Run" %}</span>
						<a href="{% url "testruns-get" bug.case_run.run_id %}">{{ bug.case_run.run_id }}</a>
						{% endif %}
					</li>
					{% empty %}
                                        <li class="grey">{% trans "No bug found" %}</li>
					{% endfor %}
				</ul>
			</td>
		</tr>
		<tr>
			<td colspan='3'>
                            <h4>{% trans "Notes" %}:</h4>
				<div class="content">{{ test_case.notes|urlize|linebreaksbr }}</div>
			</td>
		</tr>
		<tr>
			<td colspan="3" style="border:none; background:none">
                            <h4>{% trans "Comments" %}:</h4>
				<ul class="comment ul-no-format">
				{% for comment in case_comments %}
					<li>
						<span class="strong">#{{ forloop.counter }}</span>
						<span class="strong">
                                                    <a href="{% url "tcms-profile" comment.user.username %}">
                                                       {{ comment.user.username }}
                                                    </a>
                                                </span>
						<span class="grey">{{ comment.submit_date }}</span>
						<br/>
						{{ comment.comment|urlize|linebreaksbr }}

						{% if review_mode and comment.user.pk == user.pk %}
						<form action="{% url "comments-delete" %}" method="post" class="form_comment">
							<input type="hidden" name="comment_id" value="{{ comment.pk }}" />
							<input type="hidden" name="object_pk" value="{{ test_case.pk }}" />
							<input class='commentdelete sprites' value='Delete Comment' type='submit' /> 
						</form>
						{% endif %}
					</li>
				{% endfor %}
				<ul>
			</td>
		</tr>
                {% if review_mode %}
		<tr>
			<td colspan="3" style='border:none;background:transparent'>
				<form class="update_form" method="POST">
					{% get_comment_form for test_case as comment_form %}
					{{ comment_form.comment }}
					{{ comment_form.content_type }}
					{{ comment_form.object_pk }}
					{{ comment_form.timestamp }}
					{{ comment_form.security_hash }}
					<br/>
					<input type="submit" class="submit-post margin-top" value='Add Comment'>
				</form>
			</td>
		</tr>
                {% endif %}
	</table>
</td>
