{# vim: set ts=2 et sts=2 sw=2: #}
{% macro search_box(settings, id=False, prefix=None, target=None,
                    placeholder=None) %}
  {% if placeholder is none %}
    {% set placeholder = _('Search Firefox Help') %}
  {% endif %}
  <div class="support-search"{% if id %} id="{{ id }}"{% endif %} role="search">
    {% if prefix %}
      {{ prefix }}
    {% endif %}
    <form action="{{ url('search') }}" method="get" {% if target %} target="{{ target }}"{% endif %}>
      <input type="text" class="text" name="q" placeholder="{{ placeholder }}" required="required" />
      <button type="submit" class="img-submit" title="{{ _('Search') }}">
        <img src="{{ settings.MEDIA_URL }}img/btn.search.png" alt="{{ _('Search') }}" />
      </button>
    </form>
  </div>
{% endmacro %}

{% macro greeting(user, settings) %}
  <div id="greeting">
    {% if user.is_authenticated() %}
      {{ _('Welcome, <span class="user">{user}</span>.')|fe(user=user) }}
      <nav>
        <a href="{{ profile_url(user) }}">{{ _('Profile') }}</a>
        |
        <a href="{{ url('users.logout') }}">{{ _('Sign Out') }}</a>
      </nav>
    {% else %}
      <p>
        {% trans login_url=url('users.login'), register_url=url('users.register') %}
          Want to contribute?<br /> <a href="{{ login_url }}">Sign In</a> or <a href="{{ register_url }}">Register</a>
        {% endtrans %}
      </p>
    {% endif %}
  </div>
{% endmacro %}

{% macro content_editor(field) %}
  {#
  <div class="editor{% if field.errors %} invalid{% endif %}" data-media-search-url="{{ url('gallery.async') }}" data-media-gallery-url="{{ url('gallery.home') }}">
  #}
  <div class="editor{% if field.errors %} invalid{% endif %}">
    <div class="editor-tools"></div>
    {{ field|safe }}
  </div>
{% endmacro %}
