Skip to content
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

[new_timepoint] only show null language option when multiple exist #8253

Merged
merged 9 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/create_timepoint/jsx/createTimepointIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ class CreateTimepoint extends React.Component {
/>
) : null;
// Include languages select.
const emptyLangOption =
Object.keys(this.state.form.options.languages).length > 1;
const languages = this.state.form.display.languages ? (
<SelectElement
id={'languageID'}
Expand All @@ -409,7 +411,7 @@ class CreateTimepoint extends React.Component {
value={this.state.form.value.languages}
options={this.state.form.options.languages}
onUserInput={this.setForm}
emptyOption={true}
emptyOption={emptyLangOption}
disabled={false}
autoSelect={true}
required={this.state.form.options.required.languages}
Expand Down
6 changes: 1 addition & 5 deletions modules/create_timepoint/php/timepoint.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ class Timepoint extends \NDB_Page implements ETagCalculator
$values['visitGroups'] = $visitGroups;

// List languages
$languages = \Utility::getLanguageList();
if (count($languages) > 1) {
$languages = [null] + $languages;
}
$values['languages'] = $languages;
$values['languages'] = \Utility::getLanguageList();

if (!empty($conflict)) {
return new \LORIS\Http\Response\JSON\Conflict(
Expand Down
6 changes: 5 additions & 1 deletion modules/create_timepoint/test/TestPlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ visit label already exists for the candidate.
successful form submission. Click on "Ok" button and ensure that it brings you back
to timepoint list page for that candidate and confirm that the new timepoint appears in the list.
[Manual Testing]
14. Check that page is inaccessible if either the user does not have data_entry
14. Ensure that there is no empty option in the language select element and a language is automatically selected when only one
language exists in the `language` table.
15. Ensure that there is an empty option in the language select element and the field is required when more than one
lagnuage exists in the `language` table
16. Check that page is inaccessible if either the user does not have data_entry
permission or the user and candidate are not the same site.
[Manual Testing]