Skip to content
Snippets Groups Projects
Commit ecd84cc2 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Alert.js: buttons on alerts are now really `<button>`. Buttons can now have...

Alert.js: buttons on alerts are now really `<button>`. Buttons can now have the default focus, as specified by the `focus` attribue in the button configuration.
parent 0ceedc06
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,7 @@ var QfqNS = QfqNS || {};
*
* {
* label: <button label>,
* focus: true | false,
* eventName: <eventname>
* }
*
......@@ -139,8 +140,11 @@ var QfqNS = QfqNS || {};
$buttons = $("<div>").addClass("alert-buttons");
}
$buttons.append($("<a>").append(buttonConfiguration.label)
.addClass("btn btn-default")
var focus = buttonConfiguration.focus ? buttonConfiguration.focus : false;
$buttons.append($("<button>").append(buttonConfiguration.label)
.attr('type', 'button')
.addClass("btn btn-default" + (focus ? " wants-focus" : ""))
.click(buttonConfiguration, this.buttonHandler.bind(this)));
}
......@@ -173,6 +177,7 @@ var QfqNS = QfqNS || {};
$alertContainer.append(this.$alertDiv);
this.$alertDiv.slideDown(this.fadeInDuration, this.afterFadeIn.bind(this));
this.$alertDiv.find(".wants-focus").focus();
this.shown = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment