summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-04-19 11:53:00 -0500
committerEndi Sukma Dewata <edewata@people01.fedoraproject.org>2011-04-21 19:44:06 +0000
commitd2be41dd1b69020b11cdd6ba66436424f3a0033a (patch)
treed88c09f5a0ef620df4319f2e564689f585299eb6
parent3528b4eca3cf2519a6af5a43f6b321cbd8eea138 (diff)
downloadfreeipa-d2be41dd1b69020b11cdd6ba66436424f3a0033a.tar.gz
freeipa-d2be41dd1b69020b11cdd6ba66436424f3a0033a.tar.xz
freeipa-d2be41dd1b69020b11cdd6ba66436424f3a0033a.zip
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.
-rw-r--r--install/ui/associate.js35
-rw-r--r--install/ui/details.js33
-rw-r--r--install/ui/dns.js38
-rw-r--r--install/ui/entitle.js6
-rw-r--r--install/ui/search.js11
5 files changed, 68 insertions, 55 deletions
diff --git a/install/ui/associate.js b/install/ui/associate.js
index f4ebb1ef..ca912e3f 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 0a22c177..590d775a 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 4debd368..637b7344 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -299,6 +299,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/>',{
@@ -337,24 +356,23 @@ IPA.records_facet = function (spec){
'click': function(){refresh();}
}).appendTo(control_span);
- var action_panel_ul = $('.action-panel .entity-facet', that.container).
- last();
-
- var action_controls = $('<li/>',{
- "class":"action-controls"}).appendTo(action_panel_ul);
-
+ var action_panel = that.get_action_panel();
- IPA.action_button({
+ var button = $('input[name=remove]', action_panel);
+ that.remove_button = IPA.action_button({
label: IPA.messages.buttons.remove,
icon: 'ui-icon-trash',
click: function(){ delete_records(records_table); }
- }).appendTo(action_controls);
+ });
+ button.replaceWith(that.remove_button);
- IPA.action_button({
+ button = $('input[name=add]', action_panel);
+ that.add_button = IPA.action_button({
label: IPA.messages.buttons.add,
icon: 'ui-icon-plus',
click: add_click
- }).appendTo(action_controls);
+ });
+ button.replaceWith(that.add_button);
div.append('<span class="records-buttons"></span>');
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index 17be4583..4ef90afe 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -263,11 +263,7 @@ IPA.entitle.search_facet = function(spec) {
that.facet_create_action_panel(container);
- var li = $('.action-controls', container);
-
- var buttons = $('<span/>', {
- 'class': 'search-buttons'
- }).appendTo(li);
+ var buttons = $('.action-controls', container);
that.register_buttons = $('<span/>', {
style: 'display: none;'
diff --git a/install/ui/search.js b/install/ui/search.js
index 775ae549..9a458bfc 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -217,11 +217,7 @@ IPA.search_facet = function(spec) {
that.facet_create_action_panel(container);
- var li = $('.action-controls', container);
-
- var buttons = $('<span/>', {
- 'class': 'search-buttons'
- }).appendTo(li);
+ var buttons = $('.action-controls', container);
$('<input/>', {
'type': 'button',
@@ -251,9 +247,8 @@ IPA.search_facet = function(spec) {
that.table.setup(span);
var action_panel = that.get_action_panel();
- var search_buttons = $('.search-buttons', action_panel);
- var button = $('input[name=remove]', search_buttons);
+ var button = $('input[name=remove]', action_panel);
that.remove_button = IPA.action_button({
'label': IPA.messages.buttons.remove,
'icon': 'ui-icon-trash',
@@ -265,7 +260,7 @@ IPA.search_facet = function(spec) {
button.replaceWith(that.remove_button);
that.remove_button.addClass('input_link_disabled');
- button = $('input[name=add]', search_buttons);
+ button = $('input[name=add]', action_panel);
that.add_button = IPA.action_button({
'label': IPA.messages.buttons.add,
'icon': 'ui-icon-plus',