From 62dfd04776babf780abffcf49c47a2fdc2eb88e6 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Wed, 26 Jun 2013 20:46:27 +0200 Subject: [PATCH] Replace the label hack in grouped select forms by a decent optgroup --- stoptime.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/stoptime.rb b/stoptime.rb index d1d81c5..6d71a7e 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -2483,12 +2483,13 @@ module StopTime::Views html_options.merge!(:name => name, :id => name) select(html_options) do opts.keys.sort.each do |key| - option("— #{key} —", {:disabled => true}) - opts[key].sort_by { |o| o.last }.each do |opt_val, opt_str| - if @input[name] == opt_val - option(opt_str, {:value => opt_val, :selected => true}) - else - option(opt_str, {:value => opt_val}) + optgroup :label => key do + opts[key].sort_by { |o| o.last }.each do |opt_val, opt_str| + if @input[name] == opt_val + option(opt_str, {:value => opt_val, :selected => true}) + else + option(opt_str, {:value => opt_val}) + end end end end