{# Copyright (C) 2006-2021 Edgewall Software

  This software is licensed as described in the file COPYING, which
  you should have received as part of this distribution. The terms
  are also available at https://trac.edgewall.org/wiki/TracLicense.

  This software consists of voluntary contributions made by many
  individuals. For the exact contribution history, see the revision
  history and logs, available at https://trac.edgewall.org/.
#}
# extends 'layout.html'
<!DOCTYPE html>
<html>
  <head>
    <title>
      # block title
      ${_("Prepare Diff")}
      ${ super() }
      # endblock title
    </title>

    # block head
    ${ super() }
    <script>
      jQuery(function($) {
        $("#anydiff input[name$='_path']").autocomplete({
          source: window.location.pathname
        }).each(function() {
          $(this).data("ui-autocomplete")._renderItem = function(ul, item) {
            return $("<li>")
              .data("ui-autocomplete-item", item.value)
              .addClass(function() {
                return item.isdir ? "trac-autocomplete-dir"
                                  : "trac-autocomplete-file";
              })
              .append(item.label)
              .appendTo(ul);
          }
        })
      });
    </script>
    # endblock head
  </head>

  <body>
    # block content
    <div id="content" class="changeset">
      <div id="title">
        <h1>${_("Prepare Diff")}</h1>
      </div>

      <div id="anydiff">
        <form action="${href.changeset()}" method="get">
          <fieldset>
            <legend>
              ${_("Select the base and the target for the diff:")}
            </legend>
            <table>
              <tr>
                <th><label for="old_path">${_("From:")}</label></th>
                <td>
                  <input type="text" id="old_path" name="old_path"
                         value="${old_path}" size="44" />
                  <label>${_("at revision:")}
                    <input type="text" name="old" value="${old_rev}" size="4" />
                  </label>
                </td>
              </tr>
              <tr>
                <th><label for="new_path">${_("To:")}</label></th>
                <td>
                  <input type="text" id="new_path" name="new_path"
                         value="${new_path}" size="44" />
                  <label>${_("at revision:")}
                    <input type="text" name="new" value="${new_rev}" size="4" />
                  </label>
                </td>
              </tr>
            </table>
            <p class="hint">
              # trans

              For either path, you can start typing the path and will
              be presented a list of existing directories and files to
              select from. Select an entry by clicking on it, or by
              using the up/down cursor keys and hitting tab.

              # endtrans
            </p>
          </fieldset>
          <div class="buttons">
            <input type="submit" value="${_('View changes')}" />
          </div>
        </form>
      </div>

      # call(note, page) jmacros.wikihelp('TracChangeset', '#ExaminingDifferencesBetweenBranches'):
      #   trans note, page

      ${note} See ${page} for help on using the diff feature.

      #   endtrans
      # endcall
    </div>
    ${ super() }
    # endblock content
  </body>
</html>
