-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-hide non-multivalued reference widget input on value selection #2363
Changes from all commits
a59f435
bde8b39
38b0367
f351348
7d9fa3e
b5ed67f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,3 +121,9 @@ form[name='edit_form'] { | |
margin-bottom: 0; | ||
} | ||
} | ||
|
||
form[name=analysisrequest_add_form] { | ||
.field { | ||
margin-bottom: 0; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why this is here inside. Also I do not see any DOM elements in the add form with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ class SelectedValues extends React.Component { | |
<button value={value} | ||
data-toggle="confirmation" | ||
data-title={_t("Unlink reference?")} | ||
className="btn btn-sm btn-link-danger" | ||
className="btn btn-sm p-0 ml-2" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is cool. Makes the whole item smaller. Thanks for this one. |
||
onClick={this.on_deselect}> | ||
<i className="fas fa-times-circle"></i> | ||
</button> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,6 @@ class QuerySelectWidgetController extends React.Component { | |
"columns", // columns to be displayed in the results popup | ||
"display_template", // template to use for the selected values | ||
"multi_valued", // if true, more than one value can be set | ||
"hide_input_after_select", // only for single valued fields to hide the input after selection | ||
"clear_results_after_select", // clear results after value select | ||
"disabled", // if true, the field is rendered as not editable | ||
"readonly", // if true, the field is rendered as not editable | ||
|
@@ -236,7 +235,13 @@ class QuerySelectWidgetController extends React.Component { | |
* @returns {Boolean} true/false if the search field is rendered | ||
*/ | ||
show_search_field() { | ||
if (!this.state.multi_valued && this.state.values.length > 0 && this.state.hide_input_after_select) { | ||
if (this.state.disabled) { | ||
return false; | ||
} | ||
if (this.state.readonly) { | ||
return false; | ||
} | ||
if (!this.state.multi_valued && this.state.values.length > 0) { | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about this. Probably the last line needs to be first to keep the input widget visible, even if it is readonly/disabled. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why one would want the input element to be displayed if it cannot be used (because is disabled or readonly)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, good point. To see that it is disabled by purpose maybe? |
||
} | ||
return true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also remove the attribute from the DX version:
senaite.core/src/senaite/core/z3cform/widgets/queryselect/widget.py
Lines 163 to 164 in f351348
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with b5ed67f