commit
772ea1026b
|
@ -23,6 +23,7 @@ class JavaScript
|
|||
'js/icinga/module.js',
|
||||
'js/icinga/timezone.js',
|
||||
'js/icinga/behavior/application-state.js',
|
||||
'js/icinga/behavior/autofocus.js',
|
||||
'js/icinga/behavior/tooltip.js',
|
||||
'js/icinga/behavior/sparkline.js',
|
||||
'js/icinga/behavior/tristate.js',
|
||||
|
|
|
@ -31,6 +31,7 @@ class WelcomePage extends Form
|
|||
'text',
|
||||
'token',
|
||||
array(
|
||||
'class' => 'autofocus',
|
||||
'required' => true,
|
||||
'label' => $this->translate('Setup Token'),
|
||||
'description' => $this->translate(
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
ApplicationState.prototype = new Icinga.EventListener();
|
||||
|
||||
ApplicationState.prototype.onRendered = function(e) {
|
||||
if (! $('#application-state').length && ! $('#login').length && ! $('#guest-error').length) {
|
||||
if (! $('#application-state').length
|
||||
&& ! $('#login').length
|
||||
&& ! $('#guest-error').length
|
||||
&& ! $('#setup').length
|
||||
) {
|
||||
var _this = e.data.self;
|
||||
|
||||
$('#layout').append(
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
(function(Icinga, $) {
|
||||
|
||||
'use strict';
|
||||
|
||||
Icinga.Behaviors = Icinga.Behaviors || {};
|
||||
|
||||
var Autofocus = function (icinga) {
|
||||
Icinga.EventListener.call(this, icinga);
|
||||
this.on('rendered', this.onRendered, this);
|
||||
};
|
||||
|
||||
Autofocus.prototype = new Icinga.EventListener();
|
||||
|
||||
Autofocus.prototype.onRendered = function(e) {
|
||||
if (document.activeElement === document.body) {
|
||||
$(e.target).find('.autofocus').focus();
|
||||
}
|
||||
};
|
||||
|
||||
Icinga.Behaviors.Autofocus = Autofocus;
|
||||
|
||||
})(Icinga, jQuery);
|
Loading…
Reference in New Issue