= form_tag request.fullpath, :method => :get, :remote => true, :class => 'messageSearch', :enforce_utf8 => false do
  %p
    = link_to "Need help with filtering?", '#', :class => 'messageSearch__help js-toggle-helpbox'
    = text_field_tag 'query', @query, :class => 'messageSearch__input js-focus-on-f js-form-submit', :placeholder => "Filter messages...", :data => {:disable_with => 'Searching...'}

  .messageSearch__helpBox.is-hidden.js-helpbox
    .messageSearch__left
      %h3.messageSearch__helpBoxTitle
        Filtering your messages
      %p.messageSearch__helpBoxText
        You can filter your messages on a number of attributes. At present, it is not possible to
        search the content of your messages. To filter though, you can insert any of the strings
        as shown opposite into the box above and press enter.
    .messageSearch__right
      %dl.messageSearch__definition
        %dt to: rachel@example.com
        %dd Returns all mail addressed to the address provided.
      %dl.messageSearch__definition
        %dt from: tom@example.com
        %dd Returns all mail sent from to the address provided.
      %dl.messageSearch__definition
        %dt status: pending
        %dd Returns all messages with the status provided. The suitable statuses are: <code>pending</code>, <code>sent</code>, <code>held</code>, <code>softfail</code>, <code>hardfail</code> and <code>bounced</code>.
      %dl.messageSearch__definition
        %dt before: yyyy-mm-dd hh:mm
        %dd Returns any message received before the given timestamp.
      %dl.messageSearch__definition
        %dt after: yyyy-mm-dd hh:mm
        %dd Returns any message received after the given timestamp.
      %dl.messageSearch__definition
        %dt msgid:  57f3a85b35545@server01.mail
        %dd Returns any message with the given Message-ID header.
      %dl.messageSearch__definition
        %dt tag: password-reset
        %dd Returns any message tagged with the tag provided.
      %dl.messageSearch__definition
        %dt spam: yes
        %dd By default, spam is not shown in results. To show spam instead of non-spam, just add this to the query.
      %dl.messageSearch__definition
        %dt order: oldest-first
        %dd By default, newest messages are shown first. To show oldest messages first, you can add this.
