<commit_before>{% load i18n %}
{% load markup %}
{% load foirequest_tags %}

<div class="message-guidance-sticky">
  {% for guidance in message.guidances %}
    <div class="card mb-2">
      <div class="card-body">
        <h5 class="card-title" {% if request.user.is_staff %}title="{{ guidance.rule.name }}"{% endif %}>
          {{ guidance.get_label }}
        </h5>
        <div class="card-text">
          {{ guidance.get_description | markdown }}
        </div>
      {% if guidance.get_snippet and foirequest|can_write_foirequest:request %}
        <h6>{% trans "Suggested reply" %}</h6>
        <blockquote class="card-text small bg-light pl-2">
          <p>
          {{ guidance.get_snippet }}
          </p>
        </blockquote>
        <a data-tabgo="tab" data-name="sendmessage-to"
           data-value="{{ message.sender_email }}"
           data-addtextfield="#id_sendmessage-message"
           data-addtext="{{ guidance.get_snippet }}"
           href="#write-message" class="btn btn-sm btn-secondary">
          <span class="fa fa-reply"></span>
          {% trans "Add to reply" %}
        </a>
      {% endif %}
      </div>
    </div>
  {% endfor %}

  {% if request.user.is_staff %}
    <form action="{% url 'guide-rerun_rules' message_id=message.id %}" method="post" class="text-right mt-1">
      {% csrf_token %}
      <a href="{% url 'admin:guide_guidance_changelist' %}?message={{ message.id }}" class="btn btn-sm btn-light" target="_blank">
        {% trans "In admin" %}
      </a>
      <a href="{% url 'admin:guide_guidance_add' %}?prefill_message={{ message.id }}" class="btn btn-sm btn-light" target="_blank">
        {% trans "Add custom" %}<commit_msg>Hide full snippet on guidance when too long<commit_after>{% load i18n %}
{% load markup %}
{% load foirequest_tags %}

<div class="message-guidance-sticky">
  {% for guidance in message.guidances %}
    <div class="card mb-2">
      <div class="card-body">
        <h5 class="card-title" {% if request.user.is_staff %}title="{{ guidance.rule.name }}"{% endif %}>
          {{ guidance.get_label }}
        </h5>
        <div class="card-text">
          {{ guidance.get_description | markdown }}
        </div>
      {% if guidance.has_snippet and foirequest|can_write_foirequest:request %}
        {% with snippet=guidance.get_snippet %}
          {% if snippet|length < 250 %}
          <h6>{% trans "Suggested reply" %}</h6>
          <blockquote class="card-text small bg-light pl-2">
            <p>
            {{ snippet|linebreaksbr }}
            </p>
          </blockquote>
          {% endif %}
          <a data-tabgo="tab" data-name="sendmessage-to"
            data-addtextfield="#id_sendmessage-message"
            data-value="{% if message.is_response %}{{ message.sender_email }}{% else %}{{ message.recipient_email }}{% endif %}"
            data-addtext="{{ snippet }}"
            href="#write-message" class="btn btn-sm btn-secondary">
            <span class="fa fa-reply"></span>
            {% if snippet|length < 250 %}
              {% trans "Add to reply" %}
            {% else %}
              {% trans "Prepare message" %}
            {% endif %}
          </a>
        {% endwith %}
      {% endif %}
      </div>
    </div>
  {% endfor %}

  {% if request.user.is_staff %}
    <form action="{% url 'guide-rerun_rules' message_id=message.id %}" method="post" class="text-right mt-1">
      {% csrf_token %}
      <a href="{% url 'admin:guide_guidance_changelist' %}?message={{ message.id }}" class="btn btn-sm btn-light" target="_blank">
        {% trans "In admin" %}
      </a>
      <a href="{% url 'admin:guide_guidance_add' %}?prefill_message={{ message.id }}" class="btn btn-sm btn-light" target="_blank">
        {% trans "Add custom" %}
{'fraction_non_alphanumeric': 0.17648619957537154, 'fraction_numerical': 0.006369426751592357, 'mean_word_length': 2.4046973803071365, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 49, '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': '1203186', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1170, 'n_words': 251}