view kallithea/templates/admin/users/user_edit_api_keys.html @ 6258:b7654d1675da

style: in preparation for bootstrap, use bootstrap compatible button class names Give all buttons a styling (default, success, danger, warning) and rename the sizes to sm and xs. This is a subset of a bigger changeset. The subset was extracted by Mads Kiilerich, mostly by: sed -i \ -e 's,btn btn-small,btn btn-default btn-sm,g' \ -e 's,btn btn-mini,btn btn-default btn-xs,g' \ -e 's,btn-default btn-\(xs\|sm\) btn-\(success\|danger\|warning\),btn-\2 btn-\1,g' \ -e 's,class_="btn",class_="btn btn-default",g' \ `hg mani`
author domruf <dominikruf@gmail.com>
date Sun, 18 Sep 2016 19:39:36 +0200
parents 23ff4e66391a
children 4304595d246c
line wrap: on
line source

<div class="apikeys_wrap">
  <table class="noborder">
    <tr>
        <td style="width: 450px"><div class="truncate autoexpand" style="width:120px;font-size:16px;font-family: monospace">${c.user.api_key}</div></td>
        <td>
            <span class="btn btn-success btn-xs disabled">${_('Built-in')}</span>
        </td>
        <td>${_('Expires')}: ${_('Never')}</td>
        <td>
            ${h.form(url('edit_user_api_keys_delete', id=c.user.user_id))}
                ${h.hidden('del_api_key',c.user.api_key)}
                ${h.hidden('del_api_key_builtin',1)}
                <button class="btn btn-danger btn-xs" type="submit"
                        onclick="return confirm('${_('Confirm to reset this API key: %s') % c.user.api_key}');">
                    ${_('Reset')}
                </button>
            ${h.end_form()}
        </td>
    </tr>
    %if c.user_api_keys:
        %for api_key in c.user_api_keys:
          <tr class="${'expired' if api_key.expired else ''}">
            <td style="width: 450px"><div class="truncate autoexpand" style="width:120px;font-size:16px;font-family: monospace">${api_key.api_key}</div></td>
            <td>${api_key.description}</td>
            <td style="min-width: 80px">
                 %if api_key.expires == -1:
                  ${_('Expires')}: ${_('Never')}
                 %else:
                    %if api_key.expired:
                        ${_('Expired')}: ${h.age(h.time_to_datetime(api_key.expires))}
                    %else:
                        ${_('Expires')}: ${h.age(h.time_to_datetime(api_key.expires))}
                    %endif
                 %endif
            </td>
            <td>
                ${h.form(url('edit_user_api_keys_delete', id=c.user.user_id))}
                    ${h.hidden('del_api_key',api_key.api_key)}
                    <button class="btn btn-danger btn-xs" type="submit"
                            onclick="return confirm('${_('Confirm to remove this API key: %s') % api_key.api_key}');">
                        <i class="icon-minus-circled"></i>
                        ${_('Remove')}
                    </button>
                ${h.end_form()}
            </td>
          </tr>
        %endfor
    %else:
    <tr><td><div class="ip">${_('No additional API keys specified')}</div></td></tr>
    %endif
  </table>
</div>

<div>
    ${h.form(url('edit_user_api_keys_update', id=c.user.user_id))}
    <div class="form">
        <!-- fields -->
        <div class="fields">
             <div class="field">
                <div class="label">
                    <label for="description">${_('New API key')}:</label>
                </div>
                <div class="input">
                    ${h.text('description', class_='medium', placeholder=_('Description'))}
                    ${h.select('lifetime', '', c.lifetime_options)}
                </div>
             </div>
            <div class="buttons">
              ${h.submit('save',_('Add'),class_="btn btn-default")}
              ${h.reset('reset',_('Reset'),class_="btn btn-default")}
            </div>
        </div>
    </div>
    ${h.end_form()}
</div>

<script>
    $(document).ready(function(){
        $("#lifetime").select2({
            'dropdownAutoWidth': true
        });
    });
</script>