summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-02-14 18:55:26 +0100
committerPetr Vobornik <pvoborni@redhat.com>2014-04-03 12:40:37 +0200
commitaadde0f849bc7f129ef5bfdd96391ebeee273829 (patch)
tree2578a9895d5141dc43c4c61a43495d0a5e164567 /install
parent0d05a50e19b71cade636d9ca4882e453f614a78c (diff)
downloadfreeipa-aadde0f849bc7f129ef5bfdd96391ebeee273829.tar.gz
freeipa-aadde0f849bc7f129ef5bfdd96391ebeee273829.tar.xz
freeipa-aadde0f849bc7f129ef5bfdd96391ebeee273829.zip
webui: replace widget's hidden property with visible
Hidden was used only in ACI. There is no reason to have two properties which are negations of each other. Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
Diffstat (limited to 'install')
-rw-r--r--install/ui/src/freeipa/aci.js14
-rw-r--r--install/ui/src/freeipa/widget.js42
2 files changed, 39 insertions, 17 deletions
diff --git a/install/ui/src/freeipa/aci.js b/install/ui/src/freeipa/aci.js
index 0615184c0..e26ecd27d 100644
--- a/install/ui/src/freeipa/aci.js
+++ b/install/ui/src/freeipa/aci.js
@@ -756,7 +756,7 @@ aci.permission_target_widget = function(spec) {
that.type_select = IPA.select_widget({
entity: that.entity,
name: 'type',
- hidden: true,
+ visible: false,
options: types
});
that.widgets.add_widget(that.type_select);
@@ -764,21 +764,21 @@ aci.permission_target_widget = function(spec) {
that.ipapermlocation_text = IPA.text_widget({
entity: that.entity,
name: 'ipapermlocation',
- hidden: true
+ visible: false
});
that.widgets.add_widget(that.ipapermlocation_text);
that.extratargetfilter_text = IPA.multivalued_widget({
entity: that.entity,
name: 'extratargetfilter',
- hidden: true
+ visible: false
});
that.widgets.add_widget(that.extratargetfilter_text);
that.ipapermtarget_text = IPA.text_widget({
entity: that.entity,
name: 'ipapermtarget',
- hidden: true
+ visible: false
});
that.widgets.add_widget(that.ipapermtarget_text);
@@ -799,14 +799,14 @@ aci.permission_target_widget = function(spec) {
entity: that.entity,
name: 'attrs',
object_type: types[0].name,
- hidden: true
+ visible: false
});
that.widgets.add_widget(that.attribute_table);
that.attribute_multivalued = IPA.multivalued_widget({
entity: that.entity,
name: 'attrs_multi',
- hidden: true
+ visible: false
});
that.widgets.add_widget(that.attribute_multivalued);
};
@@ -941,7 +941,7 @@ aci.permission_target_policy = function (spec) {
var enabled = !(managed_f && that.managed) && visible && !that.system;
field.set_enabled(enabled);
field.set_required(visible && target_info.required);
- widget.hidden = !visible;
+ widget.set_visible(visible);
};
that.target_mapping = {
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index 9b04acc91..ecac43645 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -136,6 +136,12 @@ IPA.widget = function(spec) {
that.show_errors = spec.show_errors === undefined ? true : spec.show_errors;
/**
+ * Facet should be visible
+ * @property {boolean}
+ */
+ that.visible = spec.visible === undefined ? true : spec.visible;
+
+ /**
* Create HTML representation of a widget.
* @method
* @param {HTMLElement} container - Container node
@@ -169,18 +175,27 @@ IPA.widget = function(spec) {
* @param {boolean} value - True - visible; False - hidden
*/
that.set_visible = function(visible) {
- var changed = visible !== that.container.is(':visible');
+ var changed = visible !== that.visible;
+ that.visible = visible;
if (visible) {
- that.container.show();
+ that.show();
} else {
- that.container.hide();
+ that.hide();
}
if (changed) {
that.emit('visible-change', { source: that, visible: visible });
}
};
+ that.hide = function() {
+ that.container.hide();
+ };
+
+ that.show = function() {
+ that.container.show();
+ };
+
/**
* Utility method. Build widget based on spec with this widget's context.
* @param {boolean} spec - Widget specification object
@@ -273,11 +288,7 @@ IPA.input_widget = function(spec) {
*/
that.read_only = spec.read_only;
- /**
- * Mark the widget to be hidden (form or dialog may not display it).
- * @property {boolean}
- */
- that.hidden = spec.hidden;
+
//events
//each widget can contain several events
@@ -4213,7 +4224,7 @@ IPA.table_layout = function(spec) {
var tr = $('<tr/>');
that.rows.put(widget.name, tr);
- if (widget.hidden) {
+ if (!widget.visible) {
tr.css('display', 'none');
}
@@ -4299,7 +4310,7 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) {
var group = $('<div/>', { 'class': that.group_cls });
that.rows.put(widget.name, group);
- if (widget.hidden) {
+ if (!widget.visible) {
group.css('display', 'none');
}
@@ -4353,6 +4364,7 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) {
on(widget, 'writable-change', that.on_require_change);
on(widget, 'error-show', that.on_error_show);
on(widget, 'error-hide', that.on_error_hide);
+ on(widget, 'visible-change', that.on_visible_change);
};
that.on_enabled_change = function(event) {
@@ -4383,6 +4395,16 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) {
row.toggleClass('error', false);
};
+ that.on_visible_change = function(event) {
+
+ var row = that._get_row(event);
+ if (event.visible) {
+ row.css('display', '');
+ } else {
+ row.css('display', 'none');
+ }
+ };
+
that.update_state = function(row, widget) {
row.toggleClass('disabled', !widget.enabled);
row.toggleClass('required', !!widget.required && widget.is_writable());