fix: no add/change image-field if user is not allowed
no add/change image-field (dropdown) if user is not allowed to change (cherry picked from commit 4af5006470739a11ddcf3141c95ae6fb157d6825)
This commit is contained in:
parent
620852a100
commit
4937b3d17f
1 changed files with 11 additions and 9 deletions
|
|
@ -65,15 +65,17 @@ frappe.ui.form.setup_user_image_event = function(frm) {
|
|||
});
|
||||
}
|
||||
|
||||
frm.sidebar.image_wrapper.on('click', ':not(.sidebar-image-actions)', (e) => {
|
||||
let $target = $(e.currentTarget);
|
||||
if ($target.is('a.dropdown-toggle, .dropdown')) {
|
||||
return;
|
||||
}
|
||||
let dropdown = frm.sidebar.image_wrapper.find('.sidebar-image-actions .dropdown');
|
||||
dropdown.toggleClass('open');
|
||||
e.stopPropagation();
|
||||
});
|
||||
if (frm.fields_dict[frm.meta.image_field].df.read_only == 0) {
|
||||
frm.sidebar.image_wrapper.on('click', ':not(.sidebar-image-actions)', (e) => {
|
||||
let $target = $(e.currentTarget);
|
||||
if ($target.is('a.dropdown-toggle, .dropdown')) {
|
||||
return;
|
||||
}
|
||||
let dropdown = frm.sidebar.image_wrapper.find('.sidebar-image-actions .dropdown');
|
||||
dropdown.toggleClass('open');
|
||||
e.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
||||
// bind click on image_wrapper
|
||||
frm.sidebar.image_wrapper.on('click', '.sidebar-image-change, .sidebar-image-remove', function(e) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue