<commit_before>{# vim: set ts=2 et sts=2 sw=2: #}
{#

Base template for creating a new or editing an existing question. The cases for
showing uneditable product and category names are handled here. Fancier
behaviors like editing them can be provided by overriding blocks.

If there's a `form`, we also expect `current_product` and `current_category` so
we can compute the edit-title URL.

#}
{% extends "questions/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% set classes = 'new-question' %}

{% block content %}
<div id="ask-question">
<h1>{% block headline %}Do Something to a Question{% endblock %}</h1>
<div class="inner-wrap">

  {% block product %}
    {% if current_product %}
      <div class="selected">
        <label>{{ _('Firefox Product') }}:</label>
        <span>{{ current_product.name }}</span>
        {% block product_changer %}
        {% endblock %}
      </div>
    {% endif %}
  {% endblock %}

  {% block category %}
    {% if current_product and current_category %}
      <div class="selected">
        <label>Category:</label>
        <span>{{ current_category.name }}</span>
        {% block category_changer %}
        {% endblock %}
      </div>
    {% endif %}
  {% endblock %}

  {% block articles_and_search_results %}
  {% endblock %}

  {% if form %}
    <form id="question-form" action="" method="post">
      {{ csrf() }}
      {% block major_detail_instructions %}
        <h2>Do some stuff.</h2>
      {% endblock %}
      <h3>{{ _('The more information you can provide, the better the chance your question will be answered.') }}</h3>
      {{ errorlist(form) }}
      {% for field in form.hidden_fields() %}
        {{ field|safe }}
      {% endfor %}
      <ol>
        {% set li_class='' %}
        {% for field in form.visible_fields() %}

          {% if field.name == 'ff_version' %}
            <li class="system-details-info show">
              <p>
                {{ _("We've made some educated guesses about your current browser and operating system.") }}
                <a href="#show-details" class="show">{{ _('Show details &raquo;')|safe }}</a>
                <a href="#hide-details" class="hide">{{ _('Hide details &raquo;')|safe }}</a>
              </p>
            </li>
            {% set li_class='details' %}
          {% endif %}

          <li class="{{ li_class }} {% if field.errors %}invalid{% endif %}">
            {{ field.label_tag()|safe }}

            {% if field.name == 'title' and not request.GET.edit_title %}
              <div id="title-val">
                <span title="{{ _('Click to change your question') }}">{{ form.initial.title }}</span>
                <a href="{{ ''|urlparams(product=current_product.key, category=current_category.key, showform=1, search=request.GET.search, edit_title=1) }}#question-form">edit</a>
                {{ field.as_hidden()|safe }}
              </div>
            {% elif field.name == 'content' %}
              <div class="forum-editor">
                <div class="forum-editor-tools"></div>
                {{ field|safe }}
              </div>
            {% else %}
              {{ field|safe }}
            {% endif %}
<commit_msg>Fix for disappearing question title after form validation errors (bug 581230)<commit_after>{# vim: set ts=2 et sts=2 sw=2: #}
{#

Base template for creating a new or editing an existing question. The cases for
showing uneditable product and category names are handled here. Fancier
behaviors like editing them can be provided by overriding blocks.

If there's a `form`, we also expect `current_product` and `current_category` so
we can compute the edit-title URL.

#}
{% extends "questions/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% set classes = 'new-question' %}

{% block content %}
<div id="ask-question">
<h1>{% block headline %}Do Something to a Question{% endblock %}</h1>
<div class="inner-wrap">

  {% block product %}
    {% if current_product %}
      <div class="selected">
        <label>{{ _('Firefox Product') }}:</label>
        <span>{{ current_product.name }}</span>
        {% block product_changer %}
        {% endblock %}
      </div>
    {% endif %}
  {% endblock %}

  {% block category %}
    {% if current_product and current_category %}
      <div class="selected">
        <label>Category:</label>
        <span>{{ current_category.name }}</span>
        {% block category_changer %}
        {% endblock %}
      </div>
    {% endif %}
  {% endblock %}

  {% block articles_and_search_results %}
  {% endblock %}

  {% if form %}
    <form id="question-form" action="" method="post">
      {{ csrf() }}
      {% block major_detail_instructions %}
        <h2>Do some stuff.</h2>
      {% endblock %}
      <h3>{{ _('The more information you can provide, the better the chance your question will be answered.') }}</h3>
      {{ errorlist(form) }}
      {% for field in form.hidden_fields() %}
        {{ field|safe }}
      {% endfor %}
      <ol>
        {% set li_class='' %}
        {% for field in form.visible_fields() %}

          {% if field.name == 'ff_version' %}
            <li class="system-details-info show">
              <p>
                {{ _("We've made some educated guesses about your current browser and operating system.") }}
                <a href="#show-details" class="show">{{ _('Show details &raquo;')|safe }}</a>
                <a href="#hide-details" class="hide">{{ _('Hide details &raquo;')|safe }}</a>
              </p>
            </li>
            {% set li_class='details' %}
          {% endif %}

          <li class="{{ li_class }} {% if field.errors %}invalid{% endif %}">
            {{ field.label_tag()|safe }}

            {% if field.name == 'title' and not request.GET.edit_title %}
              <div id="title-val">
                <span title="{{ _('Click to change your question') }}">
                  {% if form.initial %}{{ form.initial.title }}{% else %}{{ form.title.data }}{% endif %}
                </span>
                <a href="{{ ''|urlparams(product=current_product.key, category=current_category.key, showform=1, search=request.GET.search, edit_title=1) }}#question-form">edit</a>
                {{ field.as_hidden()|safe }}
              </div>
            {% elif field.name == 'content' %}
              <div class="forum-editor">
                <div class="forum-editor-tools"></div>
                {{ field|safe }}
              </div>
            {% else %}
              {{ field|safe }}
            {% endif %}

{'fraction_non_alphanumeric': 0.16556899984683718, 'fraction_numerical': 0.004288558737938429, 'mean_word_length': 2.269904857285929, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 85, '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': '2654808', 'n_tokens_mistral': 2062, 'n_tokens_neox': 1842, 'n_words': 519}