<div id="bootstrap-theme">
  <div crm-ui-debug="$ctrl"></div>
  <span crm-ui-order="{var: 'wfOrder', defaults: ['msg_title','!_is_primary','tx_language_label']}"></span>

  <div ng-include="'~/crmMsgadm/ListNav.html'"></div>

  <div class="form-inline">
    <label for="msgtpl-filter-text">{{:: ts('Filter') }}</label>
    <input class="form-control" type="search" id="msgtpl-filter-text" ng-model="filters.text">
  </div>

  <table class="table table-striped">
    <thead>
    <tr>
      <th><a crm-ui-order-by="[wfOrder, 'msg_title']">{{:: ts('Title') }}</a></th>
      <th><a crm-ui-order-by="[wfOrder, 'tx_language_label']">{{:: ts('Locale') }}</a></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
    </thead>
    <tbody>
    <tr ng-repeat="record in $ctrl.records | filter:filters.text | filter:{_is_visible: true} | orderBy:wfOrder.get()">
      <td>{{record.msg_title}}</td>
      <td  class="text-right">
        <a ng-show="record.master_id" class="btn btn-xs btn-default" ng-click="$ctrl.revert(record)">{{:: ts('Revert') }}</a>
      </td>
      <td>{{record.tx_language_label || ts('Standard')}}</td>
      <td>
        <span ng-if="!record.tx_language || !!record.tx_statuses.active">
          <a class="text-success" crm-icon="fa-file-text" title="{{ts('Edit current revision, &quot;%1&quot;, &quot;%2&quot;', {1: record.msg_title, 2: record.tx_language_label || ts('Standard')})}}" ng-href="{{$ctrl.editUrl(record)}}">{{:: ts('Current') }}</a>
        </span>
        <span ng-if="!(!record.tx_language || !!record.tx_statuses.active)">
          <span class="text-danger" crm-icon="fa-file-text" title="{{ts('No current revision, &quot;%1&quot;, &quot;%2&quot;', {1: record.msg_title, 2: record.tx_language_label || ts('Standard')})}}">{{:: ts('Current') }}</span>
        </span>
      </td>
      <td>
        <span ng-if="!!record.tx_statuses.draft">
          <a class="text-warning" crm-icon="fa-file-text-o" title="{{ts('Edit draft revision, &quot;%1&quot;, &quot;%2&quot;', {1: record.msg_title, 2: record.tx_language_label || ts('Standard')})}}" ng-href="{{$ctrl.editUrl(record, 'draft')}}">{{:: ts('Draft') }}</a>
        </span>
        <span ng-if="!record.tx_statuses.draft">
          <span class="text-muted" crm-icon="fa-file-text-o" title="{{ts('No draft revision, &quot;%1&quot;, &quot;%2&quot;', {1: record.msg_title, 2: record.tx_language_label || ts('Standard')})}}">{{:: ts('Draft') }}</span>
        </span>
      </td>
      <td>
        <span ng-if="record._is_primary">
          <a href crm-icon="fa-plus" ng-click="$ctrl.addTranslation(record)" title="{{ts('Add translation, &quot;%1&quot;', {1: record.msg_title})}}">{{:: ts('Translate') }}</a>
        </span>
      </td>
    </tr>
    </tbody>
  </table>

</div>
