<div class="row row-alerts d-edit-none">
  <div class="col-sm-12">
    {% if page && page.grant && page.grant > 1 %}

      <p class="alert alert-primary py-3 px-4">
      {% if page.grant == 2 %}
        <i class="icon-fw icon-link"></i><strong>{{ t('Anyone with the link') }}</strong> ({{ t('Browsing of this page is restricted') }})
      {% elseif page.grant == 4 %}
        <i class="icon-fw icon-lock"></i><strong>{{ t('Only me') }}</strong> ({{ t('Browsing of this page is restricted') }})
      {% elseif page.grant == 5 %}
        <i class="icon-fw icon-organization"></i><strong>'{{ page.grantedGroup.name | preventXss }}' only</strong> ({{ t('Browsing of this page is restricted') }})
      {% endif %}
      </p>
    {% endif %}

    {% if getConfig('crowi', 'customize:isEnabledStaleNotification') %}
      {% if page && page.updatedAt && page.getContentAge() > 0 %}
        {% if page.getContentAge() == 1 %}
        <div class="alert alert-info">
        {% elseif page.getContentAge() == 2 %}
        <div class="alert alert-warning">
        {% else %}
        <div class="alert alert-danger">
        {% endif %}
          <i class="icon-fw icon-hourglass"></i>
          <strong>{{ t('page_page.notice.stale', { count: page.getContentAge() }) }}</strong>
        </div>
      {% endif %}
    {% endif %}

    {% if redirectFrom or req.query.redirectFrom %}
    <div class="alert alert-pink d-edit-none py-3 px-4 d-flex align-items-center justify-content-between">
      <span>
        {% set fromPath = req.query.redirectFrom %}
        {% if redirectFrom or req.query.redirectFrom %}
        <div id="redirected-alert"></div>
        {% endif %}
      </span>
      {% set hasRedirectLink = redirectFrom or req.query.redirectFrom or req.query.withRedirect %}
      {% if user and not page.isDeleted() and hasRedirectLink %}
        <button type="button" id="unlink-page-button" class="btn btn-outline-dark btn-sm float-right">
          <i class="ti-unlink" aria-hidden="true"></i>
          Unlink redirection
        </button>
      {% endif %}
    </div>
    {% endif %}

    {% if req.query.unlinked %}
    <div class="alert alert-info d-edit-none py-3 px-4">
      <strong>{{ t('Unlinked') }}: </strong> {{ t('page_page.notice.unlinked') }}
    </div>
    {% endif %}

    {% if page and not page.isLatestRevision() %}
    <div class="alert alert-warning">
      <strong>{{ t('Warning') }}: </strong> {{ t('page_page.notice.version') }}
      <a href="{{ encodeURI(page.path) }}"><i class="icon-fw icon-arrow-right-circle"></i>{{ t('Show latest') }}</a>
    </div>
    {% endif %}

    {% set dmessage = req.flash('dangerMessage') %}
    {% if dmessage.length %}
    <div class="alert alert-danger mb-4">
      {{ dmessage }}
    </div>
    {% endif %}

    {% if isTrashPage(page.path) %}
      <div id="trash-page-alert"></div>
    {% endif %}

    <div id="fix-page-grant-alert"></div>
  </div>
</div>
