view kallithea/templates/admin/admin_log.html @ 8251:fb9550946c26

js: use strict ... and fix the problems it points out "use strict" gives stricter checks, both statically and at runtime. The strictness tightens up the code and prevents some kinds of problems. The <script> tag addition might not be pretty, but has consistently been added with: sed -i 's,<script>$,&'"'"'use strict'"'"';,g' `hg loc '*.html'`
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 17 Feb 2020 17:49:45 +0100
parents 1f3e993156e4
children 19d93bd709bf
line wrap: on
line source

## -*- coding: utf-8 -*-
%if c.users_log:
<table class="table">
    <tr>
        <th class="left">${_('Username')}</th>
        <th class="left">${_('Action')}</th>
        <th class="left">${_('Repository')}</th>
        <th class="left">${_('Date')}</th>
        <th class="left">${_('From IP')}</th>
    </tr>

    %for cnt,l in enumerate(c.users_log):
    <tr class="parity${cnt%2}">
        <td>
        %if l.user is not None:
          ${h.link_to(l.user.username,h.url('edit_user', id=l.user.user_id))}
        %else:
          ${l.username}
        %endif
        </td>
        <td>${h.action_parser(l)[0]()}
            <div class="journal_action_params">
                ${h.literal(h.action_parser(l)[1]())}
            </div>
        </td>
        <td>
            %if l.repository is not None:
              ${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))}
            %else:
              ${l.repository_name}
            %endif
        </td>

        <td>${h.fmt_date(l.action_date)}</td>
        <td>${l.user_ip}</td>
    </tr>
    %endfor
</table>

<script>'use strict';
  $(document).ready(function(){
    var $user_log = $('#user_log');
    $user_log.on('click','.pager_link',function(e){
      asynchtml(e.target.href, $user_log, function(){
        show_more_event();
        tooltip_activate();
      });
      e.preventDefault();
    });
    $user_log.on('click','.show_more',function(e){
      var el = e.target;
      $('#'+el.id.substring(1)).show();
      $(el.parentNode).hide();
    });
  });
</script>

${c.users_log.pager()}

%else:
    ${_('No actions yet')}
%endif