Fix missing title attribute for checkbox.

Fix missing title attribute for checkbox.
This commit is contained in:
邱博亞 2024-07-18 10:56:24 +08:00
parent 9d01096e13
commit 3f51e89566
3 changed files with 11 additions and 3 deletions

View File

@ -330,10 +330,12 @@ module Admin::AsksHelper
default_key = options_hash.keys[default_idx]
options_values = options_hash.values
value ||= {default_key=>default_key}
readonly ? value.collect{|k1,v1| options_values[v1.to_i][I18n.locale]}.join(', ') : options_hash.collect do |index1,option|
field_name_underscre = field_name.gsub(/(\[|\])/,'_').gsub('__','_').chomp('_')
readonly ? value.collect{|k1,v1| options_values[v1.to_i][I18n.locale]}.join(', ') : ("<span class=\"checkbox\">" + options_hash.collect do |index1,option|
next if option['disabled'] == 'true'
"#{check_box_tag("#{field_name}[#{index1}]",index1,value[index1]==index1)}#{option[I18n.locale]}"
end.compact.join
checkbox_option = option[I18n.locale]
"<label class=\"checkbox-inline\" for=\"#{field_name_underscre}_#{index1}\">#{check_box_tag("#{field_name}[#{index1}]",index1,value[index1]==index1,{title: checkbox_option})}#{checkbox_option}</label>"
end.compact.join + "</span>")
end
when 'file'
file_value = value[0] rescue nil

View File

@ -77,6 +77,9 @@
.ask-question .controls > input[type="radio"]:not(:first-child) {
margin-left: 0.5em;
}
.ask-question .checkbox-inline:first-child {
margin-left: 0.625em;
}
</style>
<%# javascript_include_tag "/assets/lib/jquery-ui-1.12.1/jquery-ui.min" %>
<%# stylesheet_link_tag "/assets/lib/jquery-ui-1.12.1/jquery-ui.min" %>

View File

@ -47,6 +47,9 @@
padding: 1em 0 0 0;
text-align: center;
}
.ask-question .checkbox-inline:first-child {
margin-left: 0.625em;
}
</style>
<%= stylesheet_link_tag "custom_field" %>
<link href="/assets/ask/ask.css" media="screen" rel="stylesheet">