##// END OF EJS Templates
datagrid: fix some styling and processing text.
datagrid: fix some styling and processing text.

File last commit:

r1518:6474fb97 default
r1541:5bd4fc3b default
Show More
my_account_auth_tokens.mako
160 lines | 5.9 KiB | application/x-mako | MakoHtmlLexer
/ rhodecode / templates / admin / my_account / my_account_auth_tokens.mako
templating: use .mako as extensions for template files.
r1282 <div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Authentication Tokens')}</h3>
</div>
<div class="panel-body">
admin: moved auth tokens into pyramid view....
r1518 <div class="apikeys_wrap">
templating: use .mako as extensions for template files.
r1282 <p>
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 ${_('Each token can have a role. Token with a role can be used only in given context, '
'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
templating: use .mako as extensions for template files.
r1282 </p>
<table class="rctable auth_tokens">
admin: moved auth tokens into pyramid view....
r1518 <tr>
<th>${_('Token')}</th>
<th>${_('Scope')}</th>
<th>${_('Description')}</th>
<th>${_('Role')}</th>
<th>${_('Expiration')}</th>
<th>${_('Action')}</th>
</tr>
templating: use .mako as extensions for template files.
r1282 %if c.user_auth_tokens:
%for auth_token in c.user_auth_tokens:
<tr class="${'expired' if auth_token.expired else ''}">
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 <td class="truncate-wrap td-authtoken">
<div class="user_auth_tokens truncate autoexpand">
<code>${auth_token.api_key}</code>
</div>
</td>
<td class="td">${auth_token.scope_humanized}</td>
templating: use .mako as extensions for template files.
r1282 <td class="td-wrap">${auth_token.description}</td>
<td class="td-tags">
<span class="tag disabled">${auth_token.role_humanized}</span>
</td>
<td class="td-exp">
%if auth_token.expires == -1:
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 ${_('never')}
templating: use .mako as extensions for template files.
r1282 %else:
%if auth_token.expired:
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
templating: use .mako as extensions for template files.
r1282 %else:
auth-tokens: add scope and show consitent token UI for my account and admin.
r1480 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
templating: use .mako as extensions for template files.
r1282 %endif
%endif
</td>
<td class="td-action">
my-account-auth-tokens: moved into pyramid apps....
r1505 ${h.secure_form(h.route_path('my_account_auth_tokens_delete'), method='post')}
templating: use .mako as extensions for template files.
r1282 ${h.hidden('del_auth_token',auth_token.api_key)}
<button class="btn btn-link btn-danger" type="submit"
onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.api_key}');">
${_('Delete')}
</button>
${h.end_form()}
</td>
</tr>
%endfor
%else:
admin: moved auth tokens into pyramid view....
r1518 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
templating: use .mako as extensions for template files.
r1282 %endif
</table>
admin: moved auth tokens into pyramid view....
r1518 </div>
templating: use .mako as extensions for template files.
r1282
<div class="user_auth_tokens">
my-account-auth-tokens: moved into pyramid apps....
r1505 ${h.secure_form(h.route_path('my_account_auth_tokens_add'), method='post')}
templating: use .mako as extensions for template files.
r1282 <div class="form form-vertical">
<!-- fields -->
<div class="fields">
<div class="field">
<div class="label">
<label for="new_email">${_('New authentication token')}:</label>
</div>
<div class="input">
admin: moved auth tokens into pyramid view....
r1518 ${h.text('description', class_='medium', placeholder=_('Description'))}
templating: use .mako as extensions for template files.
r1282 ${h.select('lifetime', '', c.lifetime_options)}
${h.select('role', '', c.role_options)}
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507
% if c.allow_scoped_tokens:
${h.hidden('scope_repo_id')}
% else:
${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
% endif
templating: use .mako as extensions for template files.
r1282 </div>
admin: moved auth tokens into pyramid view....
r1518 <p class="help-block">
${_('Repository scope works only with tokens with VCS type.')}
</p>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="buttons">
${h.submit('save',_('Add'),class_="btn")}
${h.reset('reset',_('Reset'),class_="btn")}
</div>
</div>
</div>
${h.end_form()}
</div>
</div>
</div>
auth-tokens: extended views to allowed override of adding scope in EE edition.
r1507 <script>
$(document).ready(function(){
var select2Options = {
'containerCssClass': "drop-menu",
'dropdownCssClass': "drop-menu-dropdown",
'dropdownAutoWidth': true
};
$("#lifetime").select2(select2Options);
$("#role").select2(select2Options);
var repoFilter = function(data) {
var results = [];
if (!data.results[0]) {
return data
}
$.each(data.results[0].children, function() {
// replace name to ID for submision
this.id = this.obj.repo_id;
results.push(this);
});
data.results[0].children = results;
return data;
};
$("#scope_repo_id_disabled").select2(select2Options);
$("#scope_repo_id").select2({
cachedDataSource: {},
minimumInputLength: 2,
placeholder: "${_('repository scope')}",
dropdownAutoWidth: true,
containerCssClass: "drop-menu",
dropdownCssClass: "drop-menu-dropdown",
formatResult: formatResult,
query: $.debounce(250, function(query){
self = this;
var cacheKey = query.term;
var cachedData = self.cachedDataSource[cacheKey];
if (cachedData) {
query.callback({results: cachedData.results});
} else {
$.ajax({
url: "${h.url('repo_list_data')}",
data: {'query': query.term},
dataType: 'json',
type: 'GET',
success: function(data) {
data = repoFilter(data);
self.cachedDataSource[cacheKey] = data;
query.callback({results: data.results});
},
error: function(data, textStatus, errorThrown) {
alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
}
})
}
})
});
});
</script>