Action panel buttons are now created in facet's create_action_panel().
This is to allow a subclass to override and customize the buttons.
--
Endi S. Dewata
From b3befcf304680388b8de9eaec6abcebbf6426c5b Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Tue, 19 Apr 2011 11:53:00 -0500
Subject: [PATCH] Standardized action panel buttons creation.
Action panel buttons are now created in facet's create_action_panel().
This is to allow a subclass to override and customize the buttons.
---
install/ui/associate.js | 35 +++
install/ui/details.js | 33 +
install/ui/dns.js | 38 --
install/ui/entitle.js |6 +-
install/ui/search.js| 11 +++
5 files changed, 68 insertions(+), 55 deletions(-)
diff --git a/install/ui/associate.js b/install/ui/associate.js
index f4ebb1ef74235687ef480b9129a2c553e83f1cbe..ca912e3fa0d2f04f21ad68bf5655023de41a7ac2 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -799,6 +799,25 @@ IPA.association_facet = function (spec) {
return pkey != that.pkey;
};
+that.create_action_panel = function(container) {
+
+that.facet_create_action_panel(container);
+
+var buttons = $('.action-controls', container);
+
+$('input/', {
+'type': 'button',
+'name': 'remove',
+'value': IPA.messages.buttons.remove
+}).appendTo(buttons);
+
+$('input/', {
+'type': 'button',
+'name': 'add',
+'value': IPA.messages.buttons.enroll
+}).appendTo(buttons);
+};
+
that.create_content = function(container) {
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
@@ -832,22 +851,6 @@ IPA.association_facet = function (spec) {
var span = $('span/', { 'name': 'association' }).appendTo(container);
that.table.create(span);
-
-var action_panel = that.get_action_panel();
-var li = $('.action-controls', action_panel);
-
-// creating generic buttons for layout
-$('input/', {
-'type': 'button',
-'name': 'remove',
-'value': IPA.messages.buttons.remove
-}).appendTo(li);
-
-$('input/', {
-'type': 'button',
-'name': 'add',
-'value': IPA.messages.buttons.enroll
-}).appendTo(li);
};
that.setup = function(container) {
diff --git a/install/ui/details.js b/install/ui/details.js
index 0a22c1773ea31b1c751a33b89d96ca2b2d18cce6..590d775a2ad434f3bead9f50898ba876e1b3c510 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -323,6 +323,23 @@ IPA.details_facet = function(spec) {
}
};
+that.create_action_panel = function(container) {
+
+that.facet_create_action_panel(container);
+
+var buttons = $('.action-controls', container);
+
+$('input/', {
+'type': 'text',
+'name': 'reset'
+}).appendTo(buttons);
+
+$('input/', {
+'type': 'text',
+'name': 'update'
+}).appendTo(buttons);
+};
+
function create_content(container) {
var label = IPA.metadata.objects[that.entity_name].label;
@@ -356,22 +373,6 @@ IPA.details_facet = function(spec) {
details.append('br/');
-var action_panel = that.get_action_panel();
-
-var ul = $('ul', action_panel);
-var buttons = $('.action-controls',action_panel);
-
-$('input/', {
-'type': 'text',
-'name': 'reset'
-}).appendTo(buttons);
-
-$('input/', {
-'type': 'text',
-'name': 'update'
-}).appendTo(buttons);
-
-
for (var i = 0; i that.sections.length; ++i) {
var section = that.sections[i];
diff --git a/install/ui/dns.js b/install/ui/dns.js
index d92963c3b5c5ede8ec1ca94dc43b5d9bfb8097ef..d6527100387982feaa243d2fb534984ad165e1bd 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -287,6 +287,25 @@ IPA.records_facet = function (spec){
return pkey != that.pkey || record != that.record;
};
+that.create_action_panel = function(container) {
+
+that.facet_create_action_panel(container);
+
+var buttons = $('.action-controls', container);
+
+$('input/', {
+'type': 'button',
+'name': 'remove',
+'value': IPA.messages.buttons.remove
+}).appendTo(buttons);
+
+$('input/', {
+'type': 'button',
+'name': 'add',
+'value': IPA.messages.buttons.add
+}).appendTo(buttons);
+};
+
function create_content(container) {
$('h1/',{
@@ -325,24 +344,23 @@ IPA.records_facet = function (spec){
'click': function(){refresh();}
}).appendTo(control_span);
-var action_panel_ul =