Make ssh_widget not-editable if attr is readonly

https://fedorahosted.org/freeipa/ticket/3800
This commit is contained in:
Petr Vobornik 2013-06-28 16:50:52 +02:00
parent 69394bab5a
commit ff6f958d96
2 changed files with 24 additions and 11 deletions

View File

@ -53,6 +53,10 @@ body {
height: 100%;
}
textarea[readonly] {
color: Gray;
}
.network-activity-indicator {
visibility: hidden;
width: 16px;

View File

@ -3796,6 +3796,8 @@ IPA.sshkey_widget = function(spec) {
that.create_edit_dialog = function() {
var writable = that.is_writable();
var dialog = IPA.dialog({
name: 'sshkey-edit-dialog',
title: '@i18n:objects.sshkeystore.set_dialog_title',
@ -3805,19 +3807,26 @@ IPA.sshkey_widget = function(spec) {
dialog.message = text.get('@i18n:objects.sshkeystore.set_dialog_help');
dialog.create_button({
name: 'update',
label: '@i18n:buttons.set',
click: function() {
var value = dialog.textarea.val();
that.set_user_value(value);
dialog.close();
}
});
if (writable) {
dialog.create_button({
name: 'update',
label: '@i18n:buttons.set',
click: function() {
var value = dialog.textarea.val();
that.set_user_value(value);
dialog.close();
}
});
}
var label = '@i18n:buttons.cancel';
if (!writable) {
label = '@i18n:buttons.close';
}
dialog.create_button({
name: 'cancel',
label: '@i18n:buttons.cancel',
label: label,
click: function() {
dialog.close();
}
@ -3829,7 +3838,7 @@ IPA.sshkey_widget = function(spec) {
dialog.textarea = $('<textarea/>', {
'class': 'certificate',
readonly: that.read_only,
readonly: !writable,
disabled: !that.enabled
}).appendTo(dialog.container);