<header class="page-header">
  <div class="page-title">
    <span class="h3">{{t 'changelog'}}</span>
  </div>
</header>

<form class="spacer-bottom" id="quality-profile-changelog-form">
  {{t 'quality_profiles.changelog_from'}}
  <input name="since" type="text" value="{{eventsParameters.since}}" placeholder="1970-01-31">
  {{t 'to'}}
  <input name="to" type="text" value="{{eventsParameters.to}}" placeholder="1970-01-31">
  <button id="quality-profile-changelog-form-submit">{{t 'search_verb'}}</button>
</form>

{{#notEmpty events}}
  <table class="width-100 data zebra">
    <thead>
    <tr>
      <th>{{t 'date'}}</th>
      <th>{{t 'user'}}</th>
      <th>{{t 'action'}}</th>
      <th>{{t 'rule'}}</th>
      <th>{{t 'parameters'}}</th>
    </tr>
    </thead>
    <tbody>
    {{#each events}}
      <tr>
        <td class="text-top nowrap thin">{{dt date}}</td>
        <td class="text-top nowrap thin">{{default authorName 'System'}}</td>
        <td class="text-top nowrap">{{t 'quality_profiles.changelog' action}}</td>
        <td class="text-top"><a href="{{rulePermalink ruleKey}}">{{ruleName}}</a></td>
        <td class="text-top thin">
          <ul>
            {{#each params}}
              <li>
                {{#eq @key 'severity'}}
                  <span class="nowrap">{{severityChangelog this}}</span>
                {{else}}
                  {{parameterChangelog @key this}}
                {{/eq}}
              </li>
            {{/each}}
          </ul>
        </td>
      </tr>
    {{/each}}
    </tbody>
  </table>


  <p class="spacer-top text-center">
    {{#unlessLength events totalEvents}}
      <a class="js-show-more-changelog spacer-right" href="#">{{t 'show_more'}}</a>
    {{/unlessLength}}
    <a class="js-hide-changelog" href="#">{{t 'hide'}}</a>
  </p>

{{else}}
  {{#notNull totalEvents}}
    <div class="alert alert-info">{{t 'quality_profiles.changelog.empty'}}</div>
  {{/notNull}}
{{/notEmpty}}
