Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
birger
users
Commits
9584f748
Commit
9584f748
authored
Jul 29, 2021
by
Birger Schacht
Committed by
o@immerda.ch
Aug 05, 2021
Browse files
Don't display a select box if there is only one option to choose from
... instead display a readonly text field
parent
299d62f5
Pipeline
#8189
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/views/resources/create.html.erb
View file @
9584f748
...
...
@@ -41,7 +41,11 @@ allowed = [q['max'].to_i - q['cur'].to_i, 0].max
<%
end
%>
<%=
case
v
when
Array
select_tag
(
'data_'
+
n
,
options_for_select
(
v
),
class:
'form-control'
)
if
v
.
length
==
1
text_field_tag
(
'data_'
+
n
,
v
,
class:
'form-control'
,
readonly:
true
)
else
select_tag
(
'data_'
+
n
,
options_for_select
(
v
),
class:
'form-control'
)
end
else
text_field_tag
(
'data_'
+
n
,
""
,
class:
'form-control'
)
end
%>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment