From 23c042775c0b6d918e7f05229a834622382e66fb Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 18 Oct 2013 12:14:25 +0200 Subject: RCUE dialog implementation https://fedorahosted.org/freeipa/ticket/3904 --- install/ui/src/freeipa/dialog.js | 236 +++++++++++++++++++++++++++------------ 1 file changed, 162 insertions(+), 74 deletions(-) (limited to 'install/ui/src/freeipa/dialog.js') diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index a289e52f..29f480c5 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -44,7 +44,6 @@ IPA.opened_dialogs = { focus_top: function() { var top = this.top_dialog(); if (top) { - top.container.dialog('moveToTop'); //make sure the last dialog is top dialog top.focus_first_element(); } }, @@ -79,6 +78,10 @@ IPA.dialog_button = function(spec) { that.click = spec.click || click; /** @property {boolean} visible=true Button should be visible */ that.visible = spec.visible !== undefined ? spec.visible : true; + /** @property {boolean} enabled=true Button is enabled */ + that.enabled = spec.enabled !== undefined ? spec.enabled : true; + /** @property {jQuery} element Button element */ + that.element = null; function click() { } @@ -88,10 +91,11 @@ IPA.dialog_button = function(spec) { * @param {boolean} enabled */ that.set_enabled = function(enabled) { - if (enabled) { - that.element.removeClass('ui-state-disabled'); - } else { - that.element.addClass('ui-state-disabled'); + + that.enabled = enabled; + + if (that.element) { + that.element.prop('disabled', !enabled); } }; @@ -100,7 +104,7 @@ IPA.dialog_button = function(spec) { * @return {boolean} */ that.is_enabled = function() { - return !that.element.hasClass('ui-state-disabled'); + return that.enabled; }; return that; @@ -208,16 +212,92 @@ IPA.dialog = function(spec) { return null; }; + /** + * Create + * @protected + * @return {jQuery} dom_node + */ + that.create_dialog = function() { + + if (that.dom_node) { + that.dom_node.empty(); + } + + that.dom_node = $('
', { + 'class': 'rcue-dialog-background' + }); + + var container_node = $('
', { + 'class': 'rcue-dialog-container' + }).appendTo(that.dom_node); + + that.dialog_node = $('
', { + 'class': 'rcue-dialog', + id: that.get_id(), + 'data-name' : that.name, + role: 'dialog', + tabIndex: -1 // make the div focusable + }).appendTo(container_node); + + that.header_node = $('
'); + that.create_header(); + that.header_node.appendTo(that.dialog_node); + + that.body_node = $('
', { + 'class': 'rcue-dialog-body' + }); + // for backwards compatibility + that.container = that.body_node; + that.create_content(); + that.body_node.appendTo(that.dialog_node); + + that.footer_node = $('