mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
aci rights widget
Fixes is_dirty and save https://fedorahosted.org/freeipa/ticket/77 https://fedorahosted.org/freeipa/ticket/667
This commit is contained in:
@@ -222,10 +222,40 @@ IPA.rights_widget = function(spec){
|
||||
};
|
||||
var values = [];
|
||||
|
||||
that.reset = function(){
|
||||
var selector = '.'+ that.entity_name +"_"+ that.name;
|
||||
function get_selector(){
|
||||
return '.'+ that.entity_name +"_"+ that.name;
|
||||
}
|
||||
|
||||
var checkboxes = $(selector);
|
||||
that.is_dirty = function(){
|
||||
|
||||
var checkboxes = $(get_selector());
|
||||
var checked = {};
|
||||
|
||||
checkboxes.each(function (){
|
||||
checked[this.id] = this.checked;
|
||||
});
|
||||
|
||||
for (var i = 0; i < values.length; i +=1){
|
||||
var key = values[i];
|
||||
|
||||
if ( !checked[key] ){
|
||||
return true;
|
||||
}
|
||||
checked[key] = false;
|
||||
}
|
||||
|
||||
for (key in checked){
|
||||
if (checked[key] ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
that.reset = function(){
|
||||
|
||||
var checkboxes = $(get_selector());
|
||||
|
||||
for (var i = 0; i < checkboxes.length; i +=1){
|
||||
checkboxes.attr('checked','');
|
||||
@@ -233,7 +263,7 @@ IPA.rights_widget = function(spec){
|
||||
|
||||
for (var j = 0; j < values.length; j +=1){
|
||||
var value = values[j];
|
||||
var cb = $('#'+value+ selector);
|
||||
var cb = $('#'+value+ get_selector());
|
||||
cb.attr('checked', 'checked');
|
||||
}
|
||||
|
||||
@@ -245,7 +275,7 @@ IPA.rights_widget = function(spec){
|
||||
};
|
||||
|
||||
that.save = function(){
|
||||
var rights_input = $('.'+ that.entity_name +"_"+ that.name);
|
||||
var rights_input = $(get_selector()+":checked");
|
||||
var retval = "";
|
||||
for (var i =0; i < rights_input.length; i+=1){
|
||||
if (i > 0) {
|
||||
@@ -592,7 +622,7 @@ IPA.entity_factories.permission = function () {
|
||||
input({ name: 'description'})).
|
||||
section(IPA.rights_section()).
|
||||
section(IPA.target_section()));
|
||||
return that;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -155,9 +155,7 @@ var IPA = ( function () {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
that.show_page = function (entity_name, facet_name) {
|
||||
if (!IPA.test_dirty()){
|
||||
@@ -170,19 +168,19 @@ var IPA = ( function () {
|
||||
};
|
||||
|
||||
that.switch_and_show_page = function (this_entity, facet_name, pkey) {
|
||||
|
||||
if (!IPA.test_dirty()){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!pkey){
|
||||
that.show_page(this_entity, facet_name);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
var state = {};
|
||||
state[this_entity+'-pkey'] = pkey;
|
||||
state[this_entity + '-facet'] = facet_name;
|
||||
$.bbq.pushState(state);
|
||||
return true;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
||||
Reference in New Issue
Block a user