1
0
mirror of https://github.com/Yubico/yubiadmin.git synced 2025-02-22 11:54:16 +01:00

Select API keys on click (val).

This commit is contained in:
Dain Nilsson 2014-01-13 11:24:02 +01:00
parent bd148d1a9e
commit 93e7d25786
8 changed files with 32 additions and 12 deletions

View File

@ -360,7 +360,7 @@ class YubiAuthApp(App):
def advanced(self, request):
return self.render_forms(request, [
FileForm(AUTH_CONFIG_FILE, 'Configuration', lang='python')
], script='editor')
], scripts=['editor'])
def users(self, request):
"""

View File

@ -140,7 +140,7 @@ class FreeRadius(App):
FileForm(CLIENTS_CONFIG_FILE, 'clients.conf',
'Changes require the FreeRADIUS server to be restarted.',
lang='ini')
], script='editor')
], scripts=['editor'])
CLIENT = re.compile('client\s+(.+)\s+{')

View File

@ -273,7 +273,7 @@ class YubikeyVal(App):
def advanced(self, request):
return self.render_forms(request, [
FileForm(YKVAL_CONFIG_FILE, 'Configuration', lang='php')
], script='editor')
], scripts=['editor'])
# Pulls the tab to the right:
advanced.advanced = True

View File

@ -1 +1,15 @@
$(document).ready(function() {
$('body').on('click', '.selectable-text', function() {
if (document.body.createTextRange) {
var range = document.body.createTextRange();
range.moveToElementText(this);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(this);
selection.removeAllRanges();
selection.addRange(range);
}
});
});

View File

@ -29,18 +29,18 @@
<!-- This code is taken from http://twitter.github.com/bootstrap/examples/hero.html -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
{% block body %}
<p>Hello world!</p>
{% endblock %}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script src="/js/vendor/bootstrap.min.js"></script>
<script src="/js/main.js"></script>
{% if script %}
{% for script in scripts %}
<script src="/js/{{script}}.js"></script>
{% endif %}
{% endfor %}
</body>
</html>

View File

@ -5,5 +5,5 @@
<dt>Client ID</dt>
<dd>{{ client_id }}</dd>
<dt>API Key</dt>
<dd>{{ api_key }}</dd>
<dd><span class="selectable-text">{{ api_key }}</span></dd>
</dl>

View File

@ -3,3 +3,9 @@
{{ table(cols, items, caption, next, prev, shown, total, item_name, selectable) }}
<a href="/val/clients/create" class="btn btn-primary pull-right">Generate new API client</a>
<script>
$(document).ready(function() {
$('td[colspan=2]').addClass('selectable-text');
});
</script>

View File

@ -171,7 +171,7 @@ class CollectionApp(App):
item_name = 'Items'
columns = []
template = 'table'
script = 'table'
scripts = ['table']
selectable = True
max_limit = 100
@ -218,7 +218,7 @@ class CollectionApp(App):
next = None
return render(
self.template, script=self.script, items=items, offset=offset,
self.template, scripts=self.scripts, items=items, offset=offset,
limit=limit, total=total, shown='%d-%d' % shown, prev=prev,
next=next, base_url=self.base_url, caption=self.caption,
cols=self.columns, item_name=self.item_name,