mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed IPA.widget's load, save, and is_dirty.
This patch fixes the problem leaving the user details page.
This commit is contained in:
committed by
Adam Young
parent
de28abc236
commit
987507efd0
@@ -109,9 +109,20 @@ IPA.widget = function(spec) {
|
||||
that.container = container;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function stores the entire record and the values
|
||||
* of the field, then invoke reset() to update the UI.
|
||||
*/
|
||||
function load(record) {
|
||||
that.record = record;
|
||||
that.values = record[that.name];
|
||||
|
||||
var value = record[that.name];
|
||||
if (value instanceof Array) {
|
||||
that.values = value;
|
||||
} else {
|
||||
that.values = value ? [value] : [];
|
||||
}
|
||||
|
||||
that.reset();
|
||||
}
|
||||
|
||||
@@ -123,10 +134,20 @@ IPA.widget = function(spec) {
|
||||
function update() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function saves the values entered in the UI.
|
||||
* It returns the values in an array, or null if
|
||||
* the field should not be saved.
|
||||
*/
|
||||
function save() {
|
||||
return [];
|
||||
return that.values;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function compares the original values and the
|
||||
* values entered in the UI. If the values have changed
|
||||
* it will return true.
|
||||
*/
|
||||
that.is_dirty = function() {
|
||||
|
||||
if (that.read_only) {
|
||||
@@ -135,16 +156,12 @@ IPA.widget = function(spec) {
|
||||
|
||||
var values = that.save();
|
||||
|
||||
if (!values) { // ignore null values
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!that.values) {
|
||||
|
||||
if (!values) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (values === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (values instanceof Array) {
|
||||
|
||||
if ((values.length === 0) ||
|
||||
|
||||
Reference in New Issue
Block a user