lib/world_flags/helper/view/util.rb in world-flags-0.3.0 vs lib/world_flags/helper/view/util.rb in world-flags-0.3.1
- old
+ new
@@ -27,13 +27,16 @@
def self.flag_options code, title, name, options = {}
locale = WorldFlags.locale(code)
extra_options = title ? {:title => title } : {}
selected = flag_selected?(code, options) ? ' selected' : ''
+ language_name = WorldFlags.language(:en, code)
+ country_name = WorldFlags.country(:en, code)
+
# add semi class if not selected
semi = (selected.blank? ? ' semi' : '') if options[:with_semi]
- {:class => "flag #{code}#{selected}#{semi}", :'data-country' => name, :'data-cc' => code, :'data-locale' => locale}.merge(options[:html] || {}).merge(extra_options)
+ {:class => "flag #{code}#{selected}#{semi}", :'data-country_name' => country_name, :'data-language_name' => language_name, :'data-cc' => code, :'data-locale' => locale}.merge(options[:html] || {}).merge(extra_options)
end
def self.flag_selected? code, options = {}
code = code.to_sym
sel = options[:selected] || options[code]
\ No newline at end of file