Skip to content
Snippets Groups Projects
Commit 9cbde5e9 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

allow unsetting assigned persons for resource properties of type "user" re #988

Merge request studip/studip!2020
parent 54e6a1d0
No related branches found
No related tags found
No related merge requests found
...@@ -244,14 +244,23 @@ class ResourcePropertyDefinition extends SimpleORMap ...@@ -244,14 +244,23 @@ class ResourcePropertyDefinition extends SimpleORMap
$search = new QuickSearch($input_name, new StandardSearch('user_id')); $search = new QuickSearch($input_name, new StandardSearch('user_id'));
$search->defaultValue($value, ($value ? get_fullname($value, 'full_rev_username') : '')); $search->defaultValue($value, ($value ? get_fullname($value, 'full_rev_username') : ''));
return sprintf( return sprintf(
'<label %1$s>%2$s%3$s</label>', '<label %1$s>%2$s<div class="assigned-user-search-wrapper flex-row">%3$s%4$s</div></label>',
( (
$label_html_classes $label_html_classes
? 'class="' . htmlReady($label_html_classes) . '"' ? 'class="' . htmlReady($label_html_classes) . '"'
: '' : ''
), ),
$this->__toString(), $this->__toString(),
$search->render() $search->render(),
Icon::create('refresh')->asImg(
[
'class' => 'delete-assigned-user-icon enter-accessible',
'data-input-name' => $input_name,
'title' => _('Zuorndung entfernen'),
'tabindex' => '0',
'aria-role' => 'button'
]
)
); );
} else { } else {
$input_type = 'text'; $input_type = 'text';
......
...@@ -773,7 +773,7 @@ STUDIP.ready(function () { ...@@ -773,7 +773,7 @@ STUDIP.ready(function () {
jQuery(document).on( jQuery(document).on(
'click', 'click',
'.create-booking-form .delete-assigned-user-icon', '.delete-assigned-user-icon',
function (event) { function (event) {
var quicksearch = jQuery(event.target).parent().find('input'); var quicksearch = jQuery(event.target).parent().find('input');
if (!quicksearch) { if (!quicksearch) {
......
...@@ -258,6 +258,7 @@ $(document).on('change', 'input[data-must-equal]', function() { ...@@ -258,6 +258,7 @@ $(document).on('change', 'input[data-must-equal]', function() {
$(document).on('keydown', '.enter-accessible', function(event) { $(document).on('keydown', '.enter-accessible', function(event) {
if (event.code == 'Enter') { if (event.code == 'Enter') {
//The enter key has been pressed. //The enter key has been pressed.
event.preventDefault();
$(this).trigger('click'); $(this).trigger('click');
} }
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment