wip: UI refactoring

* Activate by default the 'simple user' mode for domain administrators (when creating a new accoun)
* Don't forget to grant access to objects created by domain admins to super admins

see #204
This commit is contained in:
Antoine Nguyen
2012-05-03 18:07:01 +02:00
parent 0dc36d19db
commit ec672e57bc
3 changed files with 35 additions and 16 deletions
+24 -12
View File
@@ -21,20 +21,28 @@ function domainform_cb() {
});
}
function simpleuser_mode() {
$("#id_username").autocompleter({
from_character: "@",
choices: get_domains_list
});
$("#id_email").addClass("disabled")
.attr("readonly", "")
.autocompleter("unbind");
}
function normal_mode() {
$("#id_email").removeClass("disabled")
.attr("readonly", null)
.autocompleter("listen");
}
function generalform_init() {
$("#id_role").change(function(e) {
if ($(this).attr("value") == "SimpleUsers") {
$("#id_username").autocompleter({
from_character: "@",
choices: get_domains_list
});
$("#id_email").addClass("disabled")
.attr("readonly", "")
.autocompleter("unbind");
simpleuser_mode();
} else {
$("#id_email").removeClass("disabled")
.attr("readonly", null)
.autocompleter("listen");
normal_mode();
}
});
}
@@ -45,7 +53,11 @@ function mailform_init() {
from_character: "@",
choices: get_domains_list
});
$("#id_role").trigger("change");
if ($("#id_role").length) {
$("#id_role").trigger("change");
} else {
simpleuser_mode();
}
$("#id_domains")
.autocompleter({
choices: get_domains_list
@@ -60,7 +72,7 @@ function accountform_init() {
}
function mailform_prefill() {
if ($("#id_role").attr("value") == "SimpleUsers") {
if (!$("#id_role").length || $("#id_role").attr("value") == "SimpleUsers") {
$("#id_email").attr("value", $("#id_username").attr("value"));
}
}