Class: Lipsiadmin::View::Helpers::InstanceTag

Inherits:
ActionView::Helpers::InstanceTag
  • Object
show all
Includes:
CountrySelectHelper
Defined in:
lib/view/helpers/view_helper.rb

Overview

:nodoc:

Constant Summary

Constants included from CountrySelectHelper

CountrySelectHelper::COUNTRIES

Instance Method Summary collapse

Methods included from CountrySelectHelper

#country_options_for_select, #country_select

Instance Method Details

#to_country_select_tag(priority_countries, options, html_options) ⇒ Object



194
195
196
197
198
199
200
201
202
203
204
# File 'lib/view/helpers/view_helper.rb', line 194

def to_country_select_tag(priority_countries, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  ("select",
    add_options(
      country_options_for_select(value, priority_countries),
      options, value
    ), html_options
  )
end

#to_ext_date_select_tag(options = {}, html_options = {}) ⇒ Object



178
179
180
# File 'lib/view/helpers/view_helper.rb', line 178

def to_ext_date_select_tag(options = {}, html_options = {})
  to_ext_datetime_select_tag({ :hideTime => true.to_l }.merge(options), html_options)
end

#to_ext_datetime_select_tag(options = {}, html_options = {}) ⇒ Object



182
183
184
185
186
187
188
189
190
191
192
# File 'lib/view/helpers/view_helper.rb', line 182

def to_ext_datetime_select_tag(options = {}, html_options = {})
  html_options = html_options.stringify_keys
  html_options = DEFAULT_FIELD_OPTIONS.merge(html_options)
  html_options["type"] = "hidden"
  html_options["value"] ||= value_before_type_cast(object)
  html_options["value"] &&= html_escape(html_options["value"])
  add_default_name_and_id(html_options)
  options = { :applyTo => html_options["id"], :dateFormat => I18n.t("extjs.dateFormat") }.merge(options)
  tag("input", html_options) +
  (:script, "new Ext.form.DateTimeField(#{options.to_json});", :type => Mime::JS)
end