<commit_before>{% extends 'cases/base.html' %}
{%block title%}{{object}} - {{block.super}}{%endblock%}
{%block content%}
<div class="container">
  <div class="row">
    <div class="col-lg-6">
      {% include '_simple_row.html' with title='name' object=object.name only %}
      {% include '_simple_row.html' with title='permissions' object=perm_case only %}
      {% include '_simple_list.html' with title='tags' object_list=object.tags.all only %}
      {% include '_simple_row.html' with title='status' object=object.status only %}
      <p><span class="label label-primary">Tags</span>
      {% for tag in objects.tags.all %}
          <span class="label {{tag.style.code}}">
          <a href="{{tag.get_absolute_url}}">{{tag}}</a>
          <span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
          </span>
          <span class="label label-success"><span class="glyphicon glyphicon-plus"></span></span>
      {% endfor %}

      </p>
      {% include '_simple_row.html' with title='status_changed' object=object.status_changed only %}
      {% include '_simple_row.html' with title='client' object=object.client only %}
      <a class="btn btn-primary" href="{{ object.get_edit_url }}">Edit</a>
      {#<a class="btn btn-warning" href="{% url 'cases:close' %}">Close</a>#}
    </div>
    <div class="col-lg-6">
        <div class="panel panel-default">
          <!-- Default panel contents -->
          <div class="panel-heading">Permissison</div>
          <table class="table table-striped">
            <thead><tr>
              <th>User</th>
              <th>Rank</th>
              {% if perm.user == requests.user and perm_case.permissions.can_delete_own_permission %}
              {% if perm_case.permissions.delete_permission %}
                <th>Delete</th>
              {% endif %}
              {% endif %}
              {% if perm_case.permissions.change_permission %}
                <th>Change</th>
              {% endif %}
            </tr></thead>
            <tbody>
            {%for perm in object.permission_set.all %}
            <tr>
              <td><span class="label {{perm.group.rank}}">{{perm.user}}</span></td>
              <td>{{perm.group.rank}}</td>
              {% if perm_case.permissions.delete_permission %}{% if perm.user == requests.user and perm_case.permissions.can_delete_own_permission %}
                <td><a href="{% url 'permissions:delete' perm.pk %}">Delete</a></td>
              {% endif %}{% endif %}
              {% if perm_case.permissions.change_permission %}
                <td><a href="{% url 'permissions:update' perm.pk %}">Change</a></td>
              {% endif %}
            </tr>
            {% endfor %}
            </tbody>
          </table>
          {% if perm_case.permissions.add_permission %}
          <a class="btn btn-primary" href="{% url 'permissions:create' object.pk %}">Add</a>
          {% endif %}
        </div>
    </div>

  </div>
</div>
<div class="container">
  <div class="row">
    <div class="col-xs-12">
      <h2>Record</h2>
    </div>
  </div>
  <div class="row">
    <div class="col-lg-12">
      <div class="list-group">
        {% if object.record_set.all %}
            {% for record in object.record_set.all %}
                {% include record.get_child_obj.get_template_list with object=record.get_child_obj%}
            {% endfor %}
        {% else %}
            <span class="label label-warning">No records</span>
        {% endif %}
      </div>
    </div>
  </div>
</div>

</div>
{%endblock%}
<commit_msg>CaseDetail: Leave permission table header column even if users can delete own permission<commit_after>{% extends 'cases/base.html' %}
{%block title%}{{object}} - {{block.super}}{%endblock%}
{%block content%}
<div class="container">
  <div class="row">
    <div class="col-lg-6">
      {% include '_simple_row.html' with title='name' object=object.name only %}
      {% include '_simple_row.html' with title='permissions' object=perm_case only %}
      {% include '_simple_list.html' with title='tags' object_list=object.tags.all only %}
      {% include '_simple_row.html' with title='status' object=object.status only %}
      <p><span class="label label-primary">Tags</span>
      {% for tag in objects.tags.all %}
          <span class="label {{tag.style.code}}">
          <a href="{{tag.get_absolute_url}}">{{tag}}</a>
          <span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
          </span>
          <span class="label label-success"><span class="glyphicon glyphicon-plus"></span></span>
      {% endfor %}

      </p>
      {% include '_simple_row.html' with title='status_changed' object=object.status_changed only %}
      {% include '_simple_row.html' with title='client' object=object.client only %}
      <a class="btn btn-primary" href="{{ object.get_edit_url }}">Edit</a>
      {#<a class="btn btn-warning" href="{% url 'cases:close' %}">Close</a>#}
    </div>
    <div class="col-lg-6">
        <div class="panel panel-default">
          <!-- Default panel contents -->
          <div class="panel-heading">Permissison</div>
          <table class="table table-striped">
            <thead><tr>
              <th>User</th>
              <th>Rank</th>
              {% if perm_case.permissions.delete_permission %}
                <th>Delete</th>
              {% endif %}
              {% if perm_case.permissions.change_permission %}
                <th>Change</th>
              {% endif %}
            </tr></thead>
            <tbody>
            {%for perm in object.permission_set.all %}
            <tr>
              <td><span class="label {{perm.group.rank}}">{{perm.user}}</span></td>
              <td>{{perm.group.rank}}</td>
              {% if perm_case.permissions.delete_permission %}
              <td>
              {% if perm.user == requests.user and perm_case.permissions.can_delete_own_permission %}
                <a href="{% url 'permissions:delete' perm.pk %}">Delete</a></td>
              {% else %}
                  Not authorized
              {% endif %}
              </td>
              {% endif %}
              
              {% if perm_case.permissions.change_permission %}
                <td><a href="{% url 'permissions:update' perm.pk %}">Change</a></td>
              {% endif %}
            </tr>
            {% endfor %}
            </tbody>
          </table>
          {% if perm_case.permissions.add_permission %}
          <a class="btn btn-primary" href="{% url 'permissions:create' object.pk %}">Add</a>
          {% endif %}
        </div>
    </div>

  </div>
</div>
<div class="container">
  <div class="row">
    <div class="col-xs-12">
      <h2>Record</h2>
    </div>
  </div>
  <div class="row">
    <div class="col-lg-12">
      <div class="list-group">
        {% if object.record_set.all %}
            {% for record in object.record_set.all %}
                {% include record.get_child_obj.get_template_list with object=record.get_child_obj%}
            {% endfor %}
        {% else %}
            <span class="label label-warning">No records</span>
        {% endif %}
      </div>
    </div>
  </div>
</div>

</div>
{%endblock%}

{'fraction_non_alphanumeric': 0.17513573715717667, 'fraction_numerical': 0.0022274815536683836, 'mean_word_length': 2.146736749890495, 'pattern_counts': {'":': 0, '<': 168, '<?xml version=': 0, '>': 168, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6030592', 'n_tokens_mistral': 2310, 'n_tokens_neox': 2119, 'n_words': 431}