From 7adb034e02c7a2a23f52d96d366273cc76e4717f Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 17 Oct 2013 10:28:47 +0200 Subject: [PATCH] Remove jquery button usage and unify button code https://fedorahosted.org/freeipa/ticket/3904 --- install/ui/src/freeipa/widget.js | 117 +++++++++++++++---------------- ipatests/test_webui/ui_driver.py | 7 +- 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 3891bf9b1..0fcf61827 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -3449,7 +3449,7 @@ IPA.link_widget = function(spec) { }; /** - * Create link which behaves as button + * Create button * * @method * @member IPA @@ -3469,16 +3469,54 @@ IPA.link_widget = function(spec) { */ IPA.action_button = function(spec) { + spec = $.extend({}, spec); + + spec.element = spec.element || ''; + spec.button_class = spec.button_class || 'button action-button'; + + var button = IPA.button(spec); + button.prop('href', spec.href || '#'); + return button; +}; + +/** + * Create button + * + * Has different styling than action button. + * + * @method + * @member IPA + * + * @param {Object} spec + * @param {string} [spec.name] + * @param {string} [spec.label] button text + * @param {string} [spec.title=label] button title + * @param {string} [spec.icon] icon name (class) + * @param {string} [spec.id] + * @param {string} [spec.style] css style + * @param {string} [spec.class] + * @param {string} [spec.button_class] + * @param {string} [spec.element] + * @param {string} [spec.type] + * @param {Function} [spec.click] click handler + * @param {boolean} [spec.focusable] button is focusable + * @param {Function} [spec.blur] blur handler + */ +IPA.button = function(spec) { + spec = spec || {}; - var button = $('', { + var el = spec.element || '